Commit 9f818b4a authored by Hidehiro Kawai's avatar Hidehiro Kawai Committed by Linus Torvalds

jbd: test BH_Write_EIO to detect errors on metadata buffers

__try_to_free_cp_buf(), __process_buffer(), and __wait_cp_io() test
BH_Uptodate flag to detect write I/O errors on metadata buffers.  But by
commit 95450f5a "ext3: don't read inode
block if the buffer has a write error"(*), BH_Uptodate flag can be set to
inode buffers with BH_Write_EIO in order to avoid reading old inode data.
So now, we have to test BH_Write_EIO flag of checkpointing inode buffers
instead of BH_Uptodate.  This patch does it.
Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Acked-by: default avatarJan Kara <jack@suse.cz>
Acked-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2d7c820e
...@@ -94,7 +94,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh) ...@@ -94,7 +94,7 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
struct buffer_head *bh = jh2bh(jh); struct buffer_head *bh = jh2bh(jh);
if (jh->b_jlist == BJ_None && !buffer_locked(bh) && if (jh->b_jlist == BJ_None && !buffer_locked(bh) &&
!buffer_dirty(bh) && buffer_uptodate(bh)) { !buffer_dirty(bh) && !buffer_write_io_error(bh)) {
JBUFFER_TRACE(jh, "remove from checkpoint list"); JBUFFER_TRACE(jh, "remove from checkpoint list");
ret = __journal_remove_checkpoint(jh) + 1; ret = __journal_remove_checkpoint(jh) + 1;
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
...@@ -199,7 +199,7 @@ restart: ...@@ -199,7 +199,7 @@ restart:
spin_lock(&journal->j_list_lock); spin_lock(&journal->j_list_lock);
goto restart; goto restart;
} }
if (unlikely(!buffer_uptodate(bh))) if (unlikely(buffer_write_io_error(bh)))
ret = -EIO; ret = -EIO;
/* /*
...@@ -268,7 +268,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, ...@@ -268,7 +268,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh,
ret = 1; ret = 1;
} else if (!buffer_dirty(bh)) { } else if (!buffer_dirty(bh)) {
ret = 1; ret = 1;
if (unlikely(!buffer_uptodate(bh))) if (unlikely(buffer_write_io_error(bh)))
ret = -EIO; ret = -EIO;
J_ASSERT_JH(jh, !buffer_jbddirty(bh)); J_ASSERT_JH(jh, !buffer_jbddirty(bh));
BUFFER_TRACE(bh, "remove from checkpoint"); BUFFER_TRACE(bh, "remove from checkpoint");
......
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