diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2011-12-13 21:51:55 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-12-13 21:51:55 -0500 |
commit | 13a79a4741d37fda2fbafb953f0f301dc007928f (patch) | |
tree | b88b5b99690738c278c48b180cbd1ab2821522f6 | |
parent | ea51d132dbf9b00063169c1159bee253d9649224 (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
-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 b5edc6e4bab9..cf20e1fe7782 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, | |||
1339 | clear_buffer_unwritten(bh); | 1339 | clear_buffer_unwritten(bh); |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | /* skip page if block allocation undone */ | 1342 | /* |
1343 | if (buffer_delay(bh) || buffer_unwritten(bh)) | 1343 | * skip page if block allocation undone and |
1344 | * block is dirty | ||
1345 | */ | ||
1346 | if (ext4_bh_delay_or_unwritten(NULL, bh)) | ||
1344 | skip_page = 1; | 1347 | skip_page = 1; |
1345 | bh = bh->b_this_page; | 1348 | bh = bh->b_this_page; |
1346 | block_start += bh->b_size; | 1349 | block_start += bh->b_size; |