Re: [PATCH 1/5] jbd: strictly check for write errors on data buffers

From: Hidehiro Kawai
Date: Thu Jun 12 2008 - 09:20:15 EST


Hi,

Jan Kara wrote:

> On Mon 09-06-08 19:09:25, Hidehiro Kawai wrote:

>>Index: linux-2.6.26-rc4/fs/jbd/commit.c
>>===================================================================
>>--- linux-2.6.26-rc4.orig/fs/jbd/commit.c
>>+++ linux-2.6.26-rc4/fs/jbd/commit.c
>>@@ -432,8 +432,11 @@ void journal_commit_transaction(journal_
>> wait_on_buffer(bh);
>> spin_lock(&journal->j_list_lock);
>> }
>>- if (unlikely(!buffer_uptodate(bh)))
>>+ if (unlikely(!buffer_uptodate(bh))) {
>>+ set_bit(AS_EIO, &bh->b_page->mapping->flags);
>>+ SetPageError(bh->b_page);
>> err = -EIO;
>>+ }
>
> Actually, you should be more careful here because if the data buffer has
> been truncated in the currently running transaction, it can happen that
> b_page->mapping is NULL. It is a question how to safely access
> page->mapping - probably you'll need page lock for that...

Thank you for pointing out this problem. I confirmed that
b_page->mapping can be NULL. I'm making sure that the locking page
approach works out well.

Thanks,
--
Hidehiro Kawai
Hitachi, Systems Development Laboratory
Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/