]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
fs/dcache.c: avoid soft-lockup in dput()
authorWei Fang <fangwei1@huawei.com>
Wed, 6 Jul 2016 03:32:20 +0000 (11:32 +0800)
committerKamal Mostafa <kamal@canonical.com>
Thu, 18 Aug 2016 17:24:15 +0000 (10:24 -0700)
commitd2f4ebdc916028a45bcc5c42642a115cd3a55a60
tree4d409628d6f914a0cea76ff7e0d8a35acb7b6725
parentae5c5b327d3f733ebc24e215e853d73e5cb796b2
fs/dcache.c: avoid soft-lockup in dput()

BugLink: http://bugs.launchpad.net/bugs/1614560
commit 47be61845c775643f1aa4d2a54343549f943c94c upstream.

We triggered soft-lockup under stress test which
open/access/write/close one file concurrently on more than
five different CPUs:

WARN: soft lockup - CPU#0 stuck for 11s! [who:30631]
...
[<ffffffc0003986f8>] dput+0x100/0x298
[<ffffffc00038c2dc>] terminate_walk+0x4c/0x60
[<ffffffc00038f56c>] path_lookupat+0x5cc/0x7a8
[<ffffffc00038f780>] filename_lookup+0x38/0xf0
[<ffffffc000391180>] user_path_at_empty+0x78/0xd0
[<ffffffc0003911f4>] user_path_at+0x1c/0x28
[<ffffffc00037d4fc>] SyS_faccessat+0xb4/0x230

->d_lock trylock may failed many times because of concurrently
operations, and dput() may execute a long time.

Fix this by replacing cpu_relax() with cond_resched().
dput() used to be sleepable, so make it sleepable again
should be safe.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
fs/dcache.c