[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <173493787613.11072.4293875424077013617@noble.neil.brown.name>
Date: Mon, 23 Dec 2024 18:11:16 +1100
From: "NeilBrown" <neilb@...e.de>
To: "Al Viro" <viro@...iv.linux.org.uk>
Cc: "Christian Brauner" <brauner@...nel.org>, "Jan Kara" <jack@...e.cz>,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/11] VFS: take a shared lock for create/remove directory
operations.
On Mon, 23 Dec 2024, Al Viro wrote:
> On Fri, Dec 20, 2024 at 01:54:28PM +1100, NeilBrown wrote:
>
> > 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.
>
> > + if (
> > + /* Was unlinked while we waited ?*/
> > + d_unhashed(dentry) ||
> > + /* Or was dentry renamed ?? */
> > + dentry->d_parent != base ||
> > + dentry->d_name.hash != last->hash ||
> > + !d_same_name(dentry, base, last)
> > + ) {
> > + rcu_read_unlock();
> > + spin_unlock(&dentry->d_lock);
> > + lock_map_release(&dentry->d_update_map);
> > + dput(dentry);
> > + goto retry;
> > + }
> > + rcu_read_unlock();
> > + }
> > + dentry->d_flags |= DCACHE_PAR_UPDATE;
> > + spin_unlock(&dentry->d_lock);
>
> ... and now __d_unalias() moves it to new place, making all the checks
> you've just done completely useless.
>
... Yes, thanks.
So I need __d_unalias() to effectively do a "try_lock" of
DCACHE_PAR_UPDATE and hold the lock across __d_move().
I think that would address the concerned you raised.
Did you see anything else that might be problematic?
Thanks,
NeilBrown
Powered by blists - more mailing lists