[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231103193701.GP1957730@ZenIV>
Date: Fri, 3 Nov 2023 19:37:01 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Vegard Nossum <vegard.nossum@...cle.com>
Cc: Christian Brauner <brauner@...nel.org>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Nick Piggin <npiggin@...nel.dk>,
Waiman Long <Waiman.Long@...com>, linux-doc@...r.kernel.org
Subject: Re: [PATCH] dcache: remove unnecessary NULL check in dget_dlock()
On Sun, Oct 22, 2023 at 06:45:20PM +0200, Vegard Nossum wrote:
> @@ -1707,7 +1701,7 @@ static enum d_walk_ret find_submount(void *_data, struct dentry *dentry)
> {
> struct dentry **victim = _data;
> if (d_mountpoint(dentry)) {
> - __dget_dlock(dentry);
> + dget_dlock(dentry);
> *victim = dentry;
*victim = dget_dlock(dentry);
> return D_WALK_QUIT;
> }
> @@ -1853,7 +1847,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
> * don't need child lock because it is not subject
> * to concurrency here
> */
> - __dget_dlock(parent);
> + dget_dlock(parent);
> dentry->d_parent = parent;
dentry->d_parent = dget_dlock(parent);
> - * Given a dentry or %NULL pointer increment the reference count
> - * if appropriate and return the dentry. A dentry will not be
> - * destroyed when it has references.
> + * Given a dentry, increment the reference count and return the
> + * dentry.
> + *
> + * Context: @dentry->d_lock must be held.
... and dentry must be alive. There are many ways the caller could
use to guarantee that - any of the "it's hashed", "it's positive",
"its ->d_lockref.count is not negative" would suffice under ->d_lock.
Powered by blists - more mailing lists