Patchwork ext4: fix the deadlock in ext4_ordered_write_end()

login
register
mail settings
Submitter Akira Fujita
Date Oct. 13, 2011, 2:05 a.m.
Message ID <4E964780.4080105@rs.jp.nec.com>
Download mbox | patch
Permalink /patch/119339/
State Accepted
Headers show

Comments

Akira Fujita - Oct. 13, 2011, 2:05 a.m.
From: Akira Fujita <a-fujita@rs.jp.nec.com>

If ext4_jbd2_file_inode() in ext4_ordered_write_end() fails
for some reasons, this function returns to caller
without unlocking the page.
It leads to the deadlock, and the patch fixes this issue.

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
---
 fs/ext4/inode.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Oct. 20, 2011, 10:53 p.m.
On Thu, Oct 13, 2011 at 11:05:52AM +0900, Akira Fujita wrote:
> From: Akira Fujita <a-fujita@rs.jp.nec.com>
> 
> If ext4_jbd2_file_inode() in ext4_ordered_write_end() fails
> for some reasons, this function returns to caller
> without unlocking the page.
> It leads to the deadlock, and the patch fixes this issue.
> 
> Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 986e238..69dc2c6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -909,7 +909,11 @@  static int ext4_ordered_write_end(struct file *file,
 			ext4_orphan_add(handle, inode);
 		if (ret2 < 0)
 			ret = ret2;
+	} else {
+		unlock_page(page);
+		page_cache_release(page);
 	}
+
 	ret2 = ext4_journal_stop(handle);
 	if (!ret)
 		ret = ret2;