aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r--fs/nfsd/nfsctl.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 748532b93fd9..fa268d1b775f 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -911,6 +911,27 @@ static ssize_t write_versions(struct file *file, char *buf, size_t size)
911} 911}
912 912
913/* 913/*
914 * A '-' followed by the 'name' of a socket means we close the socket.
915 */
916static ssize_t __write_ports_delfd(char *buf)
917{
918 char *toclose;
919 int len = 0;
920
921 toclose = kstrdup(buf + 1, GFP_KERNEL);
922 if (toclose == NULL)
923 return -ENOMEM;
924
925 if (nfsd_serv != NULL)
926 len = svc_sock_names(buf, nfsd_serv, toclose);
927 if (len >= 0)
928 lockd_down();
929
930 kfree(toclose);
931 return len;
932}
933
934/*
914 * A transport listener is added by writing it's transport name and 935 * A transport listener is added by writing it's transport name and
915 * a port number. 936 * a port number.
916 */ 937 */
@@ -1004,18 +1025,9 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size)
1004 } 1025 }
1005 return err < 0 ? err : 0; 1026 return err < 0 ? err : 0;
1006 } 1027 }
1007 if (buf[0] == '-' && isdigit(buf[1])) { 1028
1008 char *toclose = kstrdup(buf+1, GFP_KERNEL); 1029 if (buf[0] == '-' && isdigit(buf[1]))
1009 int len = 0; 1030 return __write_ports_delfd(buf);
1010 if (!toclose)
1011 return -ENOMEM;
1012 if (nfsd_serv)
1013 len = svc_sock_names(buf, nfsd_serv, toclose);
1014 if (len >= 0)
1015 lockd_down();
1016 kfree(toclose);
1017 return len;
1018 }
1019 1031
1020 if (isalpha(buf[0])) 1032 if (isalpha(buf[0]))
1021 return __write_ports_addxprt(buf); 1033 return __write_ports_addxprt(buf);