From: Al Viro <viro@zeniv.linux.org.uk>
To: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Christian Brauner <brauner@kernel.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Nick Piggin <npiggin@kernel.dk>, Waiman Long <Waiman.Long@hp.com>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH] dcache: remove unnecessary NULL check in dget_dlock()
Date: Fri, 3 Nov 2023 19:37:01 +0000 [thread overview]
Message-ID: <20231103193701.GP1957730@ZenIV> (raw)
In-Reply-To: <20231022164520.915013-1-vegard.nossum@oracle.com>
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.
prev parent reply other threads:[~2023-11-03 19:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-22 16:45 [PATCH] dcache: remove unnecessary NULL check in dget_dlock() Vegard Nossum
2023-11-03 19:37 ` Al Viro [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231103193701.GP1957730@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=Waiman.Long@hp.com \
--cc=brauner@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@kernel.dk \
--cc=vegard.nossum@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).