diff options
| author | Josef Bacik <josef@toxicpanda.com> | 2026-10-30 13:38:23 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-11-11 11:59:28 +0100 |
| commit | 649918e04e0ead9bfc861aacdd2e5b39b5bdf869 (patch) | |
| tree | 4b55a1327a7311b094ef0841d78d1d2403552e13 /include/linux | |
| parent | 20a6a9ec19e522ae85f87337886b3fb47efce5f3 (diff) | |
dcache: wait for a racing eviction of a secondary root
Commit e9895609cb7f ("wind ->s_roots via ->d_sib instead of ->d_hash")
keeps a secondary root on ->s_roots until dentry_unlist() so that
shrink_dcache_for_umount() can find one that another thread is evicting
and wait for it. But do_one_tree() takes every root off the list before
its dput() which breaks that:
thread A umount
dentry_kill(root), refcount is 0
lock_for_kill()
spin_trylock(->i_lock) fails
spin_unlock(->d_lock)
shrink_dcache_for_umount()
dget_dlock(root)
do_one_tree(root)
unlink_secondary_root(root)
spin_lock(->i_lock)
dput(root), refcount is 0
lock_for_kill()
trylock fails, waits
spin_lock(->d_lock)
refcount is 0 again, go on
lockref_mark_dead()
dentry_unlink_inode()
drops both locks
root is dead, give up
->s_roots is empty, done
evict_inodes()
"Busy inodes after unmount"
iput()
Thread A evicts without pinning the superblock. namespace_unlock() does
that for old mountpoints after dropping namespace_sem, and a secondary
root goes with its last child.
So only take busy roots off the list. Leave the others to
dentry_unlist() so that shrink_dcache_for_umount() finds them and waits
for an eviction in progress. A root that becomes busy after the check is
picked up again and taken off the list then.
Fixes: 78db93943210 ("dcache: keep shrink_dcache_for_umount() making progress on busy roots")
Cc: stable@vger.kernel.org # v7.2+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261030-work-dcache-ai-v1-2-cd6b86e0ccc7@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
