aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYongqiang Yang <xiaoqiangnk@gmail.com>2011-12-13 21:51:55 -0500
committerAndy Green <andy.green@linaro.org>2011-12-26 22:25:11 +0800
commite6fd79db787f7a638c3557640a1334187333889f (patch)
tree3f413f92762c7addacfca446be50065f86874297 /fs
parent64740d3a066cfb89fc8b46281dfa47c4202835e0 (diff)
ext4: avoid potential hang in mpage_submit_io() when blocksize < pagesize
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> Cc: stable@kernel.org
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index b5edc6e4bab..cf20e1fe778 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;