]> www.infradead.org Git - nvme.git/commit
fs: better handle deep ancestor chains in is_subdir()
authorChristian Brauner <brauner@kernel.org>
Tue, 2 Jul 2024 19:03:26 +0000 (21:03 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 2 Jul 2024 19:18:32 +0000 (21:18 +0200)
commit391b59b045004d5b985d033263ccba3e941a7740
treed170651a24545284b931015070471d2d34ae5794
parent3cad1bc010416c6dd780643476bc59ed742436b9
fs: better handle deep ancestor chains in is_subdir()

Jan reported that 'cd ..' may take a long time in deep directory
hierarchies under a bind-mount. If concurrent renames happen it is
possible to livelock in is_subdir() because it will keep retrying.

Change is_subdir() from simply retrying over and over to retry once and
then acquire the rename lock to handle deep ancestor chains better. The
list of alternatives to this approach were less then pleasant. Change
the scope of rcu lock to cover the whole walk while at it.

A big thanks to Jan and Linus. Both Jan and Linus had proposed
effectively the same thing just that one version ended up being slightly
more elegant.

Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/dcache.c