Skip to content

Commit

Permalink
[PATCH] knfsd: call lockd_down when closing a socket via a write to n…
Browse files Browse the repository at this point in the history
…fsd/portlist

The refcount that nfsd holds on lockd is based on the number of open sockets.
So when we close a socket, we should decrement the ref (with lockd_down).

Currently when a socket is closed via writing to the portlist file, that
doesn't happen.

So: make sure we get an error return if the socket that was requested does is
not found, and call lockd_down if it was.

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 4, 2006
1 parent 7ed9429 commit 37a0347
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,8 @@ static ssize_t write_ports(struct file *file, char *buf, size_t size)
if (nfsd_serv)
len = svc_sock_names(buf, nfsd_serv, toclose);
unlock_kernel();
if (len >= 0)
lockd_down();
kfree(toclose);
return len;
}
Expand Down
2 changes: 2 additions & 0 deletions net/sunrpc/svcsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ svc_sock_names(char *buf, struct svc_serv *serv, char *toclose)
spin_unlock(&serv->sv_lock);
if (closesk)
svc_delete_socket(closesk);
else if (toclose)
return -ENOENT;
return len;
}
EXPORT_SYMBOL(svc_sock_names);
Expand Down

0 comments on commit 37a0347

Please sign in to comment.