Commit 8afe1f65 authored by Yongqiang Yang's avatar Yongqiang Yang Committed by Greg Kroah-Hartman

ext4: avoid potential hang in mpage_submit_io() when blocksize < pagesize

commit 13a79a47 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: default avatarYongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d118bc3a
...@@ -1261,8 +1261,11 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd, ...@@ -1261,8 +1261,11 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd,
clear_buffer_unwritten(bh); 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; skip_page = 1;
bh = bh->b_this_page; bh = bh->b_this_page;
block_start += bh->b_size; block_start += bh->b_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment