diff options
Diffstat (limited to 'fs/nfsd/nfsctl.c')
-rw-r--r-- | fs/nfsd/nfsctl.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 06fa87e52e82..d6dc3f61f8ba 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | enum { | 23 | enum { |
24 | NFSD_Root = 1, | 24 | NFSD_Root = 1, |
25 | #ifdef CONFIG_NFSD_DEPRECATED | ||
25 | NFSD_Svc, | 26 | NFSD_Svc, |
26 | NFSD_Add, | 27 | NFSD_Add, |
27 | NFSD_Del, | 28 | NFSD_Del, |
@@ -29,6 +30,7 @@ enum { | |||
29 | NFSD_Unexport, | 30 | NFSD_Unexport, |
30 | NFSD_Getfd, | 31 | NFSD_Getfd, |
31 | NFSD_Getfs, | 32 | NFSD_Getfs, |
33 | #endif | ||
32 | NFSD_List, | 34 | NFSD_List, |
33 | NFSD_Export_features, | 35 | NFSD_Export_features, |
34 | NFSD_Fh, | 36 | NFSD_Fh, |
@@ -54,6 +56,7 @@ enum { | |||
54 | /* | 56 | /* |
55 | * write() for these nodes. | 57 | * write() for these nodes. |
56 | */ | 58 | */ |
59 | #ifdef CONFIG_NFSD_DEPRECATED | ||
57 | static ssize_t write_svc(struct file *file, char *buf, size_t size); | 60 | static ssize_t write_svc(struct file *file, char *buf, size_t size); |
58 | static ssize_t write_add(struct file *file, char *buf, size_t size); | 61 | static ssize_t write_add(struct file *file, char *buf, size_t size); |
59 | static ssize_t write_del(struct file *file, char *buf, size_t size); | 62 | static ssize_t write_del(struct file *file, char *buf, size_t size); |
@@ -61,6 +64,7 @@ static ssize_t write_export(struct file *file, char *buf, size_t size); | |||
61 | static ssize_t write_unexport(struct file *file, char *buf, size_t size); | 64 | static ssize_t write_unexport(struct file *file, char *buf, size_t size); |
62 | static ssize_t write_getfd(struct file *file, char *buf, size_t size); | 65 | static ssize_t write_getfd(struct file *file, char *buf, size_t size); |
63 | static ssize_t write_getfs(struct file *file, char *buf, size_t size); | 66 | static ssize_t write_getfs(struct file *file, char *buf, size_t size); |
67 | #endif | ||
64 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size); | 68 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size); |
65 | static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size); | 69 | static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size); |
66 | static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size); | 70 | static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size); |
@@ -76,6 +80,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); | |||
76 | #endif | 80 | #endif |
77 | 81 | ||
78 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { | 82 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { |
83 | #ifdef CONFIG_NFSD_DEPRECATED | ||
79 | [NFSD_Svc] = write_svc, | 84 | [NFSD_Svc] = write_svc, |
80 | [NFSD_Add] = write_add, | 85 | [NFSD_Add] = write_add, |
81 | [NFSD_Del] = write_del, | 86 | [NFSD_Del] = write_del, |
@@ -83,6 +88,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
83 | [NFSD_Unexport] = write_unexport, | 88 | [NFSD_Unexport] = write_unexport, |
84 | [NFSD_Getfd] = write_getfd, | 89 | [NFSD_Getfd] = write_getfd, |
85 | [NFSD_Getfs] = write_getfs, | 90 | [NFSD_Getfs] = write_getfs, |
91 | #endif | ||
86 | [NFSD_Fh] = write_filehandle, | 92 | [NFSD_Fh] = write_filehandle, |
87 | [NFSD_FO_UnlockIP] = write_unlock_ip, | 93 | [NFSD_FO_UnlockIP] = write_unlock_ip, |
88 | [NFSD_FO_UnlockFS] = write_unlock_fs, | 94 | [NFSD_FO_UnlockFS] = write_unlock_fs, |
@@ -121,6 +127,14 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu | |||
121 | 127 | ||
122 | static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) | 128 | static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) |
123 | { | 129 | { |
130 | static int warned; | ||
131 | if (file->f_dentry->d_name.name[0] == '.' && !warned) { | ||
132 | printk(KERN_INFO | ||
133 | "Warning: \"%s\" uses deprecated NFSD interface: %s." | ||
134 | " This will be removed in 2.6.40\n", | ||
135 | current->comm, file->f_dentry->d_name.name); | ||
136 | warned = 1; | ||
137 | } | ||
124 | if (! file->private_data) { | 138 | if (! file->private_data) { |
125 | /* An attempt to read a transaction file without writing | 139 | /* An attempt to read a transaction file without writing |
126 | * causes a 0-byte write so that the file can return | 140 | * causes a 0-byte write so that the file can return |
@@ -187,6 +201,7 @@ static const struct file_operations pool_stats_operations = { | |||
187 | * payload - write methods | 201 | * payload - write methods |
188 | */ | 202 | */ |
189 | 203 | ||
204 | #ifdef CONFIG_NFSD_DEPRECATED | ||
190 | /** | 205 | /** |
191 | * write_svc - Start kernel's NFSD server | 206 | * write_svc - Start kernel's NFSD server |
192 | * | 207 | * |
@@ -402,7 +417,7 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size) | |||
402 | 417 | ||
403 | ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); | 418 | ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); |
404 | 419 | ||
405 | clp = auth_unix_lookup(&in6); | 420 | clp = auth_unix_lookup(&init_net, &in6); |
406 | if (!clp) | 421 | if (!clp) |
407 | err = -EPERM; | 422 | err = -EPERM; |
408 | else { | 423 | else { |
@@ -465,7 +480,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size) | |||
465 | 480 | ||
466 | ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); | 481 | ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); |
467 | 482 | ||
468 | clp = auth_unix_lookup(&in6); | 483 | clp = auth_unix_lookup(&init_net, &in6); |
469 | if (!clp) | 484 | if (!clp) |
470 | err = -EPERM; | 485 | err = -EPERM; |
471 | else { | 486 | else { |
@@ -482,6 +497,7 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size) | |||
482 | out: | 497 | out: |
483 | return err; | 498 | return err; |
484 | } | 499 | } |
500 | #endif /* CONFIG_NFSD_DEPRECATED */ | ||
485 | 501 | ||
486 | /** | 502 | /** |
487 | * write_unlock_ip - Release all locks used by a client | 503 | * write_unlock_ip - Release all locks used by a client |
@@ -1000,12 +1016,12 @@ static ssize_t __write_ports_addxprt(char *buf) | |||
1000 | if (err != 0) | 1016 | if (err != 0) |
1001 | return err; | 1017 | return err; |
1002 | 1018 | ||
1003 | err = svc_create_xprt(nfsd_serv, transport, | 1019 | err = svc_create_xprt(nfsd_serv, transport, &init_net, |
1004 | PF_INET, port, SVC_SOCK_ANONYMOUS); | 1020 | PF_INET, port, SVC_SOCK_ANONYMOUS); |
1005 | if (err < 0) | 1021 | if (err < 0) |
1006 | goto out_err; | 1022 | goto out_err; |
1007 | 1023 | ||
1008 | err = svc_create_xprt(nfsd_serv, transport, | 1024 | err = svc_create_xprt(nfsd_serv, transport, &init_net, |
1009 | PF_INET6, port, SVC_SOCK_ANONYMOUS); | 1025 | PF_INET6, port, SVC_SOCK_ANONYMOUS); |
1010 | if (err < 0 && err != -EAFNOSUPPORT) | 1026 | if (err < 0 && err != -EAFNOSUPPORT) |
1011 | goto out_close; | 1027 | goto out_close; |
@@ -1356,6 +1372,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | |||
1356 | static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | 1372 | static int nfsd_fill_super(struct super_block * sb, void * data, int silent) |
1357 | { | 1373 | { |
1358 | static struct tree_descr nfsd_files[] = { | 1374 | static struct tree_descr nfsd_files[] = { |
1375 | #ifdef CONFIG_NFSD_DEPRECATED | ||
1359 | [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR}, | 1376 | [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR}, |
1360 | [NFSD_Add] = {".add", &transaction_ops, S_IWUSR}, | 1377 | [NFSD_Add] = {".add", &transaction_ops, S_IWUSR}, |
1361 | [NFSD_Del] = {".del", &transaction_ops, S_IWUSR}, | 1378 | [NFSD_Del] = {".del", &transaction_ops, S_IWUSR}, |
@@ -1363,6 +1380,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
1363 | [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR}, | 1380 | [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR}, |
1364 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, | 1381 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, |
1365 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, | 1382 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, |
1383 | #endif | ||
1366 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, | 1384 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, |
1367 | [NFSD_Export_features] = {"export_features", | 1385 | [NFSD_Export_features] = {"export_features", |
1368 | &export_features_operations, S_IRUGO}, | 1386 | &export_features_operations, S_IRUGO}, |