Skip to contentSkip to conversation

ext4: fix the deadlock in ext4_ordered_write_end()

PATCH Applied Akira Fujita 2 participants 2 messages Oct 13, 2011 – Oct 21, 2011 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: fix the deadlock in ext4_ordered_write_end()

From: Akira Fujita <[email protected]>

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.

---
 fs/ext4/inode.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/ext4/inode.c +4 -0
index 986e238..69dc2c6 100644
@@ -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;
maintainer Applied
#1 lore raw
Quoted 8 lines · Akira Fujita

From: Akira Fujita <[email protected]>

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.

Thanks, applied.

- Ted