• Christian Brauner's avatar
    fs: better handle deep ancestor chains in is_subdir() · 391b59b0
    Christian Brauner authored
    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: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    391b59b0
dcache.c 83.7 KB