Re: [PATCH 2/8] add locked_recursive_removal()

Christian Brauner
2025-06-16T14:38:45Z

On Sat, Jun 14, 2025 at 07:02:24AM +0100, Al Viro wrote:
> simple_recursive_removal() assumes that parent is not locked and
> locks it when it finally gets to removing the victim itself.
> Usually that's what we want, but there are places where the
> parent is *already* locked and we need it to stay that way.
> In those cases simple_recursive_removal() would, of course,
> deadlock, so we have to play racy games with unlocking/relocking
> the parent around the call or open-code the entire thing.
>
> A better solution is to provide a variant that expects to
> be called with the parent already locked by the caller.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Reviewed-by: Christian Brauner <brauner@kernel.org>