Skip to content

Commit

Permalink
ext4: avoid potential hang in mpage_submit_io() when blocksize < page…
Browse files Browse the repository at this point in the history
…size

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
  • Loading branch information
Yongqiang Yang authored and Theodore Ts'o committed Dec 14, 2011
1 parent ea51d13 commit 13a79a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 13a79a4

Please sign in to comment.