From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: NeilBrown <neilb@suse.de>, Chuck Lever <chuck.lever@oracle.com>,
linux-nfs@vger.kernel.org, Olga Kornievskaia <kolga@netapp.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Subject: Re: [PATCH 3/5] nfsd: hold nfsd_mutex across entire netlink operation
Date: Mon, 30 Oct 2023 14:27:46 +0100 [thread overview]
Message-ID: <ZT+vUmtUVNMEzUwC@lore-desk> (raw)
In-Reply-To: <07df60cee15b8c206365613364d4979330c31407.camel@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]
> On Mon, 2023-10-30 at 12:08 +1100, NeilBrown wrote:
> > Rather than using svc_get() and svc_put() to hold a stable reference to
> > the nfsd_svc for netlink lookups, simply hold the mutex for the entire
> > time.
> >
> > The "entire" time isn't very long, and the mutex is not often contented.
> >
> > This makes way for use to remove the refcounts of svc, which is more
> > confusing than useful.
> >
> > Signed-off-by: NeilBrown <neilb@suse.de>
> > ---
> > fs/nfsd/nfsctl.c | 9 +++------
> > 1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> > index d78ae4452946..8f644f1d157c 100644
> > --- a/fs/nfsd/nfsctl.c
> > +++ b/fs/nfsd/nfsctl.c
> > @@ -1515,11 +1515,10 @@ int nfsd_nl_rpc_status_get_start(struct netlink_callback *cb)
> > int ret = -ENODEV;
> >
> > mutex_lock(&nfsd_mutex);
> > - if (nn->nfsd_serv) {
> > - svc_get(nn->nfsd_serv);
> > + if (nn->nfsd_serv)
> > ret = 0;
> > - }
> > - mutex_unlock(&nfsd_mutex);
> > + else
> > + mutex_unlock(&nfsd_mutex);
> >
> > return ret;
> > }
> > @@ -1691,8 +1690,6 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
> > */
> > int nfsd_nl_rpc_status_get_done(struct netlink_callback *cb)
> > {
> > - mutex_lock(&nfsd_mutex);
> > - nfsd_put(sock_net(cb->skb->sk));
> > mutex_unlock(&nfsd_mutex);
> >
> > return 0;
>
> (cc'ing Lorenzo since he wrote this)
>
> I think Lorenzo did it this way originally, and I convinced him to take
> a reference instead. This should be fine though.
yep, the idea was to avoid grabbing the mutex and dump the refcount instead but
I think it is fine.
Regards,
Lorenzo
>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-10-30 13:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 1:08 [PATCH 0/5] sunrpc: not refcounting svc_serv NeilBrown
2023-10-30 1:08 ` [PATCH 1/5] nfsd: call nfsd_last_thread() before final nfsd_put() NeilBrown
2023-10-30 13:15 ` Jeff Layton
2023-10-30 15:52 ` Chuck Lever
2023-10-30 16:41 ` Jeff Layton
2023-10-30 1:08 ` [PATCH 2/5] svc: don't hold reference for poolstats, only mutex NeilBrown
2023-10-30 13:01 ` Jeff Layton
2023-10-30 21:48 ` NeilBrown
2023-10-31 13:08 ` Jeff Layton
2023-10-30 1:08 ` [PATCH 3/5] nfsd: hold nfsd_mutex across entire netlink operation NeilBrown
2023-10-30 13:03 ` Jeff Layton
2023-10-30 13:27 ` Lorenzo Bianconi [this message]
2023-10-30 1:08 ` [PATCH 4/5] SUNRPC: discard sv_refcnt, and svc_get/svc_put NeilBrown
2023-10-30 13:15 ` Jeff Layton
2023-10-30 1:08 ` [PATCH 5/5] nfsd: rename nfsd_last_thread() to nfsd_destroy_serv() NeilBrown
2023-10-30 13:15 ` Jeff Layton
2023-10-31 15:39 ` [PATCH 0/5] sunrpc: not refcounting svc_serv Chuck Lever III
2023-10-31 20:40 ` NeilBrown
2023-10-31 20:42 ` Chuck Lever III
2023-10-31 20:46 ` NeilBrown
2023-10-31 20:50 ` Chuck Lever III
-- strict thread matches above, loose matches on Subject: below --
2023-12-15 0:56 [PATCH 0/5 v2] sunrpc: stop " NeilBrown
2023-12-15 0:56 ` [PATCH 3/5] nfsd: hold nfsd_mutex across entire netlink operation NeilBrown
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=ZT+vUmtUVNMEzUwC@lore-desk \
--to=lorenzo@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=jlayton@kernel.org \
--cc=kolga@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tom@talpey.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