瀏覽代碼

ext4: fix deadlock in ext4_ordered_write_end()

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>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Akira Fujita 13 年之前
父節點
當前提交
09e0834fb0
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      fs/ext4/inode.c

+ 4 - 0
fs/ext4/inode.c

@@ -959,7 +959,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;