Re: [PATCH v2] vfs: fix link vs. rename race

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux