Re: [PATCH 02/11] VFS: add _shared versions of the various directory modifying inode_operations

From: Al Viro
Date: Mon Dec 23 2024 - 00:08:51 EST


On Fri, Dec 20, 2024 at 01:54:20PM +1100, NeilBrown wrote:

> i_rwsem *may* be held exclusively or *may* be held shared, in which case
> an exclusive lock will be held on the dentry - provided by a later
> patch.
>
> This will allow a graceful transition from exclusive to shared locking
> for directory updates.

> +A "mixed" lock means that either that i_rwsem on the directory is held
> +exclusively, or it is held as a shared lock, and an exclusive lock is held
> +on the dentry in that directory.

... it also means that ->d_parent and ->d_name are completely unstable.
Yes, really - have rmdir victim moved around on server, then look it up
in a new place and you'll get __d_unalias() move the existing dentry
to new location right under you.