All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 13/14] lockd: rename lockd_create_svc() to lockd_get()
Date: Wed, 17 Nov 2021 11:46:50 +1100	[thread overview]
Message-ID: <163711001008.5485.232417261192262695.stgit@noble.brown> (raw)
In-Reply-To: <163710954700.5485.5622638225352156964.stgit@noble.brown>

lockd_create_svc() already does an svc_get() if the service already
exists, so it is more like a "get" than a "create".

So:
 - Move the increment of nlmsvc_users into the function as well
 - rename to lockd_get().

It is now the inverse of lockd_put().

Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/lockd/svc.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 7f12c280fd30..1a7c11118b32 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -396,16 +396,14 @@ static const struct svc_serv_ops lockd_sv_ops = {
 	.svo_enqueue_xprt	= svc_xprt_do_enqueue,
 };
 
-static int lockd_create_svc(void)
+static int lockd_get(void)
 {
 	struct svc_serv *serv;
 	int error;
 
-	/*
-	 * Check whether we're already up and running.
-	 */
 	if (nlmsvc_serv) {
 		svc_get(nlmsvc_serv);
+		nlmsvc_users++;
 		return 0;
 	}
 
@@ -439,6 +437,7 @@ static int lockd_create_svc(void)
 	register_inet6addr_notifier(&lockd_inet6addr_notifier);
 #endif
 	dprintk("lockd_up: service created\n");
+	nlmsvc_users++;
 	return 0;
 }
 
@@ -472,10 +471,9 @@ int lockd_up(struct net *net, const struct cred *cred)
 
 	mutex_lock(&nlmsvc_mutex);
 
-	error = lockd_create_svc();
+	error = lockd_get();
 	if (error)
 		goto err;
-	nlmsvc_users++;
 
 	error = lockd_up_net(nlmsvc_serv, net, cred);
 	if (error < 0) {



  parent reply	other threads:[~2021-11-17  0:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  0:46 [PATCH 00/14] SUNRPC: clean up server thread management NeilBrown
2021-11-17  0:46 ` [PATCH 03/14] NFSD: narrow nfsd_mutex protection in nfsd thread NeilBrown
2021-11-17  0:46 ` [PATCH 02/14] nfsd: make nfsd_stats.th_cnt atomic_t NeilBrown
2021-11-17  0:46 ` [PATCH 01/14] SUNRPC: stop using ->sv_nrthreads as a refcount NeilBrown
2021-11-17  0:46 ` [PATCH 14/14] lockd: use svc_set_num_threads() for thread start and stop NeilBrown
2021-11-17  0:46 ` [PATCH 10/14] lockd: move lockd_start_svc() call into lockd_create_svc() NeilBrown
2021-11-17  0:46 ` [PATCH 06/14] SUNRPC: discard svo_setup and rename svc_set_num_threads_sync() NeilBrown
2021-11-17  0:46 ` [PATCH 05/14] NFSD: Make it possible to use svc_set_num_threads_sync NeilBrown
2021-11-17  0:46 ` [PATCH 08/14] lockd: introduce nlmsvc_serv NeilBrown
2021-11-17  0:46 ` [PATCH 12/14] lockd: introduce lockd_put() NeilBrown
2021-11-17  0:46 ` [PATCH 09/14] lockd: simplify management of network status notifiers NeilBrown
2021-11-17  0:46 ` [PATCH 11/14] lockd: move svc_exit_thread() into the thread NeilBrown
2021-11-17  0:46 ` [PATCH 07/14] NFSD: simplify locking for network notifier NeilBrown
2021-11-17  0:46 ` [PATCH 04/14] SUNRPC: use sv_lock to protect updates to sv_nrthreads NeilBrown
2021-11-17  0:46 ` NeilBrown [this message]
2021-11-17 14:12 ` [PATCH 00/14] SUNRPC: clean up server thread management J. Bruce Fields
2021-11-19  3:24   ` NeilBrown
2021-11-21 23:50   ` NeilBrown
2021-11-22  0:56     ` J. Bruce Fields
2021-11-22  0:59       ` J. Bruce Fields
2021-11-22  1:13         ` NeilBrown
2021-11-22  2:37           ` J. Bruce Fields
2021-11-22  3:38             ` J. Bruce Fields
2021-11-22 15:18               ` J. Bruce Fields
2021-11-22 23:25                 ` NeilBrown
2021-11-17 17:12 ` Chuck Lever III
2021-11-19  3:19   ` 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=163711001008.5485.232417261192262695.stgit@noble.brown \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.