]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
Revert "jffs2: Fix lock acquisition order bug in jffs2_write_begin"
authorThomas Betker <thomas.betker@rohde-schwarz.com>
Tue, 10 Nov 2015 21:18:15 +0000 (22:18 +0100)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:26:36 +0000 (10:26 +0100)
commit0b4fb88a69e35ef20f7ba0b7ac5cccd3b525a262
treebdac77e0157a3f49edc0f3f2cfe95d08ed770767
parent174b938a039f4cea66e7acb7eadea72cef70679f
Revert "jffs2: Fix lock acquisition order bug in jffs2_write_begin"

BugLink: http://bugs.launchpad.net/bugs/1555640
commit 157078f64b8a9cd7011b6b900b2f2498df850748 upstream.

This reverts commit 5ffd3412ae55
("jffs2: Fix lock acquisition order bug in jffs2_write_begin").

The commit modified jffs2_write_begin() to remove a deadlock with
jffs2_garbage_collect_live(), but this introduced new deadlocks found
by multiple users. page_lock() actually has to be called before
mutex_lock(&c->alloc_sem) or mutex_lock(&f->sem) because
jffs2_write_end() and jffs2_readpage() are called with the page locked,
and they acquire c->alloc_sem and f->sem, resp.

In other words, the lock order in jffs2_write_begin() was correct, and
it is the jffs2_garbage_collect_live() path that has to be changed.

Revert the commit to get rid of the new deadlocks, and to clear the way
for a better fix of the original deadlock.

Reported-by: Deng Chao <deng.chao1@zte.com.cn>
Reported-by: Ming Liu <liu.ming50@gmail.com>
Reported-by: wangzaiwei <wangzaiwei@top-vision.cn>
Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
fs/jffs2/file.c