diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-04-23 19:32:18 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-28 13:54:28 -0400 |
commit | ea068bad27cefc71ab03230dbf01a8f8d98da5ba (patch) | |
tree | e36b3c23598de4233ffae06fa556504082bd20eb | |
parent | 0a5372d8a13c3f670bf7c9c4a68ab04c3664fa28 (diff) |
NFSD: move lockd_up() before svc_addsock()
Clean up.
A couple of years ago, a series of commits, finishing with commit
5680c446, swapped the order of the lockd_up() and svc_addsock() calls
in __write_ports(). At that time lockd_up() needed to know the
transport protocol of the passed-in socket to start a listener on the
same transport protocol.
These days, lockd_up() doesn't take a protocol argument; it always
starts both a UDP and TCP listener. It's now more straightforward to
try the lockd_up() first, then do a lockd_down() if the svc_addsock()
fails.
Careful review of this code shows that the svc_sock_names() call is
used only to close the just-opened socket in case lockd_up() fails.
So it is no longer needed if lockd_up() is done first.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r-- | fs/nfsd/nfsctl.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index caf4fdc674c0..e051847b93fb 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -939,17 +939,18 @@ static ssize_t __write_ports_addfd(char *buf) | |||
939 | if (err != 0) | 939 | if (err != 0) |
940 | return err; | 940 | return err; |
941 | 941 | ||
942 | err = svc_addsock(nfsd_serv, fd, buf); | 942 | err = lockd_up(); |
943 | if (err >= 0) { | 943 | if (err != 0) |
944 | err = lockd_up(); | 944 | goto out; |
945 | if (err < 0) | ||
946 | svc_sock_names(buf + strlen(buf) + 1, nfsd_serv, buf); | ||
947 | 945 | ||
948 | /* Decrease the count, but don't shut down the service */ | 946 | err = svc_addsock(nfsd_serv, fd, buf); |
949 | nfsd_serv->sv_nrthreads--; | 947 | if (err < 0) |
950 | } | 948 | lockd_down(); |
951 | 949 | ||
952 | return err < 0 ? err : 0; | 950 | out: |
951 | /* Decrease the count, but don't shut down the service */ | ||
952 | nfsd_serv->sv_nrthreads--; | ||
953 | return err; | ||
953 | } | 954 | } |
954 | 955 | ||
955 | /* | 956 | /* |