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

Hidehiro Kawai
2008-06-12T13:20:14Z

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