]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
better lockdep annotations for simple_recursive_removal()
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 3 Jul 2025 02:30:32 +0000 (22:30 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:15 +0000 (16:28 +0200)
commit847a204d3067487f116e4d89ffa60767d7f2fc0b
treece8fc71cdd951034883754e5ecebd2f1a90ff55c
parentcb7b595604000d8c4eca81d192ec0a436526d2da
better lockdep annotations for simple_recursive_removal()

[ Upstream commit 2a8061ee5e41034eb14170ec4517b5583dbeff9f ]

We want a class that nests outside of I_MUTEX_NORMAL (for the sake of
callbacks that might want to lock the victim) and inside I_MUTEX_PARENT
(so that a variant of that could be used with parent of the victim
held locked by the caller).

In reality, simple_recursive_removal()
* never holds two locks at once
* holds the lock on parent of dentry passed to callback
* is used only on the trees with fixed topology, so the depths
are not changing.

So the locking order is actually fine.

AFAICS, the best solution is to assign I_MUTEX_CHILD to the locks
grabbed by that thing.

Reported-by: syzbot+169de184e9defe7fe709@syzkaller.appspotmail.com
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/libfs.c