Commit 214eb5a4 authored by Zhang Yi's avatar Zhang Yi Committed by Theodore Ts'o

jbd2: remove redundant buffer io error checks

Now that __jbd2_journal_remove_checkpoint() can detect buffer io error
and mark journal checkpoint error, then we abort the journal later
before updating log tail to ensure the filesystem works consistently.
So we could remove other redundant buffer io error checkes.
Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210610112440.3438139-5-yi.zhang@huawei.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 235d6806
...@@ -91,8 +91,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh) ...@@ -91,8 +91,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
int ret = 0; int ret = 0;
struct buffer_head *bh = jh2bh(jh); struct buffer_head *bh = jh2bh(jh);
if (jh->b_transaction == NULL && !buffer_locked(bh) && if (!jh->b_transaction && !buffer_locked(bh) && !buffer_dirty(bh)) {
!buffer_dirty(bh) && !buffer_write_io_error(bh)) {
JBUFFER_TRACE(jh, "remove from checkpoint list"); JBUFFER_TRACE(jh, "remove from checkpoint list");
ret = __jbd2_journal_remove_checkpoint(jh) + 1; ret = __jbd2_journal_remove_checkpoint(jh) + 1;
} }
...@@ -228,7 +227,6 @@ int jbd2_log_do_checkpoint(journal_t *journal) ...@@ -228,7 +227,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
* OK, we need to start writing disk blocks. Take one transaction * OK, we need to start writing disk blocks. Take one transaction
* and write it. * and write it.
*/ */
result = 0;
spin_lock(&journal->j_list_lock); spin_lock(&journal->j_list_lock);
if (!journal->j_checkpoint_transactions) if (!journal->j_checkpoint_transactions)
goto out; goto out;
...@@ -295,8 +293,6 @@ int jbd2_log_do_checkpoint(journal_t *journal) ...@@ -295,8 +293,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
goto restart; goto restart;
} }
if (!buffer_dirty(bh)) { if (!buffer_dirty(bh)) {
if (unlikely(buffer_write_io_error(bh)) && !result)
result = -EIO;
BUFFER_TRACE(bh, "remove from checkpoint"); BUFFER_TRACE(bh, "remove from checkpoint");
if (__jbd2_journal_remove_checkpoint(jh)) if (__jbd2_journal_remove_checkpoint(jh))
/* The transaction was released; we're done */ /* The transaction was released; we're done */
...@@ -356,8 +352,6 @@ int jbd2_log_do_checkpoint(journal_t *journal) ...@@ -356,8 +352,6 @@ int jbd2_log_do_checkpoint(journal_t *journal)
spin_lock(&journal->j_list_lock); spin_lock(&journal->j_list_lock);
goto restart2; goto restart2;
} }
if (unlikely(buffer_write_io_error(bh)) && !result)
result = -EIO;
/* /*
* Now in whatever state the buffer currently is, we * Now in whatever state the buffer currently is, we
...@@ -369,10 +363,7 @@ int jbd2_log_do_checkpoint(journal_t *journal) ...@@ -369,10 +363,7 @@ int jbd2_log_do_checkpoint(journal_t *journal)
} }
out: out:
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
if (result < 0) result = jbd2_cleanup_journal_tail(journal);
jbd2_journal_abort(journal, result);
else
result = jbd2_cleanup_journal_tail(journal);
return (result < 0) ? result : 0; return (result < 0) ? result : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment