summaryrefslogtreecommitdiff
path: root/fs/nfsd/nfsctl.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-02 13:17:51 +0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 18:57:18 +0400
commit3dfb4210535303bb4c2e0ff1c4fdd4dfe9b93472 (patch)
treec4f9b8f7755dc44060af914ffc720fc196ef30c6 /fs/nfsd/nfsctl.c
parent6fb2b47fa16c81317ec282248e6cff521cca31c2 (diff)
downloadlinux-3dfb4210535303bb4c2e0ff1c4fdd4dfe9b93472.tar.xz
[PATCH] knfsd: Check return value of lockd_up in write_ports
We should be checking the return value of lockd_up when adding a new socket to nfsd. So move the lockd_up before the svc_addsock and check the return value. The move is because lockd_down is easy, but there is no easy way to remove a recently added socket. Cc: "J. Bruce Fields" <bfields@fieldses.org> 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/nfsd/nfsctl.c')
-rw-r--r--fs/nfsd/nfsctl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 80e97a5ffc3f..36e8e135d5a6 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -454,12 +454,15 @@ static ssize_t write_ports(struct file *file, char *buf, size_t size)
err = nfsd_create_serv();
if (!err) {
int proto = 0;
- err = svc_addsock(nfsd_serv, fd, buf, &proto);
+ err = lockd_up(proto);
+ if (!err) {
+ err = svc_addsock(nfsd_serv, fd, buf, &proto);
+ if (err)
+ lockd_down();
+ }
/* Decrease the count, but don't shutdown the
* the service
*/
- if (err >= 0)
- lockd_up(proto);
nfsd_serv->sv_nrthreads--;
}
return err;