diff options
author | Kazuya Mio <k-mio@sx.jp.nec.com> | 2011-10-20 19:23:08 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-20 19:23:08 -0400 |
commit | 8de49e674a1133ab8998914a6e933ceb4b5f4b07 (patch) | |
tree | 19d7d5de54b166f0d4e0ea9f57d6bcf0b451e52b /fs/ext4/inode.c | |
parent | 09e0834fb0ce1ea2a63885177015bd5d7d2bc22d (diff) |
ext4: fix the deadlock in mpage_da_map_and_submit()
If ext4_jbd2_file_inode() in mpage_da_map_and_submit() fails due to
journal abort, this function returns to caller without unlocking the
page. It leads to the deadlock, and the patch fixes this issue by
calling mpage_da_submit_io().
Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ecb572591924..ff6aace0bb3c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1552,9 +1552,11 @@ static void mpage_da_map_and_submit(struct mpage_da_data *mpd) | |||
1552 | 1552 | ||
1553 | if (ext4_should_order_data(mpd->inode)) { | 1553 | if (ext4_should_order_data(mpd->inode)) { |
1554 | err = ext4_jbd2_file_inode(handle, mpd->inode); | 1554 | err = ext4_jbd2_file_inode(handle, mpd->inode); |
1555 | if (err) | 1555 | if (err) { |
1556 | /* Only if the journal is aborted */ | 1556 | /* Only if the journal is aborted */ |
1557 | return; | 1557 | mpd->retval = err; |
1558 | goto submit_io; | ||
1559 | } | ||
1558 | } | 1560 | } |
1559 | } | 1561 | } |
1560 | 1562 | ||
@@ -2294,11 +2296,12 @@ retry: | |||
2294 | ret = 0; | 2296 | ret = 0; |
2295 | } else if (ret == MPAGE_DA_EXTENT_TAIL) { | 2297 | } else if (ret == MPAGE_DA_EXTENT_TAIL) { |
2296 | /* | 2298 | /* |
2297 | * got one extent now try with | 2299 | * Got one extent now try with rest of the pages. |
2298 | * rest of the pages | 2300 | * If mpd.retval is set -EIO, journal is aborted. |
2301 | * So we don't need to write any more. | ||
2299 | */ | 2302 | */ |
2300 | pages_written += mpd.pages_written; | 2303 | pages_written += mpd.pages_written; |
2301 | ret = 0; | 2304 | ret = mpd.retval; |
2302 | io_done = 1; | 2305 | io_done = 1; |
2303 | } else if (wbc->nr_to_write) | 2306 | } else if (wbc->nr_to_write) |
2304 | /* | 2307 | /* |