Skip to content

Commit

Permalink
[PATCH] knfsd: Check return value of lockd_up in write_ports
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Oct 2, 2006
1 parent 6fb2b47 commit 3dfb421
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3dfb421

Please sign in to comment.