]> git.baikalelectronics.ru Git - 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)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 25 Feb 2016 11:11:25 +0000 (11:11 +0000)
commitaa6eb7e710ce660c8c657b8c5b2c5ee423cf0c1a
tree7bfe4c748232f41764dcaa80c1810abacd70bef4
parentfe03ad0d56fad8eafcb4a170b38682e44228323c
Revert "jffs2: Fix lock acquisition order bug in jffs2_write_begin"

This reverts commit 269155104d53
("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>
Cc: stable@vger.kernel.org
fs/jffs2/file.c