diff options
author | NeilBrown <neilb@suse.de> | 2006-10-04 02:15:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 07:55:15 -0700 |
commit | 5680c44632053a6c9464bca43083f01776d318da (patch) | |
tree | 220f7bcb0168972bbc2ce804074f42b5470a1e15 /fs | |
parent | cda9e0cd8a6b30ccc32edced066c378fbd87003d (diff) |
[PATCH] knfsd: Fixed handling of lockd fail when adding nfsd socket
Arrgg.. We cannot 'lockd_up' before 'svc_addsock' as we don't know the
protocol yet.... So switch it around again and save the name of the created
sockets so that it can be closed if lock_up fails.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfsctl.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index f85472dda463..6c2ddfed2cfc 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); |