summaryrefslogtreecommitdiff
path: root/fs/lockd
diff options
context:
space:
mode:
authorStanislav Kinsbursky <skinsbursky@parallels.com>2012-05-04 12:49:41 +0400
committerJ. Bruce Fields <bfields@redhat.com>2012-05-31 20:29:40 -0400
commit786185b5f8abefa6a8a16695bb4a59c164d5a071 (patch)
tree780eafd98f98a093fda540898595b47b4261764c /fs/lockd
parent9793f7c88937e7ac07305ab1af1a519225836823 (diff)
downloadlinux-3.10-786185b5f8abefa6a8a16695bb4a59c164d5a071.tar.gz
linux-3.10-786185b5f8abefa6a8a16695bb4a59c164d5a071.tar.bz2
linux-3.10-786185b5f8abefa6a8a16695bb4a59c164d5a071.zip
SUNRPC: move per-net operations from svc_destroy()
The idea is to separate service destruction and per-net operations, because these are two different things and the mix looks ugly. Notes: 1) For NFS server this patch looks ugly (sorry for that). But these place will be rewritten soon during NFSd containerization. 2) LockD per-net counter increase int lockd_up() was moved prior to make_socks() to make lockd_down_net() call safe in case of error. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/svc.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index b7e92ed5688..3250f280a17 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -257,7 +257,7 @@ static int lockd_up_net(struct net *net)
struct svc_serv *serv = nlmsvc_rqst->rq_server;
int error;
- if (ln->nlmsvc_users)
+ if (ln->nlmsvc_users++)
return 0;
error = svc_rpcb_setup(serv, net);
@@ -272,6 +272,7 @@ static int lockd_up_net(struct net *net)
err_socks:
svc_rpcb_cleanup(serv, net);
err_rpcb:
+ ln->nlmsvc_users--;
return error;
}
@@ -299,6 +300,7 @@ int lockd_up(struct net *net)
{
struct svc_serv *serv;
int error = 0;
+ struct lockd_net *ln = net_generic(net, lockd_net_id);
mutex_lock(&nlmsvc_mutex);
/*
@@ -330,9 +332,11 @@ int lockd_up(struct net *net)
goto destroy_and_out;
}
+ ln->nlmsvc_users++;
+
error = make_socks(serv, net);
if (error < 0)
- goto destroy_and_out;
+ goto err_start;
/*
* Create the kernel thread and wait for it to start.
@@ -344,7 +348,7 @@ int lockd_up(struct net *net)
printk(KERN_WARNING
"lockd_up: svc_rqst allocation failed, error=%d\n",
error);
- goto destroy_and_out;
+ goto err_start;
}
svc_sock_update_bufs(serv);
@@ -358,7 +362,7 @@ int lockd_up(struct net *net)
nlmsvc_rqst = NULL;
printk(KERN_WARNING
"lockd_up: kthread_run failed, error=%d\n", error);
- goto destroy_and_out;
+ goto err_start;
}
/*
@@ -368,14 +372,14 @@ int lockd_up(struct net *net)
destroy_and_out:
svc_destroy(serv);
out:
- if (!error) {
- struct lockd_net *ln = net_generic(net, lockd_net_id);
-
- ln->nlmsvc_users++;
+ if (!error)
nlmsvc_users++;
- }
mutex_unlock(&nlmsvc_mutex);
return error;
+
+err_start:
+ lockd_down_net(net);
+ goto destroy_and_out;
}
EXPORT_SYMBOL_GPL(lockd_up);
@@ -386,11 +390,10 @@ void
lockd_down(struct net *net)
{
mutex_lock(&nlmsvc_mutex);
+ lockd_down_net(net);
if (nlmsvc_users) {
- if (--nlmsvc_users) {
- lockd_down_net(net);
+ if (--nlmsvc_users)
goto out;
- }
} else {
printk(KERN_ERR "lockd_down: no users! task=%p\n",
nlmsvc_task);