Thread (1 message) 1 message, 1 author, 2011-11-26

Re: [PATCH 1/2] ext4: let mpage_submit_io works well when blocksize < pagesize

From: Tao Ma <hidden>
Date: 2011-11-26 15:23:14

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.
Yongqiang.

On Saturday, November 26, 2011, Tao Ma <tm@tao.ma <mailto:tm@tao.ma>> wrote:
quoted
Hi Yongqiang,
On 11/23/2011 05:15 PM, Yongqiang Yang wrote:
quoted
If there is a unwritten but clean buffer in a page and there is a
dirty buffer
quoted
quoted
after the buffer, then mpage_submit_io does not write the dirty
buffer out.
quoted
quoted
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
quoted
This patch fixes the problem by checking dirty flag.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com
<mailto:xiaoqiangnk@gmail.com>>
quoted
quoted
---
 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,
quoted
quoted
                                      clear_buffer_unwritten(bh);
                              }

-                             /* skip page if block allocation undone */
-                             if (buffer_delay(bh) ||
buffer_unwritten(bh))
quoted
quoted
+                             /*
+                              * 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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help