summaryrefslogtreecommitdiff
path: root/fs/Makefile
diff options
context:
space:
mode:
authorJohn Ogness <john.ogness@linutronix.de>2018-02-23 00:50:24 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2018-03-29 15:07:44 -0400
commit8f04da2adbdffed8dc4b2feb00ec3b3d84683885 (patch)
tree856f7627b33aea9f930931ff143da1e150f3b629 /fs/Makefile
parentf657a666fd1b1b9fe59963943c74c245ae66f4cc (diff)
fs/dcache: Avoid a try_lock loop in shrink_dentry_list()
shrink_dentry_list() holds dentry->d_lock and needs to acquire dentry->d_inode->i_lock. This cannot be done with a spin_lock() operation because it's the reverse of the regular lock order. To avoid ABBA deadlocks it is done with a trylock loop. Trylock loops are problematic in two scenarios: 1) PREEMPT_RT converts spinlocks to 'sleeping' spinlocks, which are preemptible. As a consequence the i_lock holder can be preempted by a higher priority task. If that task executes the trylock loop it will do so forever and live lock. 2) In virtual machines trylock loops are problematic as well. The VCPU on which the i_lock holder runs can be scheduled out and a task on a different VCPU can loop for a whole time slice. In the worst case this can lead to starvation. Commits 47be61845c77 ("fs/dcache.c: avoid soft-lockup in dput()") and 046b961b45f9 ("shrink_dentry_list(): take parent's d_lock earlier") are addressing exactly those symptoms. Avoid the trylock loop by using dentry_kill(). When pruning ancestors, the same code applies that is used to kill a dentry in dput(). This also has the benefit that the locking order is now the same. First the inode is locked, then the parent. Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/Makefile')
0 files changed, 0 insertions, 0 deletions