diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2011-12-13 21:51:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-21 12:57:44 -0800 |
commit | 8fe5e8ff93473129957c6d4a7df80046186b9c7b (patch) | |
tree | 9561105270aeec6e9c28fc3cbb430040a5be6ca7 | |
parent | dda54df863232231ce851045834f475f02a7e565 (diff) |
ext4: avoid potential hang in mpage_submit_io() when blocksize < pagesize
commit 13a79a4741d37fda2fbafb953f0f301dc007928f upstream.
If there is an 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.
This patch fixes the problem by checking dirty flag.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | 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 ea9076b8d917..af0906080fd8 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2126,8 +2126,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; |