diff options
-rw-r--r-- | fs/nfsd/nfsctl.c | 78 | ||||
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 3 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 51 |
3 files changed, 0 insertions, 132 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index e41a08ffbe0a..dab350dfc376 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -683,25 +683,6 @@ static ssize_t __write_ports_addfd(char *buf) | |||
683 | } | 683 | } |
684 | 684 | ||
685 | /* | 685 | /* |
686 | * A '-' followed by the 'name' of a socket means we close the socket. | ||
687 | */ | ||
688 | static ssize_t __write_ports_delfd(char *buf) | ||
689 | { | ||
690 | char *toclose; | ||
691 | int len = 0; | ||
692 | |||
693 | toclose = kstrdup(buf + 1, GFP_KERNEL); | ||
694 | if (toclose == NULL) | ||
695 | return -ENOMEM; | ||
696 | |||
697 | if (nfsd_serv != NULL) | ||
698 | len = svc_sock_names(nfsd_serv, buf, | ||
699 | SIMPLE_TRANSACTION_LIMIT, toclose); | ||
700 | kfree(toclose); | ||
701 | return len; | ||
702 | } | ||
703 | |||
704 | /* | ||
705 | * A transport listener is added by writing it's transport name and | 686 | * A transport listener is added by writing it's transport name and |
706 | * a port number. | 687 | * a port number. |
707 | */ | 688 | */ |
@@ -746,31 +727,6 @@ out_err: | |||
746 | return err; | 727 | return err; |
747 | } | 728 | } |
748 | 729 | ||
749 | /* | ||
750 | * A transport listener is removed by writing a "-", it's transport | ||
751 | * name, and it's port number. | ||
752 | */ | ||
753 | static ssize_t __write_ports_delxprt(char *buf) | ||
754 | { | ||
755 | struct svc_xprt *xprt; | ||
756 | char transport[16]; | ||
757 | int port; | ||
758 | |||
759 | if (sscanf(&buf[1], "%15s %4u", transport, &port) != 2) | ||
760 | return -EINVAL; | ||
761 | |||
762 | if (port < 1 || port > USHRT_MAX || nfsd_serv == NULL) | ||
763 | return -EINVAL; | ||
764 | |||
765 | xprt = svc_find_xprt(nfsd_serv, transport, &init_net, AF_UNSPEC, port); | ||
766 | if (xprt == NULL) | ||
767 | return -ENOTCONN; | ||
768 | |||
769 | svc_close_xprt(xprt); | ||
770 | svc_xprt_put(xprt); | ||
771 | return 0; | ||
772 | } | ||
773 | |||
774 | static ssize_t __write_ports(struct file *file, char *buf, size_t size) | 730 | static ssize_t __write_ports(struct file *file, char *buf, size_t size) |
775 | { | 731 | { |
776 | if (size == 0) | 732 | if (size == 0) |
@@ -779,15 +735,9 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) | |||
779 | if (isdigit(buf[0])) | 735 | if (isdigit(buf[0])) |
780 | return __write_ports_addfd(buf); | 736 | return __write_ports_addfd(buf); |
781 | 737 | ||
782 | if (buf[0] == '-' && isdigit(buf[1])) | ||
783 | return __write_ports_delfd(buf); | ||
784 | |||
785 | if (isalpha(buf[0])) | 738 | if (isalpha(buf[0])) |
786 | return __write_ports_addxprt(buf); | 739 | return __write_ports_addxprt(buf); |
787 | 740 | ||
788 | if (buf[0] == '-' && isalpha(buf[1])) | ||
789 | return __write_ports_delxprt(buf); | ||
790 | |||
791 | return -EINVAL; | 741 | return -EINVAL; |
792 | } | 742 | } |
793 | 743 | ||
@@ -825,21 +775,6 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) | |||
825 | * OR | 775 | * OR |
826 | * | 776 | * |
827 | * Input: | 777 | * Input: |
828 | * buf: C string containing a "-" followed | ||
829 | * by an integer value representing a | ||
830 | * previously passed in socket file | ||
831 | * descriptor | ||
832 | * size: non-zero length of C string in @buf | ||
833 | * Output: | ||
834 | * On success: NFS service no longer listens on that socket; | ||
835 | * passed-in buffer filled with a '\n'-terminated C | ||
836 | * string containing a unique name of the listener; | ||
837 | * return code is the size in bytes of the string | ||
838 | * On error: return code is a negative errno value | ||
839 | * | ||
840 | * OR | ||
841 | * | ||
842 | * Input: | ||
843 | * buf: C string containing a transport | 778 | * buf: C string containing a transport |
844 | * name and an unsigned integer value | 779 | * name and an unsigned integer value |
845 | * representing the port to listen on, | 780 | * representing the port to listen on, |
@@ -848,19 +783,6 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size) | |||
848 | * Output: | 783 | * Output: |
849 | * On success: returns zero; NFS service is started | 784 | * On success: returns zero; NFS service is started |
850 | * On error: return code is a negative errno value | 785 | * On error: return code is a negative errno value |
851 | * | ||
852 | * OR | ||
853 | * | ||
854 | * Input: | ||
855 | * buf: C string containing a "-" followed | ||
856 | * by a transport name and an unsigned | ||
857 | * integer value representing the port | ||
858 | * to listen on, separated by whitespace | ||
859 | * size: non-zero length of C string in @buf | ||
860 | * Output: | ||
861 | * On success: returns zero; NFS service no longer listens | ||
862 | * on that transport | ||
863 | * On error: return code is a negative errno value | ||
864 | */ | 786 | */ |
865 | static ssize_t write_ports(struct file *file, char *buf, size_t size) | 787 | static ssize_t write_ports(struct file *file, char *buf, size_t size) |
866 | { | 788 | { |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index cb4ac69e1f33..92ad02f0dcc0 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -39,9 +39,6 @@ int svc_recv(struct svc_rqst *, long); | |||
39 | int svc_send(struct svc_rqst *); | 39 | int svc_send(struct svc_rqst *); |
40 | void svc_drop(struct svc_rqst *); | 40 | void svc_drop(struct svc_rqst *); |
41 | void svc_sock_update_bufs(struct svc_serv *serv); | 41 | void svc_sock_update_bufs(struct svc_serv *serv); |
42 | int svc_sock_names(struct svc_serv *serv, char *buf, | ||
43 | const size_t buflen, | ||
44 | const char *toclose); | ||
45 | int svc_addsock(struct svc_serv *serv, const int fd, | 42 | int svc_addsock(struct svc_serv *serv, const int fd, |
46 | char *name_return, const size_t len); | 43 | char *name_return, const size_t len); |
47 | void svc_init_xprt_sock(void); | 44 | void svc_init_xprt_sock(void); |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 7aee54c3fe46..03827cef1fa7 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -305,57 +305,6 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) | |||
305 | return len; | 305 | return len; |
306 | } | 306 | } |
307 | 307 | ||
308 | /** | ||
309 | * svc_sock_names - construct a list of listener names in a string | ||
310 | * @serv: pointer to RPC service | ||
311 | * @buf: pointer to a buffer to fill in with socket names | ||
312 | * @buflen: size of the buffer to be filled | ||
313 | * @toclose: pointer to '\0'-terminated C string containing the name | ||
314 | * of a listener to be closed | ||
315 | * | ||
316 | * Fills in @buf with a '\n'-separated list of names of listener | ||
317 | * sockets. If @toclose is not NULL, the socket named by @toclose | ||
318 | * is closed, and is not included in the output list. | ||
319 | * | ||
320 | * Returns positive length of the socket name string, or a negative | ||
321 | * errno value on error. | ||
322 | */ | ||
323 | int svc_sock_names(struct svc_serv *serv, char *buf, const size_t buflen, | ||
324 | const char *toclose) | ||
325 | { | ||
326 | struct svc_sock *svsk, *closesk = NULL; | ||
327 | int len = 0; | ||
328 | |||
329 | if (!serv) | ||
330 | return 0; | ||
331 | |||
332 | spin_lock_bh(&serv->sv_lock); | ||
333 | list_for_each_entry(svsk, &serv->sv_permsocks, sk_xprt.xpt_list) { | ||
334 | int onelen = svc_one_sock_name(svsk, buf + len, buflen - len); | ||
335 | if (onelen < 0) { | ||
336 | len = onelen; | ||
337 | break; | ||
338 | } | ||
339 | if (toclose && strcmp(toclose, buf + len) == 0) { | ||
340 | closesk = svsk; | ||
341 | svc_xprt_get(&closesk->sk_xprt); | ||
342 | } else | ||
343 | len += onelen; | ||
344 | } | ||
345 | spin_unlock_bh(&serv->sv_lock); | ||
346 | |||
347 | if (closesk) { | ||
348 | /* Should unregister with portmap, but you cannot | ||
349 | * unregister just one protocol... | ||
350 | */ | ||
351 | svc_close_xprt(&closesk->sk_xprt); | ||
352 | svc_xprt_put(&closesk->sk_xprt); | ||
353 | } else if (toclose) | ||
354 | return -ENOENT; | ||
355 | return len; | ||
356 | } | ||
357 | EXPORT_SYMBOL_GPL(svc_sock_names); | ||
358 | |||
359 | /* | 308 | /* |
360 | * Check input queue length | 309 | * Check input queue length |
361 | */ | 310 | */ |