On Wed, Sep 14, 2022 at 09:52:37AM +1000, NeilBrown wrote: > - lookup the parents of both paths. > - lock the "to" directory. > - if the "from" directory is the same, or if a trylock of the from > directory succeeds, then we have the locks and can perform the > last component lookup and perform the link without racing with > rename. > - if the trylock fails, we drop the lock on "to" and use lock_rename(). > We drop the s_vfs_rename_mutex immediately after lock_rename() > so after the vfs_link() we just unlock both parent directories. Umm... Care to put together an update of deadlock avoidance proof? The one in D/f/directory-locking.rst, that is. I'm not saying it's not a usable approach - it might very well work... BTW, one testcase worth profiling would be something like for i in `seq 100`; do cp -al linux.git linux.git-$i & done