linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tao Ma <tm@tao.ma>
To: Yongqiang Yang <xiaoqiangnk@gmail.com>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
	"achender@linux.vnet.ibm.com" <achender@linux.vnet.ibm.com>,
	"tytso@mit.edu" <tytso@mit.edu>
Subject: Re: [PATCH 1/2] ext4: let mpage_submit_io works well when blocksize < pagesize
Date: Sun, 27 Nov 2011 16:59:14 +0800	[thread overview]
Message-ID: <4ED1FBE2.8020001@tao.ma> (raw)
In-Reply-To: <CAGBYx2apFEheGGtJWeLeKKGBWeq849AW6+wwqvEopM0PeJQd=w@mail.gmail.com>

On 11/27/2011 09:29 AM, Yongqiang Yang wrote:
> 
> 
> On Saturday, November 26, 2011, Tao Ma <tm@tao.ma <mailto:tm@tao.ma>> wrote:
>> On 11/26/2011 11:13 PM, Yongqiang Yang wrote:
>>> Hi,
>>>
>>> It can be tested by xfstests 61 or 91, I did not remember which one.
>> ok, I will try it later. But I still wonder how it happens. See my
>> comments below.
>>>
>>> It can be reproduced by reading on a fallocted block and write the block
>>> after the fallocted block.  Then the written block can not be written
>>> out by da_writepages.
>> Why? in read no bh will be created, and in write only the written bh
>> will be mapped and set unwritten. How could that happen? Sorry, but this
>> explanation doesn't convince me.
> Ok!  The bug was found with punch hole enabled, and punch hole creates
> empty buffers sometimes.
> Actually, punching hole can read the whole page like read operation
> does, but it do not.  May be this is the source of the  problem.
> The problemastic  function is discard_partial_buffers.   I post a patch
> fixing another bug in it in this series.  If we read whole page in this
> function, the problem can also be solved.
Got it and thanks for the explanation. So we introduced a bug and then
fix it in another way. ;)

Thanks
Tao
> 
> Yongqiang.
>>>
>>> Yongqiang.
>>>
>>> On Saturday, November 26, 2011, Tao Ma <tm@tao.ma <mailto:tm@tao.ma>
> <mailto:tm@tao.ma <mailto:tm@tao.ma>>> wrote:
>>>> Hi Yongqiang,
>>>> On 11/23/2011 05:15 PM, Yongqiang Yang wrote:
>>>>> If there is a unwritten but clean buffer in a page and there is a
>>> dirty buffer
>>>>> after the buffer, then mpage_submit_io does not write the dirty
>>> buffer out.
>>>>> As a result, da_writepages loops forever.
>>>> Did you ever meet with this bug or just find it to be a possible bug by
>>>> skimming the code? Actually, I can't find a proper way to get a buffer
>>>> which can satisfy the check.
>>>>
>>>> Thanks
>>>> Tao
>>>>>
>>>>> This patch fixes the problem by checking dirty flag.
>>>>>
>>>>> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com
> <mailto:xiaoqiangnk@gmail.com>
>>> <mailto:xiaoqiangnk@gmail.com <mailto:xiaoqiangnk@gmail.com>>>
>>>>> ---
>>>>>  fs/ext4/inode.c |    7 +++++--
>>>>>  1 files changed, 5 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
>>>>> index 755f6c7..20a1d17 100644
>>>>> --- a/fs/ext4/inode.c
>>>>> +++ b/fs/ext4/inode.c
>>>>> @@ -1339,8 +1339,11 @@ static int mpage_da_submit_io(struct
>>> mpage_da_data *mpd,
>>>>>                                       clear_buffer_unwritten(bh);
>>>>>                               }
>>>>>
>>>>> -                             /* skip page if block allocation
> undone */
>>>>> -                             if (buffer_delay(bh) ||
>>> buffer_unwritten(bh))
>>>>> +                             /*
>>>>> +                              * skip page if block allocation
> undone and
>>>>> +                              * block is dirty
>>>>> +                              */
>>>>> +                             if (ext4_bh_delay_or_unwritten(NULL, bh))
>>>>>                                       skip_page = 1;
>>>>>                               bh = bh->b_this_page;
>>>>>                               block_start += bh->b_size;
>>>>
>>>>
>>>>
>>>
>>> --
>>> Best Wishes
>>> Yongqiang Yang
>>>
>>
>>
> 
> -- 
> Best Wishes
> Yongqiang Yang
> 


  parent reply	other threads:[~2011-11-27  8:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23  9:15 [PATCH 1/2] ext4: let mpage_submit_io works well when blocksize < pagesize Yongqiang Yang
2011-11-23  9:15 ` [PATCH 2/2] ext4: let ext4_discard_partial_buffers handle pages without buffers correctly Yongqiang Yang
2011-12-14  3:05   ` Ted Ts'o
2011-11-26 15:08 ` [PATCH 1/2] ext4: let mpage_submit_io works well when blocksize < pagesize Tao Ma
     [not found]   ` <CAGBYx2a_Xm5e3ESuh2YpBpcrEM4j5_TPegQC3WO1yQVtmqJ2Pw@mail.gmail.com>
2011-11-26 15:22     ` Tao Ma
     [not found]       ` <CAGBYx2apFEheGGtJWeLeKKGBWeq849AW6+wwqvEopM0PeJQd=w@mail.gmail.com>
2011-11-27  8:59         ` Tao Ma [this message]
2011-12-01 20:13 ` Allison Henderson
2011-12-02  1:15   ` Yongqiang Yang
2011-12-02  6:46     ` Allison Henderson
2011-12-14  3:05 ` Ted Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ED1FBE2.8020001@tao.ma \
    --to=tm@tao.ma \
    --cc=achender@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xiaoqiangnk@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).