Commit ecd3ad68 authored by NeilBrown's avatar NeilBrown Committed by Chuck Lever

lockd: rename lockd_create_svc() to lockd_get()

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: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 865b6740
...@@ -396,16 +396,14 @@ static const struct svc_serv_ops lockd_sv_ops = { ...@@ -396,16 +396,14 @@ static const struct svc_serv_ops lockd_sv_ops = {
.svo_enqueue_xprt = svc_xprt_do_enqueue, .svo_enqueue_xprt = svc_xprt_do_enqueue,
}; };
static int lockd_create_svc(void) static int lockd_get(void)
{ {
struct svc_serv *serv; struct svc_serv *serv;
int error; int error;
/*
* Check whether we're already up and running.
*/
if (nlmsvc_serv) { if (nlmsvc_serv) {
svc_get(nlmsvc_serv); svc_get(nlmsvc_serv);
nlmsvc_users++;
return 0; return 0;
} }
...@@ -439,6 +437,7 @@ static int lockd_create_svc(void) ...@@ -439,6 +437,7 @@ static int lockd_create_svc(void)
register_inet6addr_notifier(&lockd_inet6addr_notifier); register_inet6addr_notifier(&lockd_inet6addr_notifier);
#endif #endif
dprintk("lockd_up: service created\n"); dprintk("lockd_up: service created\n");
nlmsvc_users++;
return 0; return 0;
} }
...@@ -472,10 +471,9 @@ int lockd_up(struct net *net, const struct cred *cred) ...@@ -472,10 +471,9 @@ int lockd_up(struct net *net, const struct cred *cred)
mutex_lock(&nlmsvc_mutex); mutex_lock(&nlmsvc_mutex);
error = lockd_create_svc(); error = lockd_get();
if (error) if (error)
goto err; goto err;
nlmsvc_users++;
error = lockd_up_net(nlmsvc_serv, net, cred); error = lockd_up_net(nlmsvc_serv, net, cred);
if (error < 0) { if (error < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment