[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240205-finessenreich-mieten-bcbd5bb2e6cb@brauner>
Date: Mon, 5 Feb 2024 13:29:18 +0100
From: Christian Brauner <brauner@...nel.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>, linux-ext4@...r.kernel.org, linux-nfs@...r.kernel.org,
Miklos Szeredi <miklos@...redi.hu>, linux-cifs@...r.kernel.org
Subject: Re: [PATCH 07/13] nfs: make nfs_set_verifier() safe for use in RCU
pathwalk
On Sun, Feb 04, 2024 at 02:17:33AM +0000, Al Viro wrote:
> nfs_set_verifier() relies upon dentry being pinned; if that's
> the case, grabbing ->d_lock stabilizes ->d_parent and guarantees
> that ->d_parent points to a positive dentry. For something
> we'd run into in RCU mode that is *not* true - dentry might've
> been through dentry_kill() just as we grabbed ->d_lock, with
> its parent going through the same just as we get to into
> nfs_set_verifier_locked(). It might get to detaching inode
> (and zeroing ->d_inode) before nfs_set_verifier_locked() gets
> to fetching that; we get an oops as the result.
>
> That can happen in nfs{,4} ->d_revalidate(); the call chain in
> question is nfs_set_verifier_locked() <- nfs_set_verifier() <-
> nfs_lookup_revalidate_delegated() <- nfs{,4}_do_lookup_revalidate().
> We have checked that the parent had been positive, but that's
> done before we get to nfs_set_verifier() and it's possible for
> memory pressure to pick our dentry as eviction candidate by that
> time. If that happens, back-to-back attempts to kill dentry and
> its parent are quite normal. Sure, in case of eviction we'll
> fail the ->d_seq check in the caller, but we need to survive
> until we return there...
>
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
Acked-by: Christian Brauner <brauner@...nel.org>
Powered by blists - more mailing lists