[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250212212228.GS1977892@ZenIV>
Date: Wed, 12 Feb 2025 21:22:28 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: NeilBrown <neilb@...e.de>
Cc: Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jeff Layton <jlayton@...nel.org>,
Dave Chinner <david@...morbit.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 13/19] VFS: lock dentry for ->revalidate to avoid races
with rename etc
On Sat, Feb 08, 2025 at 01:30:43AM +0000, Al Viro wrote:
> HOWEVER, if you do not bother with doing that before ->d_unalias_trylock()
> (and there's no reason to do that), the whole thing becomes much simpler -
> you can do the check inside __d_move(), after all locks had been taken.
>
> After
> spin_lock_nested(&dentry->d_lock, 2);
> spin_lock_nested(&target->d_lock, 3);
> you have everything stable. Just make the sucker return bool instead
> of void, check that crap and have it return false if there's a problem.
... except that this requires telling __d_move() that it's an unalias -
on normal move dentries will have been locked by the caller. Might
make sense to turn that bool exchange argument into an enum...
Let me play with that a bit and see what falls out...
Powered by blists - more mailing lists