summaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorKazuya Mio <k-mio@sx.jp.nec.com>2011-10-20 19:23:08 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-10-20 19:23:08 -0400
commit8de49e674a1133ab8998914a6e933ceb4b5f4b07 (patch)
tree19d7d5de54b166f0d4e0ea9f57d6bcf0b451e52b /fs/ext4/inode.c
parent09e0834fb0ce1ea2a63885177015bd5d7d2bc22d (diff)
downloadlinux-8de49e674a1133ab8998914a6e933ceb4b5f4b07.tar.gz
linux-8de49e674a1133ab8998914a6e933ceb4b5f4b07.tar.bz2
linux-8de49e674a1133ab8998914a6e933ceb4b5f4b07.zip
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.c13
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)
if (ext4_should_order_data(mpd->inode)) {
err = ext4_jbd2_file_inode(handle, mpd->inode);
- if (err)
+ if (err) {
/* Only if the journal is aborted */
- return;
+ mpd->retval = err;
+ goto submit_io;
+ }
}
}
@@ -2294,11 +2296,12 @@ retry:
ret = 0;
} else if (ret == MPAGE_DA_EXTENT_TAIL) {
/*
- * got one extent now try with
- * rest of the pages
+ * Got one extent now try with rest of the pages.
+ * If mpd.retval is set -EIO, journal is aborted.
+ * So we don't need to write any more.
*/
pages_written += mpd.pages_written;
- ret = 0;
+ ret = mpd.retval;
io_done = 1;
} else if (wbc->nr_to_write)
/*