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.c76
1 files changed, 42 insertions, 34 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 5c01fc148ce8..e3591073098f 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1,46 +1,21 @@
1/* 1/*
2 * linux/fs/nfsd/nfsctl.c
3 *
4 * Syscall interface to knfsd. 2 * Syscall interface to knfsd.
5 * 3 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */ 5 */
8 6
9#include <linux/module.h>
10
11#include <linux/linkage.h>
12#include <linux/time.h>
13#include <linux/errno.h>
14#include <linux/fs.h>
15#include <linux/namei.h>
16#include <linux/fcntl.h>
17#include <linux/net.h>
18#include <linux/in.h>
19#include <linux/syscalls.h>
20#include <linux/unistd.h>
21#include <linux/slab.h> 7#include <linux/slab.h>
22#include <linux/proc_fs.h> 8#include <linux/namei.h>
23#include <linux/seq_file.h>
24#include <linux/pagemap.h>
25#include <linux/init.h>
26#include <linux/inet.h>
27#include <linux/string.h>
28#include <linux/ctype.h> 9#include <linux/ctype.h>
29 10
30#include <linux/nfs.h>
31#include <linux/nfsd_idmap.h> 11#include <linux/nfsd_idmap.h>
32#include <linux/lockd/bind.h>
33#include <linux/sunrpc/svc.h>
34#include <linux/sunrpc/svcsock.h> 12#include <linux/sunrpc/svcsock.h>
35#include <linux/nfsd/nfsd.h>
36#include <linux/nfsd/cache.h>
37#include <linux/nfsd/xdr.h>
38#include <linux/nfsd/syscall.h> 13#include <linux/nfsd/syscall.h>
39#include <linux/lockd/lockd.h> 14#include <linux/lockd/lockd.h>
40#include <linux/sunrpc/clnt.h> 15#include <linux/sunrpc/clnt.h>
41 16
42#include <asm/uaccess.h> 17#include "nfsd.h"
43#include <net/ipv6.h> 18#include "cache.h"
44 19
45/* 20/*
46 * We have a single directory with 9 nodes in it. 21 * We have a single directory with 9 nodes in it.
@@ -55,6 +30,7 @@ enum {
55 NFSD_Getfd, 30 NFSD_Getfd,
56 NFSD_Getfs, 31 NFSD_Getfs,
57 NFSD_List, 32 NFSD_List,
33 NFSD_Export_features,
58 NFSD_Fh, 34 NFSD_Fh,
59 NFSD_FO_UnlockIP, 35 NFSD_FO_UnlockIP,
60 NFSD_FO_UnlockFS, 36 NFSD_FO_UnlockFS,
@@ -173,6 +149,24 @@ static const struct file_operations exports_operations = {
173 .owner = THIS_MODULE, 149 .owner = THIS_MODULE,
174}; 150};
175 151
152static int export_features_show(struct seq_file *m, void *v)
153{
154 seq_printf(m, "0x%x 0x%x\n", NFSEXP_ALLFLAGS, NFSEXP_SECINFO_FLAGS);
155 return 0;
156}
157
158static int export_features_open(struct inode *inode, struct file *file)
159{
160 return single_open(file, export_features_show, NULL);
161}
162
163static struct file_operations export_features_operations = {
164 .open = export_features_open,
165 .read = seq_read,
166 .llseek = seq_lseek,
167 .release = single_release,
168};
169
176extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); 170extern int nfsd_pool_stats_open(struct inode *inode, struct file *file);
177extern int nfsd_pool_stats_release(struct inode *inode, struct file *file); 171extern int nfsd_pool_stats_release(struct inode *inode, struct file *file);
178 172
@@ -995,6 +989,7 @@ static ssize_t __write_ports_delfd(char *buf)
995static ssize_t __write_ports_addxprt(char *buf) 989static ssize_t __write_ports_addxprt(char *buf)
996{ 990{
997 char transport[16]; 991 char transport[16];
992 struct svc_xprt *xprt;
998 int port, err; 993 int port, err;
999 994
1000 if (sscanf(buf, "%15s %4u", transport, &port) != 2) 995 if (sscanf(buf, "%15s %4u", transport, &port) != 2)
@@ -1009,13 +1004,24 @@ static ssize_t __write_ports_addxprt(char *buf)
1009 1004
1010 err = svc_create_xprt(nfsd_serv, transport, 1005 err = svc_create_xprt(nfsd_serv, transport,
1011 PF_INET, port, SVC_SOCK_ANONYMOUS); 1006 PF_INET, port, SVC_SOCK_ANONYMOUS);
1012 if (err < 0) { 1007 if (err < 0)
1013 /* Give a reasonable perror msg for bad transport string */ 1008 goto out_err;
1014 if (err == -ENOENT) 1009
1015 err = -EPROTONOSUPPORT; 1010 err = svc_create_xprt(nfsd_serv, transport,
1016 return err; 1011 PF_INET6, port, SVC_SOCK_ANONYMOUS);
1017 } 1012 if (err < 0 && err != -EAFNOSUPPORT)
1013 goto out_close;
1018 return 0; 1014 return 0;
1015out_close:
1016 xprt = svc_find_xprt(nfsd_serv, transport, PF_INET, port);
1017 if (xprt != NULL) {
1018 svc_close_xprt(xprt);
1019 svc_xprt_put(xprt);
1020 }
1021out_err:
1022 /* Decrease the count, but don't shut down the service */
1023 nfsd_serv->sv_nrthreads--;
1024 return err;
1019} 1025}
1020 1026
1021/* 1027/*
@@ -1330,6 +1336,8 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent)
1330 [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, 1336 [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR},
1331 [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, 1337 [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR},
1332 [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, 1338 [NFSD_List] = {"exports", &exports_operations, S_IRUGO},
1339 [NFSD_Export_features] = {"export_features",
1340 &export_features_operations, S_IRUGO},
1333 [NFSD_FO_UnlockIP] = {"unlock_ip", 1341 [NFSD_FO_UnlockIP] = {"unlock_ip",
1334 &transaction_ops, S_IWUSR|S_IRUSR}, 1342 &transaction_ops, S_IWUSR|S_IRUSR},
1335 [NFSD_FO_UnlockFS] = {"unlock_filesystem", 1343 [NFSD_FO_UnlockFS] = {"unlock_filesystem",