From: Ido Schimmel <idosch@idosch.org>
To: NeilBrown <neilb@suse.de>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
Chuck Lever <chuck.lever@oracle.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 13/20] lockd: move lockd_start_svc() call into lockd_create_svc()
Date: Sat, 3 Jun 2023 12:33:48 +0300 [thread overview]
Message-ID: <ZHsI/H16VX9kJQX1@shredder> (raw)
In-Reply-To: <168574130862.10905.10707785007987424080@noble.neil.brown.name>
On Sat, Jun 03, 2023 at 07:28:28AM +1000, NeilBrown wrote:
> From: NeilBrown <neilb@suse.de>
> Date: Sat, 3 Jun 2023 07:14:14 +1000
> Subject: [PATCH] lockd: drop inappropriate svc_get() from locked_get()
>
> The below-mentioned patch was intended to simplify refcounting on the
> svc_serv used by locked. The goal was to only ever have a single
> reference from the single thread. To that end we dropped a call to
> lockd_start_svc() (except when creating thread) which would take a
> reference, and dropped the svc_put(serv) that would drop that reference.
>
> Unfortunately we didn't also remove the svc_get() from
> lockd_create_svc() in the case where the svc_serv already existed.
> So after the patch:
> - on the first call the svc_serv was allocated and the one reference
> was given to the thread, so there are no extra references
> - on subsequent calls svc_get() was called so there is now an extra
> reference.
> This is clearly not consistent.
>
> The inconsistency is also clear in the current code in lockd_get()
> takes *two* references, one on nlmsvc_serv and one by incrementing
> nlmsvc_users. This clearly does not match lockd_put().
>
> So: drop that svc_get() from lockd_get() (which used to be in
> lockd_create_svc().
>
> Reported-by: Ido Schimmel <idosch@idosch.org>
> Fixes: b73a2972041b ("lockd: move lockd_start_svc() call into lockd_create_svc()")
> Signed-off-by: NeilBrown <neilb@suse.de>
Thanks for the quick fix. I no longer see the memory leak with this
patch.
Tested-by: Ido Schimmel <idosch@nvidia.com>
next prev parent reply other threads:[~2023-06-03 9:33 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 4:51 [PATCH 00/20 v3] SUNRPC: clean up server thread management NeilBrown
2021-11-29 4:51 ` [PATCH 06/20] SUNRPC: use sv_lock to protect updates to sv_nrthreads NeilBrown
2021-11-29 4:51 ` [PATCH 12/20] lockd: simplify management of network status notifiers NeilBrown
2021-11-29 4:51 ` [PATCH 01/20] NFSD: handle errors better in write_ports_addfd() NeilBrown
2021-11-29 4:51 ` [PATCH 19/20] lockd: use svc_set_num_threads() for thread start and stop NeilBrown
2021-11-29 4:51 ` [PATCH 10/20] NFSD: simplify locking for network notifier NeilBrown
2021-11-29 4:51 ` [PATCH 02/20] SUNRPC: change svc_get() to return the svc NeilBrown
2021-11-29 4:51 ` [PATCH 03/20] SUNRPC/NFSD: clean up get/put functions NeilBrown
2021-11-29 4:51 ` [PATCH 17/20] SUNRPC: move the pool_map definitions (back) into svc.c NeilBrown
2021-11-29 4:51 ` [PATCH 20/20] NFS: switch the callback service back to non-pooled NeilBrown
2021-11-29 4:51 ` [PATCH 16/20] lockd: rename lockd_create_svc() to lockd_get() NeilBrown
2021-11-29 4:51 ` [PATCH 13/20] lockd: move lockd_start_svc() call into lockd_create_svc() NeilBrown
2023-06-02 15:46 ` Ido Schimmel
2023-06-02 21:28 ` NeilBrown
2023-06-03 9:33 ` Ido Schimmel [this message]
2023-06-03 14:58 ` Chuck Lever III
2021-11-29 4:51 ` [PATCH 08/20] NFSD: Make it possible to use svc_set_num_threads_sync NeilBrown
2021-11-29 4:51 ` [PATCH 05/20] nfsd: make nfsd_stats.th_cnt atomic_t NeilBrown
2021-11-29 4:51 ` [PATCH 04/20] SUNRPC: stop using ->sv_nrthreads as a refcount NeilBrown
2021-11-29 4:51 ` [PATCH 15/20] lockd: introduce lockd_put() NeilBrown
2021-11-29 4:51 ` [PATCH 11/20] lockd: introduce nlmsvc_serv NeilBrown
2021-11-29 4:51 ` [PATCH 18/20] SUNRPC: always treat sv_nrpools==1 as "not pooled" NeilBrown
2021-11-29 4:51 ` [PATCH 09/20] SUNRPC: discard svo_setup and rename svc_set_num_threads_sync() NeilBrown
2021-11-29 4:51 ` [PATCH 07/20] NFSD: narrow nfsd_mutex protection in nfsd thread NeilBrown
2021-11-29 4:51 ` [PATCH 14/20] lockd: move svc_exit_thread() into the thread NeilBrown
2021-11-29 17:45 ` [PATCH 00/20 v3] SUNRPC: clean up server thread management Chuck Lever III
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=ZHsI/H16VX9kJQX1@shredder \
--to=idosch@idosch.org \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
/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