aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfsctl.c12
-rw-r--r--net/sunrpc/svcsock.c3
2 files changed, 9 insertions, 6 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index f85472dda46..6c2ddfed2cf 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -523,11 +523,11 @@ static ssize_t write_ports(struct file *file, char *buf, size_t size)
err = nfsd_create_serv();
if (!err) {
int proto = 0;
- err = lockd_up(proto);
- if (!err) {
- err = svc_addsock(nfsd_serv, fd, buf, &proto);
- if (err)
- lockd_down();
+ err = svc_addsock(nfsd_serv, fd, buf, &proto);
+ if (err >= 0) {
+ err = lockd_up(proto);
+ if (err < 0)
+ svc_sock_names(buf+strlen(buf)+1, nfsd_serv, buf);
}
/* Decrease the count, but don't shutdown the
* the service
@@ -536,7 +536,7 @@ static ssize_t write_ports(struct file *file, char *buf, size_t size)
nfsd_serv->sv_nrthreads--;
unlock_kernel();
}
- return err;
+ return err < 0 ? err : 0;
}
if (buf[0] == '-') {
char *toclose = kstrdup(buf+1, GFP_KERNEL);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 4e0813b12cc..4de8626e4f5 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -492,6 +492,9 @@ svc_sock_names(char *buf, struct svc_serv *serv, char *toclose)
}
spin_unlock(&serv->sv_lock);
if (closesk)
+ /* Should unregister with portmap, but you cannot
+ * unregister just one protocol...
+ */
svc_delete_socket(closesk);
else if (toclose)
return -ENOENT;