Re: [PATCH 11/19] VFS: Add ability to exclusively lock a dentry and use for create/remove operations.

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

 



On Thu, Feb 06, 2025 at 04:42:48PM +1100, NeilBrown wrote:
> d_update_lock(), d_update_trylock(), d_update_unlock() are added which
> can be used to get an exclusive lock on a dentry in preparation for
> updating it.
> 
> As contention on a name is rare this is optimised for the uncontended
> case.  A bit is set under the d_lock spinlock to claim as lock, and
> wait_var_event_spinlock() is used when waiting is needed.  To avoid
> sending a wakeup when not needed we have a second bit flag to indicate
> if there are any waiters.
> 
> This locking is used in lookup_and_lock().
> 
> Once the exclusive "update" lock is obtained on the dentry we must make
> sure it wasn't unlinked or renamed while we slept.  If it was we repeat
> the lookup.
> 
> We also ensure that the parent isn't similarly locked.  This is will be
> used to protect a directory during rmdir.

What's the point re rmdir()?  Just have the victim _always_ locked exclusive,
same as e.g. for ->unlink() or overwriting ->rename().




[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