diff options
-rw-r--r-- | Documentation/filesystems/00-INDEX | 12 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/00-INDEX | 16 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/Exporting (renamed from Documentation/filesystems/Exporting) | 0 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/knfsd-stats.txt (renamed from Documentation/filesystems/knfsd-stats.txt) | 0 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/nfs-rdma.txt (renamed from Documentation/filesystems/nfs-rdma.txt) | 0 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/nfs.txt (renamed from Documentation/filesystems/nfs.txt) | 0 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/nfs41-server.txt (renamed from Documentation/filesystems/nfs41-server.txt) | 9 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/nfsroot.txt (renamed from Documentation/filesystems/nfsroot.txt) | 0 | ||||
-rw-r--r-- | Documentation/filesystems/nfs/rpc-cache.txt (renamed from Documentation/filesystems/rpc-cache.txt) | 0 | ||||
-rw-r--r-- | Documentation/filesystems/porting | 2 | ||||
-rw-r--r-- | Documentation/kernel-parameters.txt | 6 | ||||
-rw-r--r-- | arch/parisc/kernel/sys_parisc32.c | 6 | ||||
-rw-r--r-- | fs/cifs/export.c | 2 | ||||
-rw-r--r-- | fs/compat.c | 2 | ||||
-rw-r--r-- | fs/exportfs/expfs.c | 2 | ||||
-rw-r--r-- | fs/isofs/export.c | 2 | ||||
-rw-r--r-- | fs/lockd/svc4proc.c | 4 | ||||
-rw-r--r-- | fs/lockd/svcproc.c | 4 | ||||
-rw-r--r-- | fs/nfs/Kconfig | 2 | ||||
-rw-r--r-- | fs/nfsctl.c | 2 | ||||
-rw-r--r-- | fs/nfsd/auth.c | 12 | ||||
-rw-r--r-- | fs/nfsd/cache.h (renamed from include/linux/nfsd/cache.h) | 5 | ||||
-rw-r--r-- | fs/nfsd/export.c | 65 | ||||
-rw-r--r-- | fs/nfsd/lockd.c | 10 | ||||
-rw-r--r-- | fs/nfsd/nfs2acl.c | 27 | ||||
-rw-r--r-- | fs/nfsd/nfs3acl.c | 15 | ||||
-rw-r--r-- | fs/nfsd/nfs3proc.c | 20 | ||||
-rw-r--r-- | fs/nfsd/nfs3xdr.c | 15 | ||||
-rw-r--r-- | fs/nfsd/nfs4acl.c | 12 | ||||
-rw-r--r-- | fs/nfsd/nfs4callback.c | 19 | ||||
-rw-r--r-- | fs/nfsd/nfs4idmap.c | 17 | ||||
-rw-r--r-- | fs/nfsd/nfs4proc.c | 19 | ||||
-rw-r--r-- | fs/nfsd/nfs4recover.c | 16 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 84 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 26 | ||||
-rw-r--r-- | fs/nfsd/nfscache.c | 14 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 51 | ||||
-rw-r--r-- | fs/nfsd/nfsd.h (renamed from include/linux/nfsd/nfsd.h) | 98 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 102 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.h | 208 | ||||
-rw-r--r-- | fs/nfsd/nfsproc.c | 22 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 22 | ||||
-rw-r--r-- | fs/nfsd/nfsxdr.c | 12 | ||||
-rw-r--r-- | fs/nfsd/state.h (renamed from include/linux/nfsd/state.h) | 14 | ||||
-rw-r--r-- | fs/nfsd/stats.c | 11 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 134 | ||||
-rw-r--r-- | fs/nfsd/vfs.h | 101 | ||||
-rw-r--r-- | fs/nfsd/xdr.h (renamed from include/linux/nfsd/xdr.h) | 10 | ||||
-rw-r--r-- | fs/nfsd/xdr3.h (renamed from include/linux/nfsd/xdr3.h) | 4 | ||||
-rw-r--r-- | fs/nfsd/xdr4.h (renamed from include/linux/nfsd/xdr4.h) | 5 | ||||
-rw-r--r-- | include/linux/exportfs.h | 2 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 1 | ||||
-rw-r--r-- | include/linux/nfsacl.h | 1 | ||||
-rw-r--r-- | include/linux/nfsd/export.h | 19 | ||||
-rw-r--r-- | include/linux/nfsd/nfsfh.h | 206 | ||||
-rw-r--r-- | include/linux/nfsd/syscall.h | 8 | ||||
-rw-r--r-- | include/linux/sunrpc/debug.h | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/rpc_rdma.h | 2 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 7 | ||||
-rw-r--r-- | net/ipv4/Kconfig | 6 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svc_xprt.c | 31 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 53 |
63 files changed, 719 insertions, 863 deletions
diff --git a/Documentation/filesystems/00-INDEX b/Documentation/filesystems/00-INDEX index 7001782ab932..875d49696b6e 100644 --- a/Documentation/filesystems/00-INDEX +++ b/Documentation/filesystems/00-INDEX | |||
@@ -1,7 +1,5 @@ | |||
1 | 00-INDEX | 1 | 00-INDEX |
2 | - this file (info on some of the filesystems supported by linux). | 2 | - this file (info on some of the filesystems supported by linux). |
3 | Exporting | ||
4 | - explanation of how to make filesystems exportable. | ||
5 | Locking | 3 | Locking |
6 | - info on locking rules as they pertain to Linux VFS. | 4 | - info on locking rules as they pertain to Linux VFS. |
7 | 9p.txt | 5 | 9p.txt |
@@ -68,12 +66,8 @@ mandatory-locking.txt | |||
68 | - info on the Linux implementation of Sys V mandatory file locking. | 66 | - info on the Linux implementation of Sys V mandatory file locking. |
69 | ncpfs.txt | 67 | ncpfs.txt |
70 | - info on Novell Netware(tm) filesystem using NCP protocol. | 68 | - info on Novell Netware(tm) filesystem using NCP protocol. |
71 | nfs41-server.txt | 69 | nfs/ |
72 | - info on the Linux server implementation of NFSv4 minor version 1. | 70 | - nfs-related documentation. |
73 | nfs-rdma.txt | ||
74 | - how to install and setup the Linux NFS/RDMA client and server software. | ||
75 | nfsroot.txt | ||
76 | - short guide on setting up a diskless box with NFS root filesystem. | ||
77 | nilfs2.txt | 71 | nilfs2.txt |
78 | - info and mount options for the NILFS2 filesystem. | 72 | - info and mount options for the NILFS2 filesystem. |
79 | ntfs.txt | 73 | ntfs.txt |
@@ -92,8 +86,6 @@ relay.txt | |||
92 | - info on relay, for efficient streaming from kernel to user space. | 86 | - info on relay, for efficient streaming from kernel to user space. |
93 | romfs.txt | 87 | romfs.txt |
94 | - description of the ROMFS filesystem. | 88 | - description of the ROMFS filesystem. |
95 | rpc-cache.txt | ||
96 | - introduction to the caching mechanisms in the sunrpc layer. | ||
97 | seq_file.txt | 89 | seq_file.txt |
98 | - how to use the seq_file API | 90 | - how to use the seq_file API |
99 | sharedsubtree.txt | 91 | sharedsubtree.txt |
diff --git a/Documentation/filesystems/nfs/00-INDEX b/Documentation/filesystems/nfs/00-INDEX new file mode 100644 index 000000000000..2f68cd688769 --- /dev/null +++ b/Documentation/filesystems/nfs/00-INDEX | |||
@@ -0,0 +1,16 @@ | |||
1 | 00-INDEX | ||
2 | - this file (nfs-related documentation). | ||
3 | Exporting | ||
4 | - explanation of how to make filesystems exportable. | ||
5 | knfsd-stats.txt | ||
6 | - statistics which the NFS server makes available to user space. | ||
7 | nfs.txt | ||
8 | - nfs client, and DNS resolution for fs_locations. | ||
9 | nfs41-server.txt | ||
10 | - info on the Linux server implementation of NFSv4 minor version 1. | ||
11 | nfs-rdma.txt | ||
12 | - how to install and setup the Linux NFS/RDMA client and server software | ||
13 | nfsroot.txt | ||
14 | - short guide on setting up a diskless box with NFS root filesystem. | ||
15 | rpc-cache.txt | ||
16 | - introduction to the caching mechanisms in the sunrpc layer. | ||
diff --git a/Documentation/filesystems/Exporting b/Documentation/filesystems/nfs/Exporting index 87019d2b5981..87019d2b5981 100644 --- a/Documentation/filesystems/Exporting +++ b/Documentation/filesystems/nfs/Exporting | |||
diff --git a/Documentation/filesystems/knfsd-stats.txt b/Documentation/filesystems/nfs/knfsd-stats.txt index 64ced5149d37..64ced5149d37 100644 --- a/Documentation/filesystems/knfsd-stats.txt +++ b/Documentation/filesystems/nfs/knfsd-stats.txt | |||
diff --git a/Documentation/filesystems/nfs-rdma.txt b/Documentation/filesystems/nfs/nfs-rdma.txt index e386f7e4bcee..e386f7e4bcee 100644 --- a/Documentation/filesystems/nfs-rdma.txt +++ b/Documentation/filesystems/nfs/nfs-rdma.txt | |||
diff --git a/Documentation/filesystems/nfs.txt b/Documentation/filesystems/nfs/nfs.txt index f50f26ce6cd0..f50f26ce6cd0 100644 --- a/Documentation/filesystems/nfs.txt +++ b/Documentation/filesystems/nfs/nfs.txt | |||
diff --git a/Documentation/filesystems/nfs41-server.txt b/Documentation/filesystems/nfs/nfs41-server.txt index 5920fe26e6ff..1bd0d0c05171 100644 --- a/Documentation/filesystems/nfs41-server.txt +++ b/Documentation/filesystems/nfs/nfs41-server.txt | |||
@@ -41,7 +41,7 @@ interoperability problems with future clients. Known issues: | |||
41 | conformant with the spec (for example, we don't use kerberos | 41 | conformant with the spec (for example, we don't use kerberos |
42 | on the backchannel correctly). | 42 | on the backchannel correctly). |
43 | - no trunking support: no clients currently take advantage of | 43 | - no trunking support: no clients currently take advantage of |
44 | trunking, but this is a mandatory failure, and its use is | 44 | trunking, but this is a mandatory feature, and its use is |
45 | recommended to clients in a number of places. (E.g. to ensure | 45 | recommended to clients in a number of places. (E.g. to ensure |
46 | timely renewal in case an existing connection's retry timeouts | 46 | timely renewal in case an existing connection's retry timeouts |
47 | have gotten too long; see section 8.3 of the draft.) | 47 | have gotten too long; see section 8.3 of the draft.) |
@@ -213,3 +213,10 @@ The following cases aren't supported yet: | |||
213 | DESTROY_CLIENTID, DESTROY_SESSION, EXCHANGE_ID. | 213 | DESTROY_CLIENTID, DESTROY_SESSION, EXCHANGE_ID. |
214 | * DESTROY_SESSION MUST be the final operation in the COMPOUND request. | 214 | * DESTROY_SESSION MUST be the final operation in the COMPOUND request. |
215 | 215 | ||
216 | Nonstandard compound limitations: | ||
217 | * No support for a sessions fore channel RPC compound that requires both a | ||
218 | ca_maxrequestsize request and a ca_maxresponsesize reply, so we may | ||
219 | fail to live up to the promise we made in CREATE_SESSION fore channel | ||
220 | negotiation. | ||
221 | * No more than one IO operation (read, write, readdir) allowed per | ||
222 | compound. | ||
diff --git a/Documentation/filesystems/nfsroot.txt b/Documentation/filesystems/nfs/nfsroot.txt index 3ba0b945aaf8..3ba0b945aaf8 100644 --- a/Documentation/filesystems/nfsroot.txt +++ b/Documentation/filesystems/nfs/nfsroot.txt | |||
diff --git a/Documentation/filesystems/rpc-cache.txt b/Documentation/filesystems/nfs/rpc-cache.txt index 8a382bea6808..8a382bea6808 100644 --- a/Documentation/filesystems/rpc-cache.txt +++ b/Documentation/filesystems/nfs/rpc-cache.txt | |||
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 92b888d540a6..a7e9746ee7ea 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -140,7 +140,7 @@ Callers of notify_change() need ->i_mutex now. | |||
140 | New super_block field "struct export_operations *s_export_op" for | 140 | New super_block field "struct export_operations *s_export_op" for |
141 | explicit support for exporting, e.g. via NFS. The structure is fully | 141 | explicit support for exporting, e.g. via NFS. The structure is fully |
142 | documented at its declaration in include/linux/fs.h, and in | 142 | documented at its declaration in include/linux/fs.h, and in |
143 | Documentation/filesystems/Exporting. | 143 | Documentation/filesystems/nfs/Exporting. |
144 | 144 | ||
145 | Briefly it allows for the definition of decode_fh and encode_fh operations | 145 | Briefly it allows for the definition of decode_fh and encode_fh operations |
146 | to encode and decode filehandles, and allows the filesystem to use | 146 | to encode and decode filehandles, and allows the filesystem to use |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c309515ae959..5ba4d9dff113 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1032,7 +1032,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1032 | No delay | 1032 | No delay |
1033 | 1033 | ||
1034 | ip= [IP_PNP] | 1034 | ip= [IP_PNP] |
1035 | See Documentation/filesystems/nfsroot.txt. | 1035 | See Documentation/filesystems/nfs/nfsroot.txt. |
1036 | 1036 | ||
1037 | ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards | 1037 | ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards |
1038 | See comment before ip2_setup() in | 1038 | See comment before ip2_setup() in |
@@ -1553,10 +1553,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1553 | going to be removed in 2.6.29. | 1553 | going to be removed in 2.6.29. |
1554 | 1554 | ||
1555 | nfsaddrs= [NFS] | 1555 | nfsaddrs= [NFS] |
1556 | See Documentation/filesystems/nfsroot.txt. | 1556 | See Documentation/filesystems/nfs/nfsroot.txt. |
1557 | 1557 | ||
1558 | nfsroot= [NFS] nfs root filesystem for disk-less boxes. | 1558 | nfsroot= [NFS] nfs root filesystem for disk-less boxes. |
1559 | See Documentation/filesystems/nfsroot.txt. | 1559 | See Documentation/filesystems/nfs/nfsroot.txt. |
1560 | 1560 | ||
1561 | nfs.callback_tcpport= | 1561 | nfs.callback_tcpport= |
1562 | [NFS] set the TCP port on which the NFSv4 callback | 1562 | [NFS] set the TCP port on which the NFSv4 callback |
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c index 76d23ec8dfaa..9779ece2b070 100644 --- a/arch/parisc/kernel/sys_parisc32.c +++ b/arch/parisc/kernel/sys_parisc32.c | |||
@@ -26,13 +26,7 @@ | |||
26 | #include <linux/shm.h> | 26 | #include <linux/shm.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/uio.h> | 28 | #include <linux/uio.h> |
29 | #include <linux/nfs_fs.h> | ||
30 | #include <linux/ncp_fs.h> | 29 | #include <linux/ncp_fs.h> |
31 | #include <linux/sunrpc/svc.h> | ||
32 | #include <linux/nfsd/nfsd.h> | ||
33 | #include <linux/nfsd/cache.h> | ||
34 | #include <linux/nfsd/xdr.h> | ||
35 | #include <linux/nfsd/syscall.h> | ||
36 | #include <linux/poll.h> | 30 | #include <linux/poll.h> |
37 | #include <linux/personality.h> | 31 | #include <linux/personality.h> |
38 | #include <linux/stat.h> | 32 | #include <linux/stat.h> |
diff --git a/fs/cifs/export.c b/fs/cifs/export.c index 75949d6a5f1b..6177f7cca16a 100644 --- a/fs/cifs/export.c +++ b/fs/cifs/export.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * See Documentation/filesystems/Exporting | 27 | * See Documentation/filesystems/nfs/Exporting |
28 | * and examples in fs/exportfs | 28 | * and examples in fs/exportfs |
29 | * | 29 | * |
30 | * Since cifs is a network file system, an "fsid" must be included for | 30 | * Since cifs is a network file system, an "fsid" must be included for |
diff --git a/fs/compat.c b/fs/compat.c index 6c19040ffeef..00d90c2e66f0 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -38,8 +38,6 @@ | |||
38 | #include <linux/dirent.h> | 38 | #include <linux/dirent.h> |
39 | #include <linux/fsnotify.h> | 39 | #include <linux/fsnotify.h> |
40 | #include <linux/highuid.h> | 40 | #include <linux/highuid.h> |
41 | #include <linux/sunrpc/svc.h> | ||
42 | #include <linux/nfsd/nfsd.h> | ||
43 | #include <linux/nfsd/syscall.h> | 41 | #include <linux/nfsd/syscall.h> |
44 | #include <linux/personality.h> | 42 | #include <linux/personality.h> |
45 | #include <linux/rwsem.h> | 43 | #include <linux/rwsem.h> |
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 197c7db583c7..e9e175949a63 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * and for mapping back from file handles to dentries. | 6 | * and for mapping back from file handles to dentries. |
7 | * | 7 | * |
8 | * For details on why we do all the strange and hairy things in here | 8 | * For details on why we do all the strange and hairy things in here |
9 | * take a look at Documentation/filesystems/Exporting. | 9 | * take a look at Documentation/filesystems/nfs/Exporting. |
10 | */ | 10 | */ |
11 | #include <linux/exportfs.h> | 11 | #include <linux/exportfs.h> |
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
diff --git a/fs/isofs/export.c b/fs/isofs/export.c index e81a30593ba9..ed752cb38474 100644 --- a/fs/isofs/export.c +++ b/fs/isofs/export.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * The following files are helpful: | 10 | * The following files are helpful: |
11 | * | 11 | * |
12 | * Documentation/filesystems/Exporting | 12 | * Documentation/filesystems/nfs/Exporting |
13 | * fs/exportfs/expfs.c. | 13 | * fs/exportfs/expfs.c. |
14 | */ | 14 | */ |
15 | 15 | ||
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index bd173a6ca3b1..a7966eed3c17 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
@@ -11,10 +11,6 @@ | |||
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | #include <linux/in.h> | ||
15 | #include <linux/sunrpc/svc.h> | ||
16 | #include <linux/sunrpc/clnt.h> | ||
17 | #include <linux/nfsd/nfsd.h> | ||
18 | #include <linux/lockd/lockd.h> | 14 | #include <linux/lockd/lockd.h> |
19 | #include <linux/lockd/share.h> | 15 | #include <linux/lockd/share.h> |
20 | 16 | ||
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index e1d28ddd2169..56c9519d900a 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -11,10 +11,6 @@ | |||
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | #include <linux/in.h> | ||
15 | #include <linux/sunrpc/svc.h> | ||
16 | #include <linux/sunrpc/clnt.h> | ||
17 | #include <linux/nfsd/nfsd.h> | ||
18 | #include <linux/lockd/lockd.h> | 14 | #include <linux/lockd/lockd.h> |
19 | #include <linux/lockd/share.h> | 15 | #include <linux/lockd/share.h> |
20 | 16 | ||
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig index 2a77bc25d5af..59e5673b4597 100644 --- a/fs/nfs/Kconfig +++ b/fs/nfs/Kconfig | |||
@@ -90,7 +90,7 @@ config ROOT_NFS | |||
90 | If you want your system to mount its root file system via NFS, | 90 | If you want your system to mount its root file system via NFS, |
91 | choose Y here. This is common practice for managing systems | 91 | choose Y here. This is common practice for managing systems |
92 | without local permanent storage. For details, read | 92 | without local permanent storage. For details, read |
93 | <file:Documentation/filesystems/nfsroot.txt>. | 93 | <file:Documentation/filesystems/nfs/nfsroot.txt>. |
94 | 94 | ||
95 | Most people say N here. | 95 | Most people say N here. |
96 | 96 | ||
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index 8f9a20556f79..d3854d94b7cf 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c | |||
@@ -7,8 +7,6 @@ | |||
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <linux/file.h> | 8 | #include <linux/file.h> |
9 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
10 | #include <linux/sunrpc/svc.h> | ||
11 | #include <linux/nfsd/nfsd.h> | ||
12 | #include <linux/nfsd/syscall.h> | 10 | #include <linux/nfsd/syscall.h> |
13 | #include <linux/cred.h> | 11 | #include <linux/cred.h> |
14 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c index 36fcabbf5186..79717a40daba 100644 --- a/fs/nfsd/auth.c +++ b/fs/nfsd/auth.c | |||
@@ -1,15 +1,7 @@ | |||
1 | /* | 1 | /* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */ |
2 | * linux/fs/nfsd/auth.c | ||
3 | * | ||
4 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | ||
5 | */ | ||
6 | 2 | ||
7 | #include <linux/types.h> | ||
8 | #include <linux/sched.h> | 3 | #include <linux/sched.h> |
9 | #include <linux/sunrpc/svc.h> | 4 | #include "nfsd.h" |
10 | #include <linux/sunrpc/svcauth.h> | ||
11 | #include <linux/nfsd/nfsd.h> | ||
12 | #include <linux/nfsd/export.h> | ||
13 | #include "auth.h" | 5 | #include "auth.h" |
14 | 6 | ||
15 | int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp) | 7 | int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp) |
diff --git a/include/linux/nfsd/cache.h b/fs/nfsd/cache.h index 3a3f58934f5e..d892be61016c 100644 --- a/include/linux/nfsd/cache.h +++ b/fs/nfsd/cache.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * include/linux/nfsd/cache.h | ||
3 | * | ||
4 | * Request reply cache. This was heavily inspired by the | 2 | * Request reply cache. This was heavily inspired by the |
5 | * implementation in 4.3BSD/4.4BSD. | 3 | * implementation in 4.3BSD/4.4BSD. |
6 | * | 4 | * |
@@ -10,8 +8,7 @@ | |||
10 | #ifndef NFSCACHE_H | 8 | #ifndef NFSCACHE_H |
11 | #define NFSCACHE_H | 9 | #define NFSCACHE_H |
12 | 10 | ||
13 | #include <linux/in.h> | 11 | #include <linux/sunrpc/svc.h> |
14 | #include <linux/uio.h> | ||
15 | 12 | ||
16 | /* | 13 | /* |
17 | * Representation of a reply cache entry. | 14 | * Representation of a reply cache entry. |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index c1c9e035d4a4..c487810a2366 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -1,7 +1,5 @@ | |||
1 | #define MSNFS /* HACK HACK */ | 1 | #define MSNFS /* HACK HACK */ |
2 | /* | 2 | /* |
3 | * linux/fs/nfsd/export.c | ||
4 | * | ||
5 | * NFS exporting and validation. | 3 | * NFS exporting and validation. |
6 | * | 4 | * |
7 | * We maintain a list of clients, each of which has a list of | 5 | * We maintain a list of clients, each of which has a list of |
@@ -14,29 +12,16 @@ | |||
14 | * Copyright (C) 1995, 1996 Olaf Kirch, <okir@monad.swb.de> | 12 | * Copyright (C) 1995, 1996 Olaf Kirch, <okir@monad.swb.de> |
15 | */ | 13 | */ |
16 | 14 | ||
17 | #include <linux/unistd.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/stat.h> | ||
20 | #include <linux/in.h> | ||
21 | #include <linux/seq_file.h> | ||
22 | #include <linux/syscalls.h> | ||
23 | #include <linux/rwsem.h> | ||
24 | #include <linux/dcache.h> | ||
25 | #include <linux/namei.h> | 15 | #include <linux/namei.h> |
26 | #include <linux/mount.h> | ||
27 | #include <linux/hash.h> | ||
28 | #include <linux/module.h> | 16 | #include <linux/module.h> |
29 | #include <linux/exportfs.h> | 17 | #include <linux/exportfs.h> |
30 | 18 | ||
31 | #include <linux/sunrpc/svc.h> | ||
32 | #include <linux/nfsd/nfsd.h> | ||
33 | #include <linux/nfsd/nfsfh.h> | ||
34 | #include <linux/nfsd/syscall.h> | 19 | #include <linux/nfsd/syscall.h> |
35 | #include <linux/lockd/bind.h> | ||
36 | #include <linux/sunrpc/msg_prot.h> | ||
37 | #include <linux/sunrpc/gss_api.h> | ||
38 | #include <net/ipv6.h> | 20 | #include <net/ipv6.h> |
39 | 21 | ||
22 | #include "nfsd.h" | ||
23 | #include "nfsfh.h" | ||
24 | |||
40 | #define NFSDDBG_FACILITY NFSDDBG_EXPORT | 25 | #define NFSDDBG_FACILITY NFSDDBG_EXPORT |
41 | 26 | ||
42 | typedef struct auth_domain svc_client; | 27 | typedef struct auth_domain svc_client; |
@@ -369,16 +354,25 @@ static struct svc_export *svc_export_update(struct svc_export *new, | |||
369 | struct svc_export *old); | 354 | struct svc_export *old); |
370 | static struct svc_export *svc_export_lookup(struct svc_export *); | 355 | static struct svc_export *svc_export_lookup(struct svc_export *); |
371 | 356 | ||
372 | static int check_export(struct inode *inode, int flags, unsigned char *uuid) | 357 | static int check_export(struct inode *inode, int *flags, unsigned char *uuid) |
373 | { | 358 | { |
374 | 359 | ||
375 | /* We currently export only dirs and regular files. | 360 | /* |
376 | * This is what umountd does. | 361 | * We currently export only dirs, regular files, and (for v4 |
362 | * pseudoroot) symlinks. | ||
377 | */ | 363 | */ |
378 | if (!S_ISDIR(inode->i_mode) && | 364 | if (!S_ISDIR(inode->i_mode) && |
365 | !S_ISLNK(inode->i_mode) && | ||
379 | !S_ISREG(inode->i_mode)) | 366 | !S_ISREG(inode->i_mode)) |
380 | return -ENOTDIR; | 367 | return -ENOTDIR; |
381 | 368 | ||
369 | /* | ||
370 | * Mountd should never pass down a writeable V4ROOT export, but, | ||
371 | * just to make sure: | ||
372 | */ | ||
373 | if (*flags & NFSEXP_V4ROOT) | ||
374 | *flags |= NFSEXP_READONLY; | ||
375 | |||
382 | /* There are two requirements on a filesystem to be exportable. | 376 | /* There are two requirements on a filesystem to be exportable. |
383 | * 1: We must be able to identify the filesystem from a number. | 377 | * 1: We must be able to identify the filesystem from a number. |
384 | * either a device number (so FS_REQUIRES_DEV needed) | 378 | * either a device number (so FS_REQUIRES_DEV needed) |
@@ -387,7 +381,7 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid) | |||
387 | * This means that s_export_op must be set. | 381 | * This means that s_export_op must be set. |
388 | */ | 382 | */ |
389 | if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && | 383 | if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && |
390 | !(flags & NFSEXP_FSID) && | 384 | !(*flags & NFSEXP_FSID) && |
391 | uuid == NULL) { | 385 | uuid == NULL) { |
392 | dprintk("exp_export: export of non-dev fs without fsid\n"); | 386 | dprintk("exp_export: export of non-dev fs without fsid\n"); |
393 | return -EINVAL; | 387 | return -EINVAL; |
@@ -602,7 +596,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
602 | goto out4; | 596 | goto out4; |
603 | } | 597 | } |
604 | 598 | ||
605 | err = check_export(exp.ex_path.dentry->d_inode, exp.ex_flags, | 599 | err = check_export(exp.ex_path.dentry->d_inode, &exp.ex_flags, |
606 | exp.ex_uuid); | 600 | exp.ex_uuid); |
607 | if (err) | 601 | if (err) |
608 | goto out4; | 602 | goto out4; |
@@ -1041,7 +1035,7 @@ exp_export(struct nfsctl_export *nxp) | |||
1041 | goto finish; | 1035 | goto finish; |
1042 | } | 1036 | } |
1043 | 1037 | ||
1044 | err = check_export(path.dentry->d_inode, nxp->ex_flags, NULL); | 1038 | err = check_export(path.dentry->d_inode, &nxp->ex_flags, NULL); |
1045 | if (err) goto finish; | 1039 | if (err) goto finish; |
1046 | 1040 | ||
1047 | err = -ENOMEM; | 1041 | err = -ENOMEM; |
@@ -1320,6 +1314,23 @@ rqst_exp_parent(struct svc_rqst *rqstp, struct path *path) | |||
1320 | return exp; | 1314 | return exp; |
1321 | } | 1315 | } |
1322 | 1316 | ||
1317 | static struct svc_export *find_fsidzero_export(struct svc_rqst *rqstp) | ||
1318 | { | ||
1319 | struct svc_export *exp; | ||
1320 | u32 fsidv[2]; | ||
1321 | |||
1322 | mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL); | ||
1323 | |||
1324 | exp = rqst_exp_find(rqstp, FSID_NUM, fsidv); | ||
1325 | /* | ||
1326 | * We shouldn't have accepting an nfsv4 request at all if we | ||
1327 | * don't have a pseudoexport!: | ||
1328 | */ | ||
1329 | if (IS_ERR(exp) && PTR_ERR(exp) == -ENOENT) | ||
1330 | exp = ERR_PTR(-ESERVERFAULT); | ||
1331 | return exp; | ||
1332 | } | ||
1333 | |||
1323 | /* | 1334 | /* |
1324 | * Called when we need the filehandle for the root of the pseudofs, | 1335 | * Called when we need the filehandle for the root of the pseudofs, |
1325 | * for a given NFSv4 client. The root is defined to be the | 1336 | * for a given NFSv4 client. The root is defined to be the |
@@ -1330,11 +1341,8 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp) | |||
1330 | { | 1341 | { |
1331 | struct svc_export *exp; | 1342 | struct svc_export *exp; |
1332 | __be32 rv; | 1343 | __be32 rv; |
1333 | u32 fsidv[2]; | ||
1334 | 1344 | ||
1335 | mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL); | 1345 | exp = find_fsidzero_export(rqstp); |
1336 | |||
1337 | exp = rqst_exp_find(rqstp, FSID_NUM, fsidv); | ||
1338 | if (IS_ERR(exp)) | 1346 | if (IS_ERR(exp)) |
1339 | return nfserrno(PTR_ERR(exp)); | 1347 | return nfserrno(PTR_ERR(exp)); |
1340 | rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL); | 1348 | rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL); |
@@ -1425,6 +1433,7 @@ static struct flags { | |||
1425 | { NFSEXP_CROSSMOUNT, {"crossmnt", ""}}, | 1433 | { NFSEXP_CROSSMOUNT, {"crossmnt", ""}}, |
1426 | { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}}, | 1434 | { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}}, |
1427 | { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}}, | 1435 | { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}}, |
1436 | { NFSEXP_V4ROOT, {"v4root", ""}}, | ||
1428 | #ifdef MSNFS | 1437 | #ifdef MSNFS |
1429 | { NFSEXP_MSNFS, {"msnfs", ""}}, | 1438 | { NFSEXP_MSNFS, {"msnfs", ""}}, |
1430 | #endif | 1439 | #endif |
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c index b2786a5f9afe..0c6d81670137 100644 --- a/fs/nfsd/lockd.c +++ b/fs/nfsd/lockd.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/lockd.c | ||
3 | * | ||
4 | * This file contains all the stubs needed when communicating with lockd. | 2 | * This file contains all the stubs needed when communicating with lockd. |
5 | * This level of indirection is necessary so we can run nfsd+lockd without | 3 | * This level of indirection is necessary so we can run nfsd+lockd without |
6 | * requiring the nfs client to be compiled in/loaded, and vice versa. | 4 | * requiring the nfs client to be compiled in/loaded, and vice versa. |
@@ -8,14 +6,10 @@ | |||
8 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
9 | */ | 7 | */ |
10 | 8 | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/fs.h> | ||
13 | #include <linux/file.h> | 9 | #include <linux/file.h> |
14 | #include <linux/mount.h> | ||
15 | #include <linux/sunrpc/clnt.h> | ||
16 | #include <linux/sunrpc/svc.h> | ||
17 | #include <linux/nfsd/nfsd.h> | ||
18 | #include <linux/lockd/bind.h> | 10 | #include <linux/lockd/bind.h> |
11 | #include "nfsd.h" | ||
12 | #include "vfs.h" | ||
19 | 13 | ||
20 | #define NFSDDBG_FACILITY NFSDDBG_LOCKD | 14 | #define NFSDDBG_FACILITY NFSDDBG_LOCKD |
21 | 15 | ||
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 4e3219e84116..f20589d2ae27 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -1,19 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs2acl.c | ||
3 | * | ||
4 | * Process version 2 NFSACL requests. | 2 | * Process version 2 NFSACL requests. |
5 | * | 3 | * |
6 | * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> | 4 | * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> |
7 | */ | 5 | */ |
8 | 6 | ||
9 | #include <linux/sunrpc/svc.h> | 7 | #include "nfsd.h" |
10 | #include <linux/nfs.h> | 8 | /* FIXME: nfsacl.h is a broken header */ |
11 | #include <linux/nfsd/nfsd.h> | ||
12 | #include <linux/nfsd/cache.h> | ||
13 | #include <linux/nfsd/xdr.h> | ||
14 | #include <linux/nfsd/xdr3.h> | ||
15 | #include <linux/posix_acl.h> | ||
16 | #include <linux/nfsacl.h> | 9 | #include <linux/nfsacl.h> |
10 | #include "cache.h" | ||
11 | #include "xdr3.h" | ||
12 | #include "vfs.h" | ||
17 | 13 | ||
18 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 14 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
19 | #define RETURN_STATUS(st) { resp->status = (st); return (st); } | 15 | #define RETURN_STATUS(st) { resp->status = (st); return (st); } |
@@ -217,6 +213,16 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, | |||
217 | * XDR encode functions | 213 | * XDR encode functions |
218 | */ | 214 | */ |
219 | 215 | ||
216 | /* | ||
217 | * There must be an encoding function for void results so svc_process | ||
218 | * will work properly. | ||
219 | */ | ||
220 | int | ||
221 | nfsaclsvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) | ||
222 | { | ||
223 | return xdr_ressize_check(rqstp, p); | ||
224 | } | ||
225 | |||
220 | /* GETACL */ | 226 | /* GETACL */ |
221 | static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, | 227 | static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, |
222 | struct nfsd3_getaclres *resp) | 228 | struct nfsd3_getaclres *resp) |
@@ -308,7 +314,6 @@ static int nfsaclsvc_release_access(struct svc_rqst *rqstp, __be32 *p, | |||
308 | } | 314 | } |
309 | 315 | ||
310 | #define nfsaclsvc_decode_voidargs NULL | 316 | #define nfsaclsvc_decode_voidargs NULL |
311 | #define nfsaclsvc_encode_voidres NULL | ||
312 | #define nfsaclsvc_release_void NULL | 317 | #define nfsaclsvc_release_void NULL |
313 | #define nfsd3_fhandleargs nfsd_fhandle | 318 | #define nfsd3_fhandleargs nfsd_fhandle |
314 | #define nfsd3_attrstatres nfsd_attrstat | 319 | #define nfsd3_attrstatres nfsd_attrstat |
@@ -346,5 +351,5 @@ struct svc_version nfsd_acl_version2 = { | |||
346 | .vs_proc = nfsd_acl_procedures2, | 351 | .vs_proc = nfsd_acl_procedures2, |
347 | .vs_dispatch = nfsd_dispatch, | 352 | .vs_dispatch = nfsd_dispatch, |
348 | .vs_xdrsize = NFS3_SVC_XDRSIZE, | 353 | .vs_xdrsize = NFS3_SVC_XDRSIZE, |
349 | .vs_hidden = 1, | 354 | .vs_hidden = 0, |
350 | }; | 355 | }; |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index 9981dbb377a3..e0c4846bad92 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -1,18 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs3acl.c | ||
3 | * | ||
4 | * Process version 3 NFSACL requests. | 2 | * Process version 3 NFSACL requests. |
5 | * | 3 | * |
6 | * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> | 4 | * Copyright (C) 2002-2003 Andreas Gruenbacher <agruen@suse.de> |
7 | */ | 5 | */ |
8 | 6 | ||
9 | #include <linux/sunrpc/svc.h> | 7 | #include "nfsd.h" |
10 | #include <linux/nfs3.h> | 8 | /* FIXME: nfsacl.h is a broken header */ |
11 | #include <linux/nfsd/nfsd.h> | ||
12 | #include <linux/nfsd/cache.h> | ||
13 | #include <linux/nfsd/xdr3.h> | ||
14 | #include <linux/posix_acl.h> | ||
15 | #include <linux/nfsacl.h> | 9 | #include <linux/nfsacl.h> |
10 | #include "cache.h" | ||
11 | #include "xdr3.h" | ||
12 | #include "vfs.h" | ||
16 | 13 | ||
17 | #define RETURN_STATUS(st) { resp->status = (st); return (st); } | 14 | #define RETURN_STATUS(st) { resp->status = (st); return (st); } |
18 | 15 | ||
@@ -264,6 +261,6 @@ struct svc_version nfsd_acl_version3 = { | |||
264 | .vs_proc = nfsd_acl_procedures3, | 261 | .vs_proc = nfsd_acl_procedures3, |
265 | .vs_dispatch = nfsd_dispatch, | 262 | .vs_dispatch = nfsd_dispatch, |
266 | .vs_xdrsize = NFS3_SVC_XDRSIZE, | 263 | .vs_xdrsize = NFS3_SVC_XDRSIZE, |
267 | .vs_hidden = 1, | 264 | .vs_hidden = 0, |
268 | }; | 265 | }; |
269 | 266 | ||
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index a713c418a922..3d68f45a37b9 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c | |||
@@ -1,30 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs3proc.c | ||
3 | * | ||
4 | * Process version 3 NFS requests. | 2 | * Process version 3 NFS requests. |
5 | * | 3 | * |
6 | * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de> |
7 | */ | 5 | */ |
8 | 6 | ||
9 | #include <linux/linkage.h> | ||
10 | #include <linux/time.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
13 | #include <linux/ext2_fs.h> | 8 | #include <linux/ext2_fs.h> |
14 | #include <linux/stat.h> | ||
15 | #include <linux/fcntl.h> | ||
16 | #include <linux/net.h> | ||
17 | #include <linux/in.h> | ||
18 | #include <linux/unistd.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/major.h> | ||
21 | #include <linux/magic.h> | 9 | #include <linux/magic.h> |
22 | 10 | ||
23 | #include <linux/sunrpc/svc.h> | 11 | #include "cache.h" |
24 | #include <linux/nfsd/nfsd.h> | 12 | #include "xdr3.h" |
25 | #include <linux/nfsd/cache.h> | 13 | #include "vfs.h" |
26 | #include <linux/nfsd/xdr3.h> | ||
27 | #include <linux/nfs3.h> | ||
28 | 14 | ||
29 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 15 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
30 | 16 | ||
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index d0a2ce1b4324..2a533a0af2a9 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs3xdr.c | ||
3 | * | ||
4 | * XDR support for nfsd/protocol version 3. | 2 | * XDR support for nfsd/protocol version 3. |
5 | * | 3 | * |
6 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> |
@@ -8,19 +6,8 @@ | |||
8 | * 2003-08-09 Jamie Lokier: Use htonl() for nanoseconds, not htons()! | 6 | * 2003-08-09 Jamie Lokier: Use htonl() for nanoseconds, not htons()! |
9 | */ | 7 | */ |
10 | 8 | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/time.h> | ||
13 | #include <linux/nfs3.h> | ||
14 | #include <linux/list.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/dcache.h> | ||
17 | #include <linux/namei.h> | 9 | #include <linux/namei.h> |
18 | #include <linux/mm.h> | 10 | #include "xdr3.h" |
19 | #include <linux/vfs.h> | ||
20 | #include <linux/sunrpc/xdr.h> | ||
21 | #include <linux/sunrpc/svc.h> | ||
22 | #include <linux/nfsd/nfsd.h> | ||
23 | #include <linux/nfsd/xdr3.h> | ||
24 | #include "auth.h" | 11 | #include "auth.h" |
25 | 12 | ||
26 | #define NFSDDBG_FACILITY NFSDDBG_XDR | 13 | #define NFSDDBG_FACILITY NFSDDBG_XDR |
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 725d02f210e2..88150685df34 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * fs/nfs4acl/acl.c | ||
3 | * | ||
4 | * Common NFSv4 ACL handling code. | 2 | * Common NFSv4 ACL handling code. |
5 | * | 3 | * |
6 | * Copyright (c) 2002, 2003 The Regents of the University of Michigan. | 4 | * Copyright (c) 2002, 2003 The Regents of the University of Michigan. |
@@ -36,15 +34,7 @@ | |||
36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
37 | */ | 35 | */ |
38 | 36 | ||
39 | #include <linux/string.h> | ||
40 | #include <linux/slab.h> | ||
41 | #include <linux/list.h> | ||
42 | #include <linux/types.h> | ||
43 | #include <linux/fs.h> | ||
44 | #include <linux/module.h> | ||
45 | #include <linux/nfs_fs.h> | 37 | #include <linux/nfs_fs.h> |
46 | #include <linux/posix_acl.h> | ||
47 | #include <linux/nfs4.h> | ||
48 | #include <linux/nfs4_acl.h> | 38 | #include <linux/nfs4_acl.h> |
49 | 39 | ||
50 | 40 | ||
@@ -389,7 +379,7 @@ sort_pacl(struct posix_acl *pacl) | |||
389 | sort_pacl_range(pacl, 1, i-1); | 379 | sort_pacl_range(pacl, 1, i-1); |
390 | 380 | ||
391 | BUG_ON(pacl->a_entries[i].e_tag != ACL_GROUP_OBJ); | 381 | BUG_ON(pacl->a_entries[i].e_tag != ACL_GROUP_OBJ); |
392 | j = i++; | 382 | j = ++i; |
393 | while (pacl->a_entries[j].e_tag == ACL_GROUP) | 383 | while (pacl->a_entries[j].e_tag == ACL_GROUP) |
394 | j++; | 384 | j++; |
395 | sort_pacl_range(pacl, i, j-1); | 385 | sort_pacl_range(pacl, i, j-1); |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 24e8d78f8dde..c6eed2a3b093 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs4callback.c | ||
3 | * | ||
4 | * Copyright (c) 2001 The Regents of the University of Michigan. | 2 | * Copyright (c) 2001 The Regents of the University of Michigan. |
5 | * All rights reserved. | 3 | * All rights reserved. |
6 | * | 4 | * |
@@ -33,22 +31,9 @@ | |||
33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ | 32 | */ |
35 | 33 | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/list.h> | ||
38 | #include <linux/inet.h> | ||
39 | #include <linux/errno.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/sched.h> | ||
42 | #include <linux/kthread.h> | ||
43 | #include <linux/sunrpc/xdr.h> | ||
44 | #include <linux/sunrpc/svc.h> | ||
45 | #include <linux/sunrpc/clnt.h> | 34 | #include <linux/sunrpc/clnt.h> |
46 | #include <linux/sunrpc/svcsock.h> | 35 | #include "nfsd.h" |
47 | #include <linux/nfsd/nfsd.h> | 36 | #include "state.h" |
48 | #include <linux/nfsd/state.h> | ||
49 | #include <linux/sunrpc/sched.h> | ||
50 | #include <linux/nfs4.h> | ||
51 | #include <linux/sunrpc/xprtsock.h> | ||
52 | 37 | ||
53 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 38 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
54 | 39 | ||
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index ba2c199592fd..6e2983b27f3c 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * fs/nfsd/nfs4idmap.c | ||
3 | * | ||
4 | * Mapping of UID/GIDs to name and vice versa. | 2 | * Mapping of UID/GIDs to name and vice versa. |
5 | * | 3 | * |
6 | * Copyright (c) 2002, 2003 The Regents of the University of | 4 | * Copyright (c) 2002, 2003 The Regents of the University of |
@@ -35,22 +33,9 @@ | |||
35 | */ | 33 | */ |
36 | 34 | ||
37 | #include <linux/module.h> | 35 | #include <linux/module.h> |
38 | #include <linux/init.h> | ||
39 | |||
40 | #include <linux/mm.h> | ||
41 | #include <linux/errno.h> | ||
42 | #include <linux/string.h> | ||
43 | #include <linux/sunrpc/clnt.h> | ||
44 | #include <linux/nfs.h> | ||
45 | #include <linux/nfs4.h> | ||
46 | #include <linux/nfs_fs.h> | ||
47 | #include <linux/nfs_page.h> | ||
48 | #include <linux/sunrpc/cache.h> | ||
49 | #include <linux/nfsd_idmap.h> | 36 | #include <linux/nfsd_idmap.h> |
50 | #include <linux/list.h> | ||
51 | #include <linux/time.h> | ||
52 | #include <linux/seq_file.h> | 37 | #include <linux/seq_file.h> |
53 | #include <linux/sunrpc/svcauth.h> | 38 | #include <linux/sched.h> |
54 | 39 | ||
55 | /* | 40 | /* |
56 | * Cache entry | 41 | * Cache entry |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index bebc0c2e1b0a..37514c469846 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * fs/nfsd/nfs4proc.c | ||
3 | * | ||
4 | * Server-side procedures for NFSv4. | 2 | * Server-side procedures for NFSv4. |
5 | * | 3 | * |
6 | * Copyright (c) 2002 The Regents of the University of Michigan. | 4 | * Copyright (c) 2002 The Regents of the University of Michigan. |
@@ -34,20 +32,11 @@ | |||
34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | */ | 34 | */ |
37 | |||
38 | #include <linux/param.h> | ||
39 | #include <linux/major.h> | ||
40 | #include <linux/slab.h> | ||
41 | #include <linux/file.h> | 35 | #include <linux/file.h> |
42 | 36 | ||
43 | #include <linux/sunrpc/svc.h> | 37 | #include "cache.h" |
44 | #include <linux/nfsd/nfsd.h> | 38 | #include "xdr4.h" |
45 | #include <linux/nfsd/cache.h> | 39 | #include "vfs.h" |
46 | #include <linux/nfs4.h> | ||
47 | #include <linux/nfsd/state.h> | ||
48 | #include <linux/nfsd/xdr4.h> | ||
49 | #include <linux/nfs4_acl.h> | ||
50 | #include <linux/sunrpc/gss_api.h> | ||
51 | 40 | ||
52 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 41 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
53 | 42 | ||
@@ -170,7 +159,7 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs | |||
170 | accmode |= NFSD_MAY_READ; | 159 | accmode |= NFSD_MAY_READ; |
171 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) | 160 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) |
172 | accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC); | 161 | accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC); |
173 | if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) | 162 | if (open->op_share_deny & NFS4_SHARE_DENY_READ) |
174 | accmode |= NFSD_MAY_WRITE; | 163 | accmode |= NFSD_MAY_WRITE; |
175 | 164 | ||
176 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); | 165 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index b5348405046b..5a754f7b71ed 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs4recover.c | ||
3 | * | ||
4 | * Copyright (c) 2004 The Regents of the University of Michigan. | 2 | * Copyright (c) 2004 The Regents of the University of Michigan. |
5 | * All rights reserved. | 3 | * All rights reserved. |
6 | * | 4 | * |
@@ -33,20 +31,14 @@ | |||
33 | * | 31 | * |
34 | */ | 32 | */ |
35 | 33 | ||
36 | #include <linux/err.h> | ||
37 | #include <linux/sunrpc/svc.h> | ||
38 | #include <linux/nfsd/nfsd.h> | ||
39 | #include <linux/nfs4.h> | ||
40 | #include <linux/nfsd/state.h> | ||
41 | #include <linux/nfsd/xdr4.h> | ||
42 | #include <linux/param.h> | ||
43 | #include <linux/file.h> | 34 | #include <linux/file.h> |
44 | #include <linux/namei.h> | 35 | #include <linux/namei.h> |
45 | #include <asm/uaccess.h> | ||
46 | #include <linux/scatterlist.h> | ||
47 | #include <linux/crypto.h> | 36 | #include <linux/crypto.h> |
48 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
49 | #include <linux/mount.h> | 38 | |
39 | #include "nfsd.h" | ||
40 | #include "state.h" | ||
41 | #include "vfs.h" | ||
50 | 42 | ||
51 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 43 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
52 | 44 | ||
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2153f9bdbebd..f19ed866c95f 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfs4state.c | ||
3 | * | ||
4 | * Copyright (c) 2001 The Regents of the University of Michigan. | 2 | * Copyright (c) 2001 The Regents of the University of Michigan. |
5 | * All rights reserved. | 3 | * All rights reserved. |
6 | * | 4 | * |
@@ -34,28 +32,14 @@ | |||
34 | * | 32 | * |
35 | */ | 33 | */ |
36 | 34 | ||
37 | #include <linux/param.h> | ||
38 | #include <linux/major.h> | ||
39 | #include <linux/slab.h> | ||
40 | |||
41 | #include <linux/sunrpc/svc.h> | ||
42 | #include <linux/nfsd/nfsd.h> | ||
43 | #include <linux/nfsd/cache.h> | ||
44 | #include <linux/file.h> | 35 | #include <linux/file.h> |
45 | #include <linux/mount.h> | ||
46 | #include <linux/workqueue.h> | ||
47 | #include <linux/smp_lock.h> | 36 | #include <linux/smp_lock.h> |
48 | #include <linux/kthread.h> | ||
49 | #include <linux/nfs4.h> | ||
50 | #include <linux/nfsd/state.h> | ||
51 | #include <linux/nfsd/xdr4.h> | ||
52 | #include <linux/namei.h> | 37 | #include <linux/namei.h> |
53 | #include <linux/swap.h> | 38 | #include <linux/swap.h> |
54 | #include <linux/mutex.h> | ||
55 | #include <linux/lockd/bind.h> | ||
56 | #include <linux/module.h> | ||
57 | #include <linux/sunrpc/svcauth_gss.h> | 39 | #include <linux/sunrpc/svcauth_gss.h> |
58 | #include <linux/sunrpc/clnt.h> | 40 | #include <linux/sunrpc/clnt.h> |
41 | #include "xdr4.h" | ||
42 | #include "vfs.h" | ||
59 | 43 | ||
60 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 44 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
61 | 45 | ||
@@ -477,13 +461,14 @@ static int set_forechannel_drc_size(struct nfsd4_channel_attrs *fchan) | |||
477 | 461 | ||
478 | /* | 462 | /* |
479 | * fchan holds the client values on input, and the server values on output | 463 | * fchan holds the client values on input, and the server values on output |
464 | * sv_max_mesg is the maximum payload plus one page for overhead. | ||
480 | */ | 465 | */ |
481 | static int init_forechannel_attrs(struct svc_rqst *rqstp, | 466 | static int init_forechannel_attrs(struct svc_rqst *rqstp, |
482 | struct nfsd4_channel_attrs *session_fchan, | 467 | struct nfsd4_channel_attrs *session_fchan, |
483 | struct nfsd4_channel_attrs *fchan) | 468 | struct nfsd4_channel_attrs *fchan) |
484 | { | 469 | { |
485 | int status = 0; | 470 | int status = 0; |
486 | __u32 maxcount = svc_max_payload(rqstp); | 471 | __u32 maxcount = nfsd_serv->sv_max_mesg; |
487 | 472 | ||
488 | /* headerpadsz set to zero in encode routine */ | 473 | /* headerpadsz set to zero in encode routine */ |
489 | 474 | ||
@@ -523,6 +508,15 @@ free_session_slots(struct nfsd4_session *ses) | |||
523 | kfree(ses->se_slots[i]); | 508 | kfree(ses->se_slots[i]); |
524 | } | 509 | } |
525 | 510 | ||
511 | /* | ||
512 | * We don't actually need to cache the rpc and session headers, so we | ||
513 | * can allocate a little less for each slot: | ||
514 | */ | ||
515 | static inline int slot_bytes(struct nfsd4_channel_attrs *ca) | ||
516 | { | ||
517 | return ca->maxresp_cached - NFSD_MIN_HDR_SEQ_SZ; | ||
518 | } | ||
519 | |||
526 | static int | 520 | static int |
527 | alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp, | 521 | alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp, |
528 | struct nfsd4_create_session *cses) | 522 | struct nfsd4_create_session *cses) |
@@ -554,7 +548,7 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp, | |||
554 | memcpy(new, &tmp, sizeof(*new)); | 548 | memcpy(new, &tmp, sizeof(*new)); |
555 | 549 | ||
556 | /* allocate each struct nfsd4_slot and data cache in one piece */ | 550 | /* allocate each struct nfsd4_slot and data cache in one piece */ |
557 | cachesize = new->se_fchannel.maxresp_cached - NFSD_MIN_HDR_SEQ_SZ; | 551 | cachesize = slot_bytes(&new->se_fchannel); |
558 | for (i = 0; i < new->se_fchannel.maxreqs; i++) { | 552 | for (i = 0; i < new->se_fchannel.maxreqs; i++) { |
559 | sp = kzalloc(sizeof(*sp) + cachesize, GFP_KERNEL); | 553 | sp = kzalloc(sizeof(*sp) + cachesize, GFP_KERNEL); |
560 | if (!sp) | 554 | if (!sp) |
@@ -628,10 +622,12 @@ void | |||
628 | free_session(struct kref *kref) | 622 | free_session(struct kref *kref) |
629 | { | 623 | { |
630 | struct nfsd4_session *ses; | 624 | struct nfsd4_session *ses; |
625 | int mem; | ||
631 | 626 | ||
632 | ses = container_of(kref, struct nfsd4_session, se_ref); | 627 | ses = container_of(kref, struct nfsd4_session, se_ref); |
633 | spin_lock(&nfsd_drc_lock); | 628 | spin_lock(&nfsd_drc_lock); |
634 | nfsd_drc_mem_used -= ses->se_fchannel.maxreqs * NFSD_SLOT_CACHE_SIZE; | 629 | mem = ses->se_fchannel.maxreqs * slot_bytes(&ses->se_fchannel); |
630 | nfsd_drc_mem_used -= mem; | ||
635 | spin_unlock(&nfsd_drc_lock); | 631 | spin_unlock(&nfsd_drc_lock); |
636 | free_session_slots(ses); | 632 | free_session_slots(ses); |
637 | kfree(ses); | 633 | kfree(ses); |
@@ -2404,11 +2400,8 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta | |||
2404 | 2400 | ||
2405 | memcpy(&open->op_delegate_stateid, &dp->dl_stateid, sizeof(dp->dl_stateid)); | 2401 | memcpy(&open->op_delegate_stateid, &dp->dl_stateid, sizeof(dp->dl_stateid)); |
2406 | 2402 | ||
2407 | dprintk("NFSD: delegation stateid=(%08x/%08x/%08x/%08x)\n\n", | 2403 | dprintk("NFSD: delegation stateid=" STATEID_FMT "\n", |
2408 | dp->dl_stateid.si_boot, | 2404 | STATEID_VAL(&dp->dl_stateid)); |
2409 | dp->dl_stateid.si_stateownerid, | ||
2410 | dp->dl_stateid.si_fileid, | ||
2411 | dp->dl_stateid.si_generation); | ||
2412 | out: | 2405 | out: |
2413 | if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS | 2406 | if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS |
2414 | && flag == NFS4_OPEN_DELEGATE_NONE | 2407 | && flag == NFS4_OPEN_DELEGATE_NONE |
@@ -2498,9 +2491,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
2498 | 2491 | ||
2499 | status = nfs_ok; | 2492 | status = nfs_ok; |
2500 | 2493 | ||
2501 | dprintk("nfs4_process_open2: stateid=(%08x/%08x/%08x/%08x)\n", | 2494 | dprintk("%s: stateid=" STATEID_FMT "\n", __func__, |
2502 | stp->st_stateid.si_boot, stp->st_stateid.si_stateownerid, | 2495 | STATEID_VAL(&stp->st_stateid)); |
2503 | stp->st_stateid.si_fileid, stp->st_stateid.si_generation); | ||
2504 | out: | 2496 | out: |
2505 | if (fp) | 2497 | if (fp) |
2506 | put_nfs4_file(fp); | 2498 | put_nfs4_file(fp); |
@@ -2666,9 +2658,8 @@ STALE_STATEID(stateid_t *stateid) | |||
2666 | { | 2658 | { |
2667 | if (time_after((unsigned long)boot_time, | 2659 | if (time_after((unsigned long)boot_time, |
2668 | (unsigned long)stateid->si_boot)) { | 2660 | (unsigned long)stateid->si_boot)) { |
2669 | dprintk("NFSD: stale stateid (%08x/%08x/%08x/%08x)!\n", | 2661 | dprintk("NFSD: stale stateid " STATEID_FMT "!\n", |
2670 | stateid->si_boot, stateid->si_stateownerid, | 2662 | STATEID_VAL(stateid)); |
2671 | stateid->si_fileid, stateid->si_generation); | ||
2672 | return 1; | 2663 | return 1; |
2673 | } | 2664 | } |
2674 | return 0; | 2665 | return 0; |
@@ -2680,9 +2671,8 @@ EXPIRED_STATEID(stateid_t *stateid) | |||
2680 | if (time_before((unsigned long)boot_time, | 2671 | if (time_before((unsigned long)boot_time, |
2681 | ((unsigned long)stateid->si_boot)) && | 2672 | ((unsigned long)stateid->si_boot)) && |
2682 | time_before((unsigned long)(stateid->si_boot + lease_time), get_seconds())) { | 2673 | time_before((unsigned long)(stateid->si_boot + lease_time), get_seconds())) { |
2683 | dprintk("NFSD: expired stateid (%08x/%08x/%08x/%08x)!\n", | 2674 | dprintk("NFSD: expired stateid " STATEID_FMT "!\n", |
2684 | stateid->si_boot, stateid->si_stateownerid, | 2675 | STATEID_VAL(stateid)); |
2685 | stateid->si_fileid, stateid->si_generation); | ||
2686 | return 1; | 2676 | return 1; |
2687 | } | 2677 | } |
2688 | return 0; | 2678 | return 0; |
@@ -2696,9 +2686,8 @@ stateid_error_map(stateid_t *stateid) | |||
2696 | if (EXPIRED_STATEID(stateid)) | 2686 | if (EXPIRED_STATEID(stateid)) |
2697 | return nfserr_expired; | 2687 | return nfserr_expired; |
2698 | 2688 | ||
2699 | dprintk("NFSD: bad stateid (%08x/%08x/%08x/%08x)!\n", | 2689 | dprintk("NFSD: bad stateid " STATEID_FMT "!\n", |
2700 | stateid->si_boot, stateid->si_stateownerid, | 2690 | STATEID_VAL(stateid)); |
2701 | stateid->si_fileid, stateid->si_generation); | ||
2702 | return nfserr_bad_stateid; | 2691 | return nfserr_bad_stateid; |
2703 | } | 2692 | } |
2704 | 2693 | ||
@@ -2884,10 +2873,8 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
2884 | struct svc_fh *current_fh = &cstate->current_fh; | 2873 | struct svc_fh *current_fh = &cstate->current_fh; |
2885 | __be32 status; | 2874 | __be32 status; |
2886 | 2875 | ||
2887 | dprintk("NFSD: preprocess_seqid_op: seqid=%d " | 2876 | dprintk("NFSD: %s: seqid=%d stateid = " STATEID_FMT "\n", __func__, |
2888 | "stateid = (%08x/%08x/%08x/%08x)\n", seqid, | 2877 | seqid, STATEID_VAL(stateid)); |
2889 | stateid->si_boot, stateid->si_stateownerid, stateid->si_fileid, | ||
2890 | stateid->si_generation); | ||
2891 | 2878 | ||
2892 | *stpp = NULL; | 2879 | *stpp = NULL; |
2893 | *sopp = NULL; | 2880 | *sopp = NULL; |
@@ -3019,12 +3006,8 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3019 | sop->so_confirmed = 1; | 3006 | sop->so_confirmed = 1; |
3020 | update_stateid(&stp->st_stateid); | 3007 | update_stateid(&stp->st_stateid); |
3021 | memcpy(&oc->oc_resp_stateid, &stp->st_stateid, sizeof(stateid_t)); | 3008 | memcpy(&oc->oc_resp_stateid, &stp->st_stateid, sizeof(stateid_t)); |
3022 | dprintk("NFSD: nfsd4_open_confirm: success, seqid=%d " | 3009 | dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n", |
3023 | "stateid=(%08x/%08x/%08x/%08x)\n", oc->oc_seqid, | 3010 | __func__, oc->oc_seqid, STATEID_VAL(&stp->st_stateid)); |
3024 | stp->st_stateid.si_boot, | ||
3025 | stp->st_stateid.si_stateownerid, | ||
3026 | stp->st_stateid.si_fileid, | ||
3027 | stp->st_stateid.si_generation); | ||
3028 | 3011 | ||
3029 | nfsd4_create_clid_dir(sop->so_client); | 3012 | nfsd4_create_clid_dir(sop->so_client); |
3030 | out: | 3013 | out: |
@@ -3283,9 +3266,8 @@ find_delegation_stateid(struct inode *ino, stateid_t *stid) | |||
3283 | struct nfs4_file *fp; | 3266 | struct nfs4_file *fp; |
3284 | struct nfs4_delegation *dl; | 3267 | struct nfs4_delegation *dl; |
3285 | 3268 | ||
3286 | dprintk("NFSD:find_delegation_stateid stateid=(%08x/%08x/%08x/%08x)\n", | 3269 | dprintk("NFSD: %s: stateid=" STATEID_FMT "\n", __func__, |
3287 | stid->si_boot, stid->si_stateownerid, | 3270 | STATEID_VAL(stid)); |
3288 | stid->si_fileid, stid->si_generation); | ||
3289 | 3271 | ||
3290 | fp = find_file(ino); | 3272 | fp = find_file(ino); |
3291 | if (!fp) | 3273 | if (!fp) |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 0fbd50cee1f6..a8587e90fd5a 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -40,24 +40,16 @@ | |||
40 | * at the end of nfs4svc_decode_compoundargs. | 40 | * at the end of nfs4svc_decode_compoundargs. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/param.h> | ||
44 | #include <linux/smp.h> | ||
45 | #include <linux/fs.h> | ||
46 | #include <linux/namei.h> | 43 | #include <linux/namei.h> |
47 | #include <linux/vfs.h> | 44 | #include <linux/statfs.h> |
48 | #include <linux/utsname.h> | 45 | #include <linux/utsname.h> |
49 | #include <linux/sunrpc/xdr.h> | ||
50 | #include <linux/sunrpc/svc.h> | ||
51 | #include <linux/sunrpc/clnt.h> | ||
52 | #include <linux/nfsd/nfsd.h> | ||
53 | #include <linux/nfsd/state.h> | ||
54 | #include <linux/nfsd/xdr4.h> | ||
55 | #include <linux/nfsd_idmap.h> | 46 | #include <linux/nfsd_idmap.h> |
56 | #include <linux/nfs4.h> | ||
57 | #include <linux/nfs4_acl.h> | 47 | #include <linux/nfs4_acl.h> |
58 | #include <linux/sunrpc/gss_api.h> | ||
59 | #include <linux/sunrpc/svcauth_gss.h> | 48 | #include <linux/sunrpc/svcauth_gss.h> |
60 | 49 | ||
50 | #include "xdr4.h" | ||
51 | #include "vfs.h" | ||
52 | |||
61 | #define NFSDDBG_FACILITY NFSDDBG_XDR | 53 | #define NFSDDBG_FACILITY NFSDDBG_XDR |
62 | 54 | ||
63 | /* | 55 | /* |
@@ -2204,11 +2196,14 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, | |||
2204 | * we will not follow the cross mount and will fill the attribtutes | 2196 | * we will not follow the cross mount and will fill the attribtutes |
2205 | * directly from the mountpoint dentry. | 2197 | * directly from the mountpoint dentry. |
2206 | */ | 2198 | */ |
2207 | if (d_mountpoint(dentry) && !attributes_need_mount(cd->rd_bmval)) | 2199 | if (nfsd_mountpoint(dentry, exp)) { |
2208 | ignore_crossmnt = 1; | ||
2209 | else if (d_mountpoint(dentry)) { | ||
2210 | int err; | 2200 | int err; |
2211 | 2201 | ||
2202 | if (!(exp->ex_flags & NFSEXP_V4ROOT) | ||
2203 | && !attributes_need_mount(cd->rd_bmval)) { | ||
2204 | ignore_crossmnt = 1; | ||
2205 | goto out_encode; | ||
2206 | } | ||
2212 | /* | 2207 | /* |
2213 | * Why the heck aren't we just using nfsd_lookup?? | 2208 | * Why the heck aren't we just using nfsd_lookup?? |
2214 | * Different "."/".." handling? Something else? | 2209 | * Different "."/".." handling? Something else? |
@@ -2224,6 +2219,7 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, | |||
2224 | goto out_put; | 2219 | goto out_put; |
2225 | 2220 | ||
2226 | } | 2221 | } |
2222 | out_encode: | ||
2227 | nfserr = nfsd4_encode_fattr(NULL, exp, dentry, p, buflen, cd->rd_bmval, | 2223 | nfserr = nfsd4_encode_fattr(NULL, exp, dentry, p, buflen, cd->rd_bmval, |
2228 | cd->rd_rqstp, ignore_crossmnt); | 2224 | cd->rd_rqstp, ignore_crossmnt); |
2229 | out_put: | 2225 | out_put: |
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 4638635c5d87..da08560c4818 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfscache.c | ||
3 | * | ||
4 | * Request reply cache. This is currently a global cache, but this may | 2 | * Request reply cache. This is currently a global cache, but this may |
5 | * change in the future and be a per-client cache. | 3 | * change in the future and be a per-client cache. |
6 | * | 4 | * |
@@ -10,16 +8,8 @@ | |||
10 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 8 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
11 | */ | 9 | */ |
12 | 10 | ||
13 | #include <linux/kernel.h> | 11 | #include "nfsd.h" |
14 | #include <linux/time.h> | 12 | #include "cache.h" |
15 | #include <linux/slab.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <linux/list.h> | ||
19 | |||
20 | #include <linux/sunrpc/svc.h> | ||
21 | #include <linux/nfsd/nfsd.h> | ||
22 | #include <linux/nfsd/cache.h> | ||
23 | 13 | ||
24 | /* Size of reply cache. Common values are: | 14 | /* Size of reply cache. Common values are: |
25 | * 4.3BSD: 128 | 15 | * 4.3BSD: 128 |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 5c01fc148ce8..2604c3e70ea5 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -1,46 +1,20 @@ | |||
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> | 7 | #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> | ||
22 | #include <linux/proc_fs.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> | 8 | #include <linux/ctype.h> |
29 | 9 | ||
30 | #include <linux/nfs.h> | ||
31 | #include <linux/nfsd_idmap.h> | 10 | #include <linux/nfsd_idmap.h> |
32 | #include <linux/lockd/bind.h> | ||
33 | #include <linux/sunrpc/svc.h> | ||
34 | #include <linux/sunrpc/svcsock.h> | 11 | #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> | 12 | #include <linux/nfsd/syscall.h> |
39 | #include <linux/lockd/lockd.h> | 13 | #include <linux/lockd/lockd.h> |
40 | #include <linux/sunrpc/clnt.h> | 14 | #include <linux/sunrpc/clnt.h> |
41 | 15 | ||
42 | #include <asm/uaccess.h> | 16 | #include "nfsd.h" |
43 | #include <net/ipv6.h> | 17 | #include "cache.h" |
44 | 18 | ||
45 | /* | 19 | /* |
46 | * We have a single directory with 9 nodes in it. | 20 | * We have a single directory with 9 nodes in it. |
@@ -55,6 +29,7 @@ enum { | |||
55 | NFSD_Getfd, | 29 | NFSD_Getfd, |
56 | NFSD_Getfs, | 30 | NFSD_Getfs, |
57 | NFSD_List, | 31 | NFSD_List, |
32 | NFSD_Export_features, | ||
58 | NFSD_Fh, | 33 | NFSD_Fh, |
59 | NFSD_FO_UnlockIP, | 34 | NFSD_FO_UnlockIP, |
60 | NFSD_FO_UnlockFS, | 35 | NFSD_FO_UnlockFS, |
@@ -173,6 +148,24 @@ static const struct file_operations exports_operations = { | |||
173 | .owner = THIS_MODULE, | 148 | .owner = THIS_MODULE, |
174 | }; | 149 | }; |
175 | 150 | ||
151 | static int export_features_show(struct seq_file *m, void *v) | ||
152 | { | ||
153 | seq_printf(m, "0x%x 0x%x\n", NFSEXP_ALLFLAGS, NFSEXP_SECINFO_FLAGS); | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static int export_features_open(struct inode *inode, struct file *file) | ||
158 | { | ||
159 | return single_open(file, export_features_show, NULL); | ||
160 | } | ||
161 | |||
162 | static struct file_operations export_features_operations = { | ||
163 | .open = export_features_open, | ||
164 | .read = seq_read, | ||
165 | .llseek = seq_lseek, | ||
166 | .release = single_release, | ||
167 | }; | ||
168 | |||
176 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); | 169 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); |
177 | extern int nfsd_pool_stats_release(struct inode *inode, struct file *file); | 170 | extern int nfsd_pool_stats_release(struct inode *inode, struct file *file); |
178 | 171 | ||
@@ -1330,6 +1323,8 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
1330 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, | 1323 | [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, |
1331 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, | 1324 | [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, |
1332 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, | 1325 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, |
1326 | [NFSD_Export_features] = {"export_features", | ||
1327 | &export_features_operations, S_IRUGO}, | ||
1333 | [NFSD_FO_UnlockIP] = {"unlock_ip", | 1328 | [NFSD_FO_UnlockIP] = {"unlock_ip", |
1334 | &transaction_ops, S_IWUSR|S_IRUSR}, | 1329 | &transaction_ops, S_IWUSR|S_IRUSR}, |
1335 | [NFSD_FO_UnlockFS] = {"unlock_filesystem", | 1330 | [NFSD_FO_UnlockFS] = {"unlock_filesystem", |
diff --git a/include/linux/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 510ffdd5020e..e942a1aaac92 100644 --- a/include/linux/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/nfsd/nfsd.h | ||
3 | * | ||
4 | * Hodge-podge collection of knfsd-related stuff. | 2 | * Hodge-podge collection of knfsd-related stuff. |
5 | * I will sort this out later. | 3 | * I will sort this out later. |
6 | * | 4 | * |
@@ -11,13 +9,9 @@ | |||
11 | #define LINUX_NFSD_NFSD_H | 9 | #define LINUX_NFSD_NFSD_H |
12 | 10 | ||
13 | #include <linux/types.h> | 11 | #include <linux/types.h> |
14 | #include <linux/unistd.h> | ||
15 | #include <linux/fs.h> | ||
16 | #include <linux/posix_acl.h> | ||
17 | #include <linux/mount.h> | 12 | #include <linux/mount.h> |
18 | 13 | ||
19 | #include <linux/nfsd/debug.h> | 14 | #include <linux/nfsd/debug.h> |
20 | #include <linux/nfsd/nfsfh.h> | ||
21 | #include <linux/nfsd/export.h> | 15 | #include <linux/nfsd/export.h> |
22 | #include <linux/nfsd/stats.h> | 16 | #include <linux/nfsd/stats.h> |
23 | /* | 17 | /* |
@@ -25,30 +19,10 @@ | |||
25 | */ | 19 | */ |
26 | #define NFSD_SUPPORTED_MINOR_VERSION 1 | 20 | #define NFSD_SUPPORTED_MINOR_VERSION 1 |
27 | 21 | ||
28 | /* | ||
29 | * Flags for nfsd_permission | ||
30 | */ | ||
31 | #define NFSD_MAY_NOP 0 | ||
32 | #define NFSD_MAY_EXEC 1 /* == MAY_EXEC */ | ||
33 | #define NFSD_MAY_WRITE 2 /* == MAY_WRITE */ | ||
34 | #define NFSD_MAY_READ 4 /* == MAY_READ */ | ||
35 | #define NFSD_MAY_SATTR 8 | ||
36 | #define NFSD_MAY_TRUNC 16 | ||
37 | #define NFSD_MAY_LOCK 32 | ||
38 | #define NFSD_MAY_OWNER_OVERRIDE 64 | ||
39 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | ||
40 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 | ||
41 | |||
42 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | ||
43 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | ||
44 | |||
45 | /* | ||
46 | * Callback function for readdir | ||
47 | */ | ||
48 | struct readdir_cd { | 22 | struct readdir_cd { |
49 | __be32 err; /* 0, nfserr, or nfserr_eof */ | 23 | __be32 err; /* 0, nfserr, or nfserr_eof */ |
50 | }; | 24 | }; |
51 | typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | 25 | |
52 | 26 | ||
53 | extern struct svc_program nfsd_program; | 27 | extern struct svc_program nfsd_program; |
54 | extern struct svc_version nfsd_version2, nfsd_version3, | 28 | extern struct svc_version nfsd_version2, nfsd_version3, |
@@ -73,69 +47,6 @@ int nfsd_nrpools(void); | |||
73 | int nfsd_get_nrthreads(int n, int *); | 47 | int nfsd_get_nrthreads(int n, int *); |
74 | int nfsd_set_nrthreads(int n, int *); | 48 | int nfsd_set_nrthreads(int n, int *); |
75 | 49 | ||
76 | /* nfsd/vfs.c */ | ||
77 | int fh_lock_parent(struct svc_fh *, struct dentry *); | ||
78 | int nfsd_racache_init(int); | ||
79 | void nfsd_racache_shutdown(void); | ||
80 | int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | ||
81 | struct svc_export **expp); | ||
82 | __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, | ||
83 | const char *, unsigned int, struct svc_fh *); | ||
84 | __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, | ||
85 | const char *, unsigned int, | ||
86 | struct svc_export **, struct dentry **); | ||
87 | __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, | ||
88 | struct iattr *, int, time_t); | ||
89 | #ifdef CONFIG_NFSD_V4 | ||
90 | __be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, | ||
91 | struct nfs4_acl *); | ||
92 | int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); | ||
93 | #endif /* CONFIG_NFSD_V4 */ | ||
94 | __be32 nfsd_create(struct svc_rqst *, struct svc_fh *, | ||
95 | char *name, int len, struct iattr *attrs, | ||
96 | int type, dev_t rdev, struct svc_fh *res); | ||
97 | #ifdef CONFIG_NFSD_V3 | ||
98 | __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); | ||
99 | __be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *, | ||
100 | char *name, int len, struct iattr *attrs, | ||
101 | struct svc_fh *res, int createmode, | ||
102 | u32 *verifier, int *truncp, int *created); | ||
103 | __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, | ||
104 | loff_t, unsigned long); | ||
105 | #endif /* CONFIG_NFSD_V3 */ | ||
106 | __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, | ||
107 | int, struct file **); | ||
108 | void nfsd_close(struct file *); | ||
109 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, | ||
110 | loff_t, struct kvec *, int, unsigned long *); | ||
111 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, | ||
112 | loff_t, struct kvec *,int, unsigned long *, int *); | ||
113 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, | ||
114 | char *, int *); | ||
115 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, | ||
116 | char *name, int len, char *path, int plen, | ||
117 | struct svc_fh *res, struct iattr *); | ||
118 | __be32 nfsd_link(struct svc_rqst *, struct svc_fh *, | ||
119 | char *, int, struct svc_fh *); | ||
120 | __be32 nfsd_rename(struct svc_rqst *, | ||
121 | struct svc_fh *, char *, int, | ||
122 | struct svc_fh *, char *, int); | ||
123 | __be32 nfsd_remove(struct svc_rqst *, | ||
124 | struct svc_fh *, char *, int); | ||
125 | __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, | ||
126 | char *name, int len); | ||
127 | int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | ||
128 | unsigned long size); | ||
129 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | ||
130 | loff_t *, struct readdir_cd *, filldir_t); | ||
131 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | ||
132 | struct kstatfs *, int access); | ||
133 | |||
134 | int nfsd_notify_change(struct inode *, struct iattr *); | ||
135 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | ||
136 | struct dentry *, int); | ||
137 | int nfsd_sync_dir(struct dentry *dp); | ||
138 | |||
139 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | 50 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) |
140 | #ifdef CONFIG_NFSD_V2_ACL | 51 | #ifdef CONFIG_NFSD_V2_ACL |
141 | extern struct svc_version nfsd_acl_version2; | 52 | extern struct svc_version nfsd_acl_version2; |
@@ -147,8 +58,6 @@ extern struct svc_version nfsd_acl_version3; | |||
147 | #else | 58 | #else |
148 | #define nfsd_acl_version3 NULL | 59 | #define nfsd_acl_version3 NULL |
149 | #endif | 60 | #endif |
150 | struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | ||
151 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | ||
152 | #endif | 61 | #endif |
153 | 62 | ||
154 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; | 63 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; |
@@ -159,6 +68,11 @@ int nfsd_create_serv(void); | |||
159 | 68 | ||
160 | extern int nfsd_max_blksize; | 69 | extern int nfsd_max_blksize; |
161 | 70 | ||
71 | static inline int nfsd_v4client(struct svc_rqst *rq) | ||
72 | { | ||
73 | return rq->rq_prog == NFS_PROGRAM && rq->rq_vers == 4; | ||
74 | } | ||
75 | |||
162 | /* | 76 | /* |
163 | * NFSv4 State | 77 | * NFSv4 State |
164 | */ | 78 | */ |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 01965b2f3a76..1c12177b908c 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfsfh.c | ||
3 | * | ||
4 | * NFS server file handle treatment. | 2 | * NFS server file handle treatment. |
5 | * | 3 | * |
6 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
@@ -9,19 +7,11 @@ | |||
9 | * ... and again Southern-Winter 2001 to support export_operations | 7 | * ... and again Southern-Winter 2001 to support export_operations |
10 | */ | 8 | */ |
11 | 9 | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/fs.h> | ||
14 | #include <linux/unistd.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/stat.h> | ||
17 | #include <linux/dcache.h> | ||
18 | #include <linux/exportfs.h> | 10 | #include <linux/exportfs.h> |
19 | #include <linux/mount.h> | ||
20 | 11 | ||
21 | #include <linux/sunrpc/clnt.h> | ||
22 | #include <linux/sunrpc/svc.h> | ||
23 | #include <linux/sunrpc/svcauth_gss.h> | 12 | #include <linux/sunrpc/svcauth_gss.h> |
24 | #include <linux/nfsd/nfsd.h> | 13 | #include "nfsd.h" |
14 | #include "vfs.h" | ||
25 | #include "auth.h" | 15 | #include "auth.h" |
26 | 16 | ||
27 | #define NFSDDBG_FACILITY NFSDDBG_FH | 17 | #define NFSDDBG_FACILITY NFSDDBG_FH |
@@ -96,8 +86,10 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) | |||
96 | static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp, | 86 | static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp, |
97 | struct svc_export *exp) | 87 | struct svc_export *exp) |
98 | { | 88 | { |
89 | int flags = nfsexp_flags(rqstp, exp); | ||
90 | |||
99 | /* Check if the request originated from a secure port. */ | 91 | /* Check if the request originated from a secure port. */ |
100 | if (!rqstp->rq_secure && EX_SECURE(exp)) { | 92 | if (!rqstp->rq_secure && (flags & NFSEXP_INSECURE_PORT)) { |
101 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | 93 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); |
102 | dprintk(KERN_WARNING | 94 | dprintk(KERN_WARNING |
103 | "nfsd: request from insecure port %s!\n", | 95 | "nfsd: request from insecure port %s!\n", |
@@ -109,6 +101,36 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp, | |||
109 | return nfserrno(nfsd_setuser(rqstp, exp)); | 101 | return nfserrno(nfsd_setuser(rqstp, exp)); |
110 | } | 102 | } |
111 | 103 | ||
104 | static inline __be32 check_pseudo_root(struct svc_rqst *rqstp, | ||
105 | struct dentry *dentry, struct svc_export *exp) | ||
106 | { | ||
107 | if (!(exp->ex_flags & NFSEXP_V4ROOT)) | ||
108 | return nfs_ok; | ||
109 | /* | ||
110 | * v2/v3 clients have no need for the V4ROOT export--they use | ||
111 | * the mount protocl instead; also, further V4ROOT checks may be | ||
112 | * in v4-specific code, in which case v2/v3 clients could bypass | ||
113 | * them. | ||
114 | */ | ||
115 | if (!nfsd_v4client(rqstp)) | ||
116 | return nfserr_stale; | ||
117 | /* | ||
118 | * We're exposing only the directories and symlinks that have to be | ||
119 | * traversed on the way to real exports: | ||
120 | */ | ||
121 | if (unlikely(!S_ISDIR(dentry->d_inode->i_mode) && | ||
122 | !S_ISLNK(dentry->d_inode->i_mode))) | ||
123 | return nfserr_stale; | ||
124 | /* | ||
125 | * A pseudoroot export gives permission to access only one | ||
126 | * single directory; the kernel has to make another upcall | ||
127 | * before granting access to anything else under it: | ||
128 | */ | ||
129 | if (unlikely(dentry != exp->ex_path.dentry)) | ||
130 | return nfserr_stale; | ||
131 | return nfs_ok; | ||
132 | } | ||
133 | |||
112 | /* | 134 | /* |
113 | * Use the given filehandle to look up the corresponding export and | 135 | * Use the given filehandle to look up the corresponding export and |
114 | * dentry. On success, the results are used to set fh_export and | 136 | * dentry. On success, the results are used to set fh_export and |
@@ -232,14 +254,6 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) | |||
232 | goto out; | 254 | goto out; |
233 | } | 255 | } |
234 | 256 | ||
235 | if (exp->ex_flags & NFSEXP_NOSUBTREECHECK) { | ||
236 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
237 | if (error) { | ||
238 | dput(dentry); | ||
239 | goto out; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | if (S_ISDIR(dentry->d_inode->i_mode) && | 257 | if (S_ISDIR(dentry->d_inode->i_mode) && |
244 | (dentry->d_flags & DCACHE_DISCONNECTED)) { | 258 | (dentry->d_flags & DCACHE_DISCONNECTED)) { |
245 | printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", | 259 | printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", |
@@ -294,28 +308,32 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
294 | error = nfsd_set_fh_dentry(rqstp, fhp); | 308 | error = nfsd_set_fh_dentry(rqstp, fhp); |
295 | if (error) | 309 | if (error) |
296 | goto out; | 310 | goto out; |
297 | dentry = fhp->fh_dentry; | ||
298 | exp = fhp->fh_export; | ||
299 | } else { | ||
300 | /* | ||
301 | * just rechecking permissions | ||
302 | * (e.g. nfsproc_create calls fh_verify, then nfsd_create | ||
303 | * does as well) | ||
304 | */ | ||
305 | dprintk("nfsd: fh_verify - just checking\n"); | ||
306 | dentry = fhp->fh_dentry; | ||
307 | exp = fhp->fh_export; | ||
308 | /* | ||
309 | * Set user creds for this exportpoint; necessary even | ||
310 | * in the "just checking" case because this may be a | ||
311 | * filehandle that was created by fh_compose, and that | ||
312 | * is about to be used in another nfsv4 compound | ||
313 | * operation. | ||
314 | */ | ||
315 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
316 | if (error) | ||
317 | goto out; | ||
318 | } | 311 | } |
312 | dentry = fhp->fh_dentry; | ||
313 | exp = fhp->fh_export; | ||
314 | /* | ||
315 | * We still have to do all these permission checks, even when | ||
316 | * fh_dentry is already set: | ||
317 | * - fh_verify may be called multiple times with different | ||
318 | * "access" arguments (e.g. nfsd_proc_create calls | ||
319 | * fh_verify(...,NFSD_MAY_EXEC) first, then later (in | ||
320 | * nfsd_create) calls fh_verify(...,NFSD_MAY_CREATE). | ||
321 | * - in the NFSv4 case, the filehandle may have been filled | ||
322 | * in by fh_compose, and given a dentry, but further | ||
323 | * compound operations performed with that filehandle | ||
324 | * still need permissions checks. In the worst case, a | ||
325 | * mountpoint crossing may have changed the export | ||
326 | * options, and we may now need to use a different uid | ||
327 | * (for example, if different id-squashing options are in | ||
328 | * effect on the new filesystem). | ||
329 | */ | ||
330 | error = check_pseudo_root(rqstp, dentry, exp); | ||
331 | if (error) | ||
332 | goto out; | ||
333 | |||
334 | error = nfsd_setuser_and_check_port(rqstp, exp); | ||
335 | if (error) | ||
336 | goto out; | ||
319 | 337 | ||
320 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 338 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); |
321 | if (error) | 339 | if (error) |
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h new file mode 100644 index 000000000000..cdfb8c6a4206 --- /dev/null +++ b/fs/nfsd/nfsfh.h | |||
@@ -0,0 +1,208 @@ | |||
1 | /* Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> */ | ||
2 | |||
3 | #ifndef _LINUX_NFSD_FH_INT_H | ||
4 | #define _LINUX_NFSD_FH_INT_H | ||
5 | |||
6 | #include <linux/nfsd/nfsfh.h> | ||
7 | |||
8 | enum nfsd_fsid { | ||
9 | FSID_DEV = 0, | ||
10 | FSID_NUM, | ||
11 | FSID_MAJOR_MINOR, | ||
12 | FSID_ENCODE_DEV, | ||
13 | FSID_UUID4_INUM, | ||
14 | FSID_UUID8, | ||
15 | FSID_UUID16, | ||
16 | FSID_UUID16_INUM, | ||
17 | }; | ||
18 | |||
19 | enum fsid_source { | ||
20 | FSIDSOURCE_DEV, | ||
21 | FSIDSOURCE_FSID, | ||
22 | FSIDSOURCE_UUID, | ||
23 | }; | ||
24 | extern enum fsid_source fsid_source(struct svc_fh *fhp); | ||
25 | |||
26 | |||
27 | /* This might look a little large to "inline" but in all calls except | ||
28 | * one, 'vers' is constant so moste of the function disappears. | ||
29 | */ | ||
30 | static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino, | ||
31 | u32 fsid, unsigned char *uuid) | ||
32 | { | ||
33 | u32 *up; | ||
34 | switch(vers) { | ||
35 | case FSID_DEV: | ||
36 | fsidv[0] = htonl((MAJOR(dev)<<16) | | ||
37 | MINOR(dev)); | ||
38 | fsidv[1] = ino_t_to_u32(ino); | ||
39 | break; | ||
40 | case FSID_NUM: | ||
41 | fsidv[0] = fsid; | ||
42 | break; | ||
43 | case FSID_MAJOR_MINOR: | ||
44 | fsidv[0] = htonl(MAJOR(dev)); | ||
45 | fsidv[1] = htonl(MINOR(dev)); | ||
46 | fsidv[2] = ino_t_to_u32(ino); | ||
47 | break; | ||
48 | |||
49 | case FSID_ENCODE_DEV: | ||
50 | fsidv[0] = new_encode_dev(dev); | ||
51 | fsidv[1] = ino_t_to_u32(ino); | ||
52 | break; | ||
53 | |||
54 | case FSID_UUID4_INUM: | ||
55 | /* 4 byte fsid and inode number */ | ||
56 | up = (u32*)uuid; | ||
57 | fsidv[0] = ino_t_to_u32(ino); | ||
58 | fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3]; | ||
59 | break; | ||
60 | |||
61 | case FSID_UUID8: | ||
62 | /* 8 byte fsid */ | ||
63 | up = (u32*)uuid; | ||
64 | fsidv[0] = up[0] ^ up[2]; | ||
65 | fsidv[1] = up[1] ^ up[3]; | ||
66 | break; | ||
67 | |||
68 | case FSID_UUID16: | ||
69 | /* 16 byte fsid - NFSv3+ only */ | ||
70 | memcpy(fsidv, uuid, 16); | ||
71 | break; | ||
72 | |||
73 | case FSID_UUID16_INUM: | ||
74 | /* 8 byte inode and 16 byte fsid */ | ||
75 | *(u64*)fsidv = (u64)ino; | ||
76 | memcpy(fsidv+2, uuid, 16); | ||
77 | break; | ||
78 | default: BUG(); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | static inline int key_len(int type) | ||
83 | { | ||
84 | switch(type) { | ||
85 | case FSID_DEV: return 8; | ||
86 | case FSID_NUM: return 4; | ||
87 | case FSID_MAJOR_MINOR: return 12; | ||
88 | case FSID_ENCODE_DEV: return 8; | ||
89 | case FSID_UUID4_INUM: return 8; | ||
90 | case FSID_UUID8: return 8; | ||
91 | case FSID_UUID16: return 16; | ||
92 | case FSID_UUID16_INUM: return 24; | ||
93 | default: return 0; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Shorthand for dprintk()'s | ||
99 | */ | ||
100 | extern char * SVCFH_fmt(struct svc_fh *fhp); | ||
101 | |||
102 | /* | ||
103 | * Function prototypes | ||
104 | */ | ||
105 | __be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); | ||
106 | __be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); | ||
107 | __be32 fh_update(struct svc_fh *); | ||
108 | void fh_put(struct svc_fh *); | ||
109 | |||
110 | static __inline__ struct svc_fh * | ||
111 | fh_copy(struct svc_fh *dst, struct svc_fh *src) | ||
112 | { | ||
113 | WARN_ON(src->fh_dentry || src->fh_locked); | ||
114 | |||
115 | *dst = *src; | ||
116 | return dst; | ||
117 | } | ||
118 | |||
119 | static inline void | ||
120 | fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) | ||
121 | { | ||
122 | dst->fh_size = src->fh_size; | ||
123 | memcpy(&dst->fh_base, &src->fh_base, src->fh_size); | ||
124 | } | ||
125 | |||
126 | static __inline__ struct svc_fh * | ||
127 | fh_init(struct svc_fh *fhp, int maxsize) | ||
128 | { | ||
129 | memset(fhp, 0, sizeof(*fhp)); | ||
130 | fhp->fh_maxsize = maxsize; | ||
131 | return fhp; | ||
132 | } | ||
133 | |||
134 | #ifdef CONFIG_NFSD_V3 | ||
135 | /* | ||
136 | * Fill in the pre_op attr for the wcc data | ||
137 | */ | ||
138 | static inline void | ||
139 | fill_pre_wcc(struct svc_fh *fhp) | ||
140 | { | ||
141 | struct inode *inode; | ||
142 | |||
143 | inode = fhp->fh_dentry->d_inode; | ||
144 | if (!fhp->fh_pre_saved) { | ||
145 | fhp->fh_pre_mtime = inode->i_mtime; | ||
146 | fhp->fh_pre_ctime = inode->i_ctime; | ||
147 | fhp->fh_pre_size = inode->i_size; | ||
148 | fhp->fh_pre_change = inode->i_version; | ||
149 | fhp->fh_pre_saved = 1; | ||
150 | } | ||
151 | } | ||
152 | |||
153 | extern void fill_post_wcc(struct svc_fh *); | ||
154 | #else | ||
155 | #define fill_pre_wcc(ignored) | ||
156 | #define fill_post_wcc(notused) | ||
157 | #endif /* CONFIG_NFSD_V3 */ | ||
158 | |||
159 | |||
160 | /* | ||
161 | * Lock a file handle/inode | ||
162 | * NOTE: both fh_lock and fh_unlock are done "by hand" in | ||
163 | * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once | ||
164 | * so, any changes here should be reflected there. | ||
165 | */ | ||
166 | |||
167 | static inline void | ||
168 | fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) | ||
169 | { | ||
170 | struct dentry *dentry = fhp->fh_dentry; | ||
171 | struct inode *inode; | ||
172 | |||
173 | BUG_ON(!dentry); | ||
174 | |||
175 | if (fhp->fh_locked) { | ||
176 | printk(KERN_WARNING "fh_lock: %s/%s already locked!\n", | ||
177 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
178 | return; | ||
179 | } | ||
180 | |||
181 | inode = dentry->d_inode; | ||
182 | mutex_lock_nested(&inode->i_mutex, subclass); | ||
183 | fill_pre_wcc(fhp); | ||
184 | fhp->fh_locked = 1; | ||
185 | } | ||
186 | |||
187 | static inline void | ||
188 | fh_lock(struct svc_fh *fhp) | ||
189 | { | ||
190 | fh_lock_nested(fhp, I_MUTEX_NORMAL); | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * Unlock a file handle/inode | ||
195 | */ | ||
196 | static inline void | ||
197 | fh_unlock(struct svc_fh *fhp) | ||
198 | { | ||
199 | BUG_ON(!fhp->fh_dentry); | ||
200 | |||
201 | if (fhp->fh_locked) { | ||
202 | fill_post_wcc(fhp); | ||
203 | mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); | ||
204 | fhp->fh_locked = 0; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | #endif /* _LINUX_NFSD_FH_INT_H */ | ||
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 0eb9c820b7a6..a047ad6111ef 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -1,29 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * nfsproc2.c Process version 2 NFS requests. | ||
3 | * linux/fs/nfsd/nfs2proc.c | ||
4 | * | ||
5 | * Process version 2 NFS requests. | 2 | * Process version 2 NFS requests. |
6 | * | 3 | * |
7 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> |
8 | */ | 5 | */ |
9 | 6 | ||
10 | #include <linux/linkage.h> | ||
11 | #include <linux/time.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/fs.h> | ||
14 | #include <linux/stat.h> | ||
15 | #include <linux/fcntl.h> | ||
16 | #include <linux/net.h> | ||
17 | #include <linux/in.h> | ||
18 | #include <linux/namei.h> | 7 | #include <linux/namei.h> |
19 | #include <linux/unistd.h> | ||
20 | #include <linux/slab.h> | ||
21 | 8 | ||
22 | #include <linux/sunrpc/clnt.h> | 9 | #include "cache.h" |
23 | #include <linux/sunrpc/svc.h> | 10 | #include "xdr.h" |
24 | #include <linux/nfsd/nfsd.h> | 11 | #include "vfs.h" |
25 | #include <linux/nfsd/cache.h> | ||
26 | #include <linux/nfsd/xdr.h> | ||
27 | 12 | ||
28 | typedef struct svc_rqst svc_rqst; | 13 | typedef struct svc_rqst svc_rqst; |
29 | typedef struct svc_buf svc_buf; | 14 | typedef struct svc_buf svc_buf; |
@@ -758,6 +743,7 @@ nfserrno (int errno) | |||
758 | { nfserr_io, -ETXTBSY }, | 743 | { nfserr_io, -ETXTBSY }, |
759 | { nfserr_notsupp, -EOPNOTSUPP }, | 744 | { nfserr_notsupp, -EOPNOTSUPP }, |
760 | { nfserr_toosmall, -ETOOSMALL }, | 745 | { nfserr_toosmall, -ETOOSMALL }, |
746 | { nfserr_serverfault, -ESERVERFAULT }, | ||
761 | }; | 747 | }; |
762 | int i; | 748 | int i; |
763 | 749 | ||
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 67ea83eedd43..171699eb07c8 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfssvc.c | ||
3 | * | ||
4 | * Central processing for nfsd. | 2 | * Central processing for nfsd. |
5 | * | 3 | * |
6 | * Authors: Olaf Kirch (okir@monad.swb.de) | 4 | * Authors: Olaf Kirch (okir@monad.swb.de) |
@@ -8,33 +6,19 @@ | |||
8 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> |
9 | */ | 7 | */ |
10 | 8 | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
13 | #include <linux/time.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/nfs.h> | ||
16 | #include <linux/in.h> | ||
17 | #include <linux/uio.h> | ||
18 | #include <linux/unistd.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/smp.h> | ||
21 | #include <linux/freezer.h> | 10 | #include <linux/freezer.h> |
22 | #include <linux/fs_struct.h> | 11 | #include <linux/fs_struct.h> |
23 | #include <linux/kthread.h> | ||
24 | #include <linux/swap.h> | 12 | #include <linux/swap.h> |
25 | 13 | ||
26 | #include <linux/sunrpc/types.h> | ||
27 | #include <linux/sunrpc/stats.h> | 14 | #include <linux/sunrpc/stats.h> |
28 | #include <linux/sunrpc/svc.h> | ||
29 | #include <linux/sunrpc/svcsock.h> | 15 | #include <linux/sunrpc/svcsock.h> |
30 | #include <linux/sunrpc/cache.h> | ||
31 | #include <linux/nfsd/nfsd.h> | ||
32 | #include <linux/nfsd/stats.h> | ||
33 | #include <linux/nfsd/cache.h> | ||
34 | #include <linux/nfsd/syscall.h> | ||
35 | #include <linux/lockd/bind.h> | 16 | #include <linux/lockd/bind.h> |
36 | #include <linux/nfsacl.h> | 17 | #include <linux/nfsacl.h> |
37 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
19 | #include "nfsd.h" | ||
20 | #include "cache.h" | ||
21 | #include "vfs.h" | ||
38 | 22 | ||
39 | #define NFSDDBG_FACILITY NFSDDBG_SVC | 23 | #define NFSDDBG_FACILITY NFSDDBG_SVC |
40 | 24 | ||
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index afd08e2c90a5..4ce005dbf3e6 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
@@ -1,20 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/nfsxdr.c | ||
3 | * | ||
4 | * XDR support for nfsd | 2 | * XDR support for nfsd |
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/types.h> | 7 | #include "xdr.h" |
10 | #include <linux/time.h> | ||
11 | #include <linux/nfs.h> | ||
12 | #include <linux/vfs.h> | ||
13 | #include <linux/sunrpc/xdr.h> | ||
14 | #include <linux/sunrpc/svc.h> | ||
15 | #include <linux/nfsd/nfsd.h> | ||
16 | #include <linux/nfsd/xdr.h> | ||
17 | #include <linux/mm.h> | ||
18 | #include "auth.h" | 8 | #include "auth.h" |
19 | 9 | ||
20 | #define NFSDDBG_FACILITY NFSDDBG_XDR | 10 | #define NFSDDBG_FACILITY NFSDDBG_XDR |
diff --git a/include/linux/nfsd/state.h b/fs/nfsd/state.h index b38d11324189..fefeae27f25e 100644 --- a/include/linux/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/nfsd/state.h | ||
3 | * | ||
4 | * Copyright (c) 2001 The Regents of the University of Michigan. | 2 | * Copyright (c) 2001 The Regents of the University of Michigan. |
5 | * All rights reserved. | 3 | * All rights reserved. |
6 | * | 4 | * |
@@ -37,9 +35,8 @@ | |||
37 | #ifndef _NFSD4_STATE_H | 35 | #ifndef _NFSD4_STATE_H |
38 | #define _NFSD4_STATE_H | 36 | #define _NFSD4_STATE_H |
39 | 37 | ||
40 | #include <linux/list.h> | 38 | #include <linux/nfsd/nfsfh.h> |
41 | #include <linux/kref.h> | 39 | #include "nfsfh.h" |
42 | #include <linux/sunrpc/clnt.h> | ||
43 | 40 | ||
44 | typedef struct { | 41 | typedef struct { |
45 | u32 cl_boot; | 42 | u32 cl_boot; |
@@ -60,6 +57,13 @@ typedef struct { | |||
60 | #define si_stateownerid si_opaque.so_stateownerid | 57 | #define si_stateownerid si_opaque.so_stateownerid |
61 | #define si_fileid si_opaque.so_fileid | 58 | #define si_fileid si_opaque.so_fileid |
62 | 59 | ||
60 | #define STATEID_FMT "(%08x/%08x/%08x/%08x)" | ||
61 | #define STATEID_VAL(s) \ | ||
62 | (s)->si_boot, \ | ||
63 | (s)->si_stateownerid, \ | ||
64 | (s)->si_fileid, \ | ||
65 | (s)->si_generation | ||
66 | |||
63 | struct nfsd4_cb_sequence { | 67 | struct nfsd4_cb_sequence { |
64 | /* args/res */ | 68 | /* args/res */ |
65 | u32 cbs_minorversion; | 69 | u32 cbs_minorversion; |
diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c index 71944cddf680..5232d3e8fb2f 100644 --- a/fs/nfsd/stats.c +++ b/fs/nfsd/stats.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/nfsd/stats.c | ||
3 | * | ||
4 | * procfs-based user access to knfsd statistics | 2 | * procfs-based user access to knfsd statistics |
5 | * | 3 | * |
6 | * /proc/net/rpc/nfsd | 4 | * /proc/net/rpc/nfsd |
@@ -23,18 +21,13 @@ | |||
23 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> | 21 | * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> |
24 | */ | 22 | */ |
25 | 23 | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/time.h> | ||
28 | #include <linux/proc_fs.h> | ||
29 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
30 | #include <linux/stat.h> | ||
31 | #include <linux/module.h> | 25 | #include <linux/module.h> |
32 | |||
33 | #include <linux/sunrpc/svc.h> | ||
34 | #include <linux/sunrpc/stats.h> | 26 | #include <linux/sunrpc/stats.h> |
35 | #include <linux/nfsd/nfsd.h> | ||
36 | #include <linux/nfsd/stats.h> | 27 | #include <linux/nfsd/stats.h> |
37 | 28 | ||
29 | #include "nfsd.h" | ||
30 | |||
38 | struct nfsd_stats nfsdstats; | 31 | struct nfsd_stats nfsdstats; |
39 | struct svc_stat nfsd_svcstats = { | 32 | struct svc_stat nfsd_svcstats = { |
40 | .program = &nfsd_program, | 33 | .program = &nfsd_program, |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index a293f0273263..e3ef3ec0efd0 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1,7 +1,5 @@ | |||
1 | #define MSNFS /* HACK HACK */ | 1 | #define MSNFS /* HACK HACK */ |
2 | /* | 2 | /* |
3 | * linux/fs/nfsd/vfs.c | ||
4 | * | ||
5 | * File operations used by nfsd. Some of these have been ripped from | 3 | * File operations used by nfsd. Some of these have been ripped from |
6 | * other parts of the kernel because they weren't exported, others | 4 | * other parts of the kernel because they weren't exported, others |
7 | * are partial duplicates with added or changed functionality. | 5 | * are partial duplicates with added or changed functionality. |
@@ -16,48 +14,31 @@ | |||
16 | * Zerocpy NFS support (C) 2002 Hirokazu Takahashi <taka@valinux.co.jp> | 14 | * Zerocpy NFS support (C) 2002 Hirokazu Takahashi <taka@valinux.co.jp> |
17 | */ | 15 | */ |
18 | 16 | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/time.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
23 | #include <linux/file.h> | 18 | #include <linux/file.h> |
24 | #include <linux/mount.h> | ||
25 | #include <linux/major.h> | ||
26 | #include <linux/splice.h> | 19 | #include <linux/splice.h> |
27 | #include <linux/proc_fs.h> | ||
28 | #include <linux/stat.h> | ||
29 | #include <linux/fcntl.h> | 20 | #include <linux/fcntl.h> |
30 | #include <linux/net.h> | ||
31 | #include <linux/unistd.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/pagemap.h> | ||
34 | #include <linux/in.h> | ||
35 | #include <linux/module.h> | ||
36 | #include <linux/namei.h> | 21 | #include <linux/namei.h> |
37 | #include <linux/vfs.h> | ||
38 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
39 | #include <linux/sunrpc/svc.h> | ||
40 | #include <linux/nfsd/nfsd.h> | ||
41 | #ifdef CONFIG_NFSD_V3 | ||
42 | #include <linux/nfs3.h> | ||
43 | #include <linux/nfsd/xdr3.h> | ||
44 | #endif /* CONFIG_NFSD_V3 */ | ||
45 | #include <linux/nfsd/nfsfh.h> | ||
46 | #include <linux/quotaops.h> | 23 | #include <linux/quotaops.h> |
47 | #include <linux/fsnotify.h> | 24 | #include <linux/fsnotify.h> |
48 | #include <linux/posix_acl.h> | ||
49 | #include <linux/posix_acl_xattr.h> | 25 | #include <linux/posix_acl_xattr.h> |
50 | #include <linux/xattr.h> | 26 | #include <linux/xattr.h> |
27 | #include <linux/jhash.h> | ||
28 | #include <linux/ima.h> | ||
29 | #include <asm/uaccess.h> | ||
30 | |||
31 | #ifdef CONFIG_NFSD_V3 | ||
32 | #include "xdr3.h" | ||
33 | #endif /* CONFIG_NFSD_V3 */ | ||
34 | |||
51 | #ifdef CONFIG_NFSD_V4 | 35 | #ifdef CONFIG_NFSD_V4 |
52 | #include <linux/nfs4.h> | ||
53 | #include <linux/nfs4_acl.h> | 36 | #include <linux/nfs4_acl.h> |
54 | #include <linux/nfsd_idmap.h> | 37 | #include <linux/nfsd_idmap.h> |
55 | #include <linux/security.h> | ||
56 | #endif /* CONFIG_NFSD_V4 */ | 38 | #endif /* CONFIG_NFSD_V4 */ |
57 | #include <linux/jhash.h> | ||
58 | #include <linux/ima.h> | ||
59 | 39 | ||
60 | #include <asm/uaccess.h> | 40 | #include "nfsd.h" |
41 | #include "vfs.h" | ||
61 | 42 | ||
62 | #define NFSDDBG_FACILITY NFSDDBG_FILEOP | 43 | #define NFSDDBG_FACILITY NFSDDBG_FILEOP |
63 | 44 | ||
@@ -89,12 +70,6 @@ struct raparm_hbucket { | |||
89 | #define RAPARM_HASH_MASK (RAPARM_HASH_SIZE-1) | 70 | #define RAPARM_HASH_MASK (RAPARM_HASH_SIZE-1) |
90 | static struct raparm_hbucket raparm_hash[RAPARM_HASH_SIZE]; | 71 | static struct raparm_hbucket raparm_hash[RAPARM_HASH_SIZE]; |
91 | 72 | ||
92 | static inline int | ||
93 | nfsd_v4client(struct svc_rqst *rq) | ||
94 | { | ||
95 | return rq->rq_prog == NFS_PROGRAM && rq->rq_vers == 4; | ||
96 | } | ||
97 | |||
98 | /* | 73 | /* |
99 | * Called from nfsd_lookup and encode_dirent. Check if we have crossed | 74 | * Called from nfsd_lookup and encode_dirent. Check if we have crossed |
100 | * a mount point. | 75 | * a mount point. |
@@ -116,8 +91,16 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | |||
116 | 91 | ||
117 | exp2 = rqst_exp_get_by_name(rqstp, &path); | 92 | exp2 = rqst_exp_get_by_name(rqstp, &path); |
118 | if (IS_ERR(exp2)) { | 93 | if (IS_ERR(exp2)) { |
119 | if (PTR_ERR(exp2) != -ENOENT) | 94 | err = PTR_ERR(exp2); |
120 | err = PTR_ERR(exp2); | 95 | /* |
96 | * We normally allow NFS clients to continue | ||
97 | * "underneath" a mountpoint that is not exported. | ||
98 | * The exception is V4ROOT, where no traversal is ever | ||
99 | * allowed without an explicit export of the new | ||
100 | * directory. | ||
101 | */ | ||
102 | if (err == -ENOENT && !(exp->ex_flags & NFSEXP_V4ROOT)) | ||
103 | err = 0; | ||
121 | path_put(&path); | 104 | path_put(&path); |
122 | goto out; | 105 | goto out; |
123 | } | 106 | } |
@@ -141,6 +124,53 @@ out: | |||
141 | return err; | 124 | return err; |
142 | } | 125 | } |
143 | 126 | ||
127 | static void follow_to_parent(struct path *path) | ||
128 | { | ||
129 | struct dentry *dp; | ||
130 | |||
131 | while (path->dentry == path->mnt->mnt_root && follow_up(path)) | ||
132 | ; | ||
133 | dp = dget_parent(path->dentry); | ||
134 | dput(path->dentry); | ||
135 | path->dentry = dp; | ||
136 | } | ||
137 | |||
138 | static int nfsd_lookup_parent(struct svc_rqst *rqstp, struct dentry *dparent, struct svc_export **exp, struct dentry **dentryp) | ||
139 | { | ||
140 | struct svc_export *exp2; | ||
141 | struct path path = {.mnt = mntget((*exp)->ex_path.mnt), | ||
142 | .dentry = dget(dparent)}; | ||
143 | |||
144 | follow_to_parent(&path); | ||
145 | |||
146 | exp2 = rqst_exp_parent(rqstp, &path); | ||
147 | if (PTR_ERR(exp2) == -ENOENT) { | ||
148 | *dentryp = dget(dparent); | ||
149 | } else if (IS_ERR(exp2)) { | ||
150 | path_put(&path); | ||
151 | return PTR_ERR(exp2); | ||
152 | } else { | ||
153 | *dentryp = dget(path.dentry); | ||
154 | exp_put(*exp); | ||
155 | *exp = exp2; | ||
156 | } | ||
157 | path_put(&path); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | /* | ||
162 | * For nfsd purposes, we treat V4ROOT exports as though there was an | ||
163 | * export at *every* directory. | ||
164 | */ | ||
165 | int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) | ||
166 | { | ||
167 | if (d_mountpoint(dentry)) | ||
168 | return 1; | ||
169 | if (!(exp->ex_flags & NFSEXP_V4ROOT)) | ||
170 | return 0; | ||
171 | return dentry->d_inode != NULL; | ||
172 | } | ||
173 | |||
144 | __be32 | 174 | __be32 |
145 | nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, | 175 | nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, |
146 | const char *name, unsigned int len, | 176 | const char *name, unsigned int len, |
@@ -169,35 +199,13 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
169 | dentry = dget(dparent); | 199 | dentry = dget(dparent); |
170 | else if (dparent != exp->ex_path.dentry) | 200 | else if (dparent != exp->ex_path.dentry) |
171 | dentry = dget_parent(dparent); | 201 | dentry = dget_parent(dparent); |
172 | else if (!EX_NOHIDE(exp)) | 202 | else if (!EX_NOHIDE(exp) && !nfsd_v4client(rqstp)) |
173 | dentry = dget(dparent); /* .. == . just like at / */ | 203 | dentry = dget(dparent); /* .. == . just like at / */ |
174 | else { | 204 | else { |
175 | /* checking mountpoint crossing is very different when stepping up */ | 205 | /* checking mountpoint crossing is very different when stepping up */ |
176 | struct svc_export *exp2 = NULL; | 206 | host_err = nfsd_lookup_parent(rqstp, dparent, &exp, &dentry); |
177 | struct dentry *dp; | 207 | if (host_err) |
178 | struct path path = {.mnt = mntget(exp->ex_path.mnt), | ||
179 | .dentry = dget(dparent)}; | ||
180 | |||
181 | while (path.dentry == path.mnt->mnt_root && | ||
182 | follow_up(&path)) | ||
183 | ; | ||
184 | dp = dget_parent(path.dentry); | ||
185 | dput(path.dentry); | ||
186 | path.dentry = dp; | ||
187 | |||
188 | exp2 = rqst_exp_parent(rqstp, &path); | ||
189 | if (PTR_ERR(exp2) == -ENOENT) { | ||
190 | dentry = dget(dparent); | ||
191 | } else if (IS_ERR(exp2)) { | ||
192 | host_err = PTR_ERR(exp2); | ||
193 | path_put(&path); | ||
194 | goto out_nfserr; | 208 | goto out_nfserr; |
195 | } else { | ||
196 | dentry = dget(path.dentry); | ||
197 | exp_put(exp); | ||
198 | exp = exp2; | ||
199 | } | ||
200 | path_put(&path); | ||
201 | } | 209 | } |
202 | } else { | 210 | } else { |
203 | fh_lock(fhp); | 211 | fh_lock(fhp); |
@@ -208,7 +216,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
208 | /* | 216 | /* |
209 | * check if we have crossed a mount point ... | 217 | * check if we have crossed a mount point ... |
210 | */ | 218 | */ |
211 | if (d_mountpoint(dentry)) { | 219 | if (nfsd_mountpoint(dentry, exp)) { |
212 | if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { | 220 | if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { |
213 | dput(dentry); | 221 | dput(dentry); |
214 | goto out_nfserr; | 222 | goto out_nfserr; |
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h new file mode 100644 index 000000000000..4b1de0a9ea75 --- /dev/null +++ b/fs/nfsd/vfs.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | ||
3 | */ | ||
4 | |||
5 | #ifndef LINUX_NFSD_VFS_H | ||
6 | #define LINUX_NFSD_VFS_H | ||
7 | |||
8 | #include "nfsfh.h" | ||
9 | |||
10 | /* | ||
11 | * Flags for nfsd_permission | ||
12 | */ | ||
13 | #define NFSD_MAY_NOP 0 | ||
14 | #define NFSD_MAY_EXEC 1 /* == MAY_EXEC */ | ||
15 | #define NFSD_MAY_WRITE 2 /* == MAY_WRITE */ | ||
16 | #define NFSD_MAY_READ 4 /* == MAY_READ */ | ||
17 | #define NFSD_MAY_SATTR 8 | ||
18 | #define NFSD_MAY_TRUNC 16 | ||
19 | #define NFSD_MAY_LOCK 32 | ||
20 | #define NFSD_MAY_OWNER_OVERRIDE 64 | ||
21 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | ||
22 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 | ||
23 | |||
24 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | ||
25 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | ||
26 | |||
27 | /* | ||
28 | * Callback function for readdir | ||
29 | */ | ||
30 | typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | ||
31 | |||
32 | /* nfsd/vfs.c */ | ||
33 | int fh_lock_parent(struct svc_fh *, struct dentry *); | ||
34 | int nfsd_racache_init(int); | ||
35 | void nfsd_racache_shutdown(void); | ||
36 | int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | ||
37 | struct svc_export **expp); | ||
38 | __be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, | ||
39 | const char *, unsigned int, struct svc_fh *); | ||
40 | __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, | ||
41 | const char *, unsigned int, | ||
42 | struct svc_export **, struct dentry **); | ||
43 | __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, | ||
44 | struct iattr *, int, time_t); | ||
45 | int nfsd_mountpoint(struct dentry *, struct svc_export *); | ||
46 | #ifdef CONFIG_NFSD_V4 | ||
47 | __be32 nfsd4_set_nfs4_acl(struct svc_rqst *, struct svc_fh *, | ||
48 | struct nfs4_acl *); | ||
49 | int nfsd4_get_nfs4_acl(struct svc_rqst *, struct dentry *, struct nfs4_acl **); | ||
50 | #endif /* CONFIG_NFSD_V4 */ | ||
51 | __be32 nfsd_create(struct svc_rqst *, struct svc_fh *, | ||
52 | char *name, int len, struct iattr *attrs, | ||
53 | int type, dev_t rdev, struct svc_fh *res); | ||
54 | #ifdef CONFIG_NFSD_V3 | ||
55 | __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *); | ||
56 | __be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *, | ||
57 | char *name, int len, struct iattr *attrs, | ||
58 | struct svc_fh *res, int createmode, | ||
59 | u32 *verifier, int *truncp, int *created); | ||
60 | __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, | ||
61 | loff_t, unsigned long); | ||
62 | #endif /* CONFIG_NFSD_V3 */ | ||
63 | __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, | ||
64 | int, struct file **); | ||
65 | void nfsd_close(struct file *); | ||
66 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, | ||
67 | loff_t, struct kvec *, int, unsigned long *); | ||
68 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, | ||
69 | loff_t, struct kvec *,int, unsigned long *, int *); | ||
70 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, | ||
71 | char *, int *); | ||
72 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, | ||
73 | char *name, int len, char *path, int plen, | ||
74 | struct svc_fh *res, struct iattr *); | ||
75 | __be32 nfsd_link(struct svc_rqst *, struct svc_fh *, | ||
76 | char *, int, struct svc_fh *); | ||
77 | __be32 nfsd_rename(struct svc_rqst *, | ||
78 | struct svc_fh *, char *, int, | ||
79 | struct svc_fh *, char *, int); | ||
80 | __be32 nfsd_remove(struct svc_rqst *, | ||
81 | struct svc_fh *, char *, int); | ||
82 | __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, | ||
83 | char *name, int len); | ||
84 | int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | ||
85 | unsigned long size); | ||
86 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | ||
87 | loff_t *, struct readdir_cd *, filldir_t); | ||
88 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | ||
89 | struct kstatfs *, int access); | ||
90 | |||
91 | int nfsd_notify_change(struct inode *, struct iattr *); | ||
92 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | ||
93 | struct dentry *, int); | ||
94 | int nfsd_sync_dir(struct dentry *dp); | ||
95 | |||
96 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
97 | struct posix_acl *nfsd_get_posix_acl(struct svc_fh *, int); | ||
98 | int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | ||
99 | #endif | ||
100 | |||
101 | #endif /* LINUX_NFSD_VFS_H */ | ||
diff --git a/include/linux/nfsd/xdr.h b/fs/nfsd/xdr.h index a0132ef58f21..53b1863dd8f6 100644 --- a/include/linux/nfsd/xdr.h +++ b/fs/nfsd/xdr.h | |||
@@ -1,15 +1,11 @@ | |||
1 | /* | 1 | /* XDR types for nfsd. This is mainly a typing exercise. */ |
2 | * linux/include/linux/nfsd/xdr.h | ||
3 | * | ||
4 | * XDR types for nfsd. This is mainly a typing exercise. | ||
5 | */ | ||
6 | 2 | ||
7 | #ifndef LINUX_NFSD_H | 3 | #ifndef LINUX_NFSD_H |
8 | #define LINUX_NFSD_H | 4 | #define LINUX_NFSD_H |
9 | 5 | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/vfs.h> | 6 | #include <linux/vfs.h> |
12 | #include <linux/nfs.h> | 7 | #include "nfsd.h" |
8 | #include "nfsfh.h" | ||
13 | 9 | ||
14 | struct nfsd_fhandle { | 10 | struct nfsd_fhandle { |
15 | struct svc_fh fh; | 11 | struct svc_fh fh; |
diff --git a/include/linux/nfsd/xdr3.h b/fs/nfsd/xdr3.h index 421eddd65a25..7df980eb0562 100644 --- a/include/linux/nfsd/xdr3.h +++ b/fs/nfsd/xdr3.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/nfsd/xdr3.h | ||
3 | * | ||
4 | * XDR types for NFSv3 in nfsd. | 2 | * XDR types for NFSv3 in nfsd. |
5 | * | 3 | * |
6 | * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de> |
@@ -9,7 +7,7 @@ | |||
9 | #ifndef _LINUX_NFSD_XDR3_H | 7 | #ifndef _LINUX_NFSD_XDR3_H |
10 | #define _LINUX_NFSD_XDR3_H | 8 | #define _LINUX_NFSD_XDR3_H |
11 | 9 | ||
12 | #include <linux/nfsd/xdr.h> | 10 | #include "xdr.h" |
13 | 11 | ||
14 | struct nfsd3_sattrargs { | 12 | struct nfsd3_sattrargs { |
15 | struct svc_fh fh; | 13 | struct svc_fh fh; |
diff --git a/include/linux/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 73164c2b3d29..efa337739534 100644 --- a/include/linux/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * include/linux/nfsd/xdr4.h | ||
3 | * | ||
4 | * Server-side types for NFSv4. | 2 | * Server-side types for NFSv4. |
5 | * | 3 | * |
6 | * Copyright (c) 2002 The Regents of the University of Michigan. | 4 | * Copyright (c) 2002 The Regents of the University of Michigan. |
@@ -39,7 +37,8 @@ | |||
39 | #ifndef _LINUX_NFSD_XDR4_H | 37 | #ifndef _LINUX_NFSD_XDR4_H |
40 | #define _LINUX_NFSD_XDR4_H | 38 | #define _LINUX_NFSD_XDR4_H |
41 | 39 | ||
42 | #include <linux/nfs4.h> | 40 | #include "state.h" |
41 | #include "nfsd.h" | ||
43 | 42 | ||
44 | #define NFSD4_MAX_TAGLEN 128 | 43 | #define NFSD4_MAX_TAGLEN 128 |
45 | #define XDR_LEN(n) (((n) + 3) & ~3) | 44 | #define XDR_LEN(n) (((n) + 3) & ~3) |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 27e772cefb6a..dc12f416a49f 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
@@ -97,7 +97,7 @@ struct fid { | |||
97 | * @get_name: find the name for a given inode in a given directory | 97 | * @get_name: find the name for a given inode in a given directory |
98 | * @get_parent: find the parent of a given directory | 98 | * @get_parent: find the parent of a given directory |
99 | * | 99 | * |
100 | * See Documentation/filesystems/Exporting for details on how to use | 100 | * See Documentation/filesystems/nfs/Exporting for details on how to use |
101 | * this interface correctly. | 101 | * this interface correctly. |
102 | * | 102 | * |
103 | * encode_fh: | 103 | * encode_fh: |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 51071b335751..89b28812ec24 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_NFS_XDR_H | 2 | #define _LINUX_NFS_XDR_H |
3 | 3 | ||
4 | #include <linux/nfsacl.h> | 4 | #include <linux/nfsacl.h> |
5 | #include <linux/nfs3.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * To change the maximum rsize and wsize supported by the NFS client, adjust | 8 | * To change the maximum rsize and wsize supported by the NFS client, adjust |
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h index 43011b69297c..f321b578edeb 100644 --- a/include/linux/nfsacl.h +++ b/include/linux/nfsacl.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
30 | 30 | ||
31 | #include <linux/posix_acl.h> | 31 | #include <linux/posix_acl.h> |
32 | #include <linux/sunrpc/xdr.h> | ||
32 | 33 | ||
33 | /* Maximum number of ACL entries over NFS */ | 34 | /* Maximum number of ACL entries over NFS */ |
34 | #define NFS_ACL_MAX_ENTRIES 1024 | 35 | #define NFS_ACL_MAX_ENTRIES 1024 |
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h index a6d9ef2bb34a..8ae78a61eea4 100644 --- a/include/linux/nfsd/export.h +++ b/include/linux/nfsd/export.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | # include <linux/types.h> | 13 | # include <linux/types.h> |
14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
15 | # include <linux/in.h> | 15 | # include <linux/nfsd/nfsfh.h> |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | /* | 18 | /* |
@@ -39,11 +39,23 @@ | |||
39 | #define NFSEXP_FSID 0x2000 | 39 | #define NFSEXP_FSID 0x2000 |
40 | #define NFSEXP_CROSSMOUNT 0x4000 | 40 | #define NFSEXP_CROSSMOUNT 0x4000 |
41 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ | 41 | #define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */ |
42 | #define NFSEXP_ALLFLAGS 0xFE3F | 42 | /* |
43 | * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4 | ||
44 | * clients, and only to the single directory that is the root of the | ||
45 | * export; further lookup and readdir operations are treated as if every | ||
46 | * subdirectory was a mountpoint, and ignored if they are not themselves | ||
47 | * exported. This is used by nfsd and mountd to construct the NFSv4 | ||
48 | * pseudofilesystem, which provides access only to paths leading to each | ||
49 | * exported filesystem. | ||
50 | */ | ||
51 | #define NFSEXP_V4ROOT 0x10000 | ||
52 | /* All flags that we claim to support. (Note we don't support NOACL.) */ | ||
53 | #define NFSEXP_ALLFLAGS 0x17E3F | ||
43 | 54 | ||
44 | /* The flags that may vary depending on security flavor: */ | 55 | /* The flags that may vary depending on security flavor: */ |
45 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ | 56 | #define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \ |
46 | | NFSEXP_ALLSQUASH) | 57 | | NFSEXP_ALLSQUASH \ |
58 | | NFSEXP_INSECURE_PORT) | ||
47 | 59 | ||
48 | #ifdef __KERNEL__ | 60 | #ifdef __KERNEL__ |
49 | 61 | ||
@@ -108,7 +120,6 @@ struct svc_expkey { | |||
108 | struct path ek_path; | 120 | struct path ek_path; |
109 | }; | 121 | }; |
110 | 122 | ||
111 | #define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) | ||
112 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) | 123 | #define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC)) |
113 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) | 124 | #define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE) |
114 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) | 125 | #define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES) |
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index 8f641c908450..65e333afaee4 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
@@ -16,11 +16,9 @@ | |||
16 | 16 | ||
17 | # include <linux/types.h> | 17 | # include <linux/types.h> |
18 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
19 | # include <linux/string.h> | 19 | # include <linux/sunrpc/svc.h> |
20 | # include <linux/fs.h> | ||
21 | #endif | 20 | #endif |
22 | #include <linux/nfsd/const.h> | 21 | #include <linux/nfsd/const.h> |
23 | #include <linux/nfsd/debug.h> | ||
24 | 22 | ||
25 | /* | 23 | /* |
26 | * This is the old "dentry style" Linux NFSv2 file handle. | 24 | * This is the old "dentry style" Linux NFSv2 file handle. |
@@ -164,208 +162,6 @@ typedef struct svc_fh { | |||
164 | 162 | ||
165 | } svc_fh; | 163 | } svc_fh; |
166 | 164 | ||
167 | enum nfsd_fsid { | ||
168 | FSID_DEV = 0, | ||
169 | FSID_NUM, | ||
170 | FSID_MAJOR_MINOR, | ||
171 | FSID_ENCODE_DEV, | ||
172 | FSID_UUID4_INUM, | ||
173 | FSID_UUID8, | ||
174 | FSID_UUID16, | ||
175 | FSID_UUID16_INUM, | ||
176 | }; | ||
177 | |||
178 | enum fsid_source { | ||
179 | FSIDSOURCE_DEV, | ||
180 | FSIDSOURCE_FSID, | ||
181 | FSIDSOURCE_UUID, | ||
182 | }; | ||
183 | extern enum fsid_source fsid_source(struct svc_fh *fhp); | ||
184 | |||
185 | |||
186 | /* This might look a little large to "inline" but in all calls except | ||
187 | * one, 'vers' is constant so moste of the function disappears. | ||
188 | */ | ||
189 | static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino, | ||
190 | u32 fsid, unsigned char *uuid) | ||
191 | { | ||
192 | u32 *up; | ||
193 | switch(vers) { | ||
194 | case FSID_DEV: | ||
195 | fsidv[0] = htonl((MAJOR(dev)<<16) | | ||
196 | MINOR(dev)); | ||
197 | fsidv[1] = ino_t_to_u32(ino); | ||
198 | break; | ||
199 | case FSID_NUM: | ||
200 | fsidv[0] = fsid; | ||
201 | break; | ||
202 | case FSID_MAJOR_MINOR: | ||
203 | fsidv[0] = htonl(MAJOR(dev)); | ||
204 | fsidv[1] = htonl(MINOR(dev)); | ||
205 | fsidv[2] = ino_t_to_u32(ino); | ||
206 | break; | ||
207 | |||
208 | case FSID_ENCODE_DEV: | ||
209 | fsidv[0] = new_encode_dev(dev); | ||
210 | fsidv[1] = ino_t_to_u32(ino); | ||
211 | break; | ||
212 | |||
213 | case FSID_UUID4_INUM: | ||
214 | /* 4 byte fsid and inode number */ | ||
215 | up = (u32*)uuid; | ||
216 | fsidv[0] = ino_t_to_u32(ino); | ||
217 | fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3]; | ||
218 | break; | ||
219 | |||
220 | case FSID_UUID8: | ||
221 | /* 8 byte fsid */ | ||
222 | up = (u32*)uuid; | ||
223 | fsidv[0] = up[0] ^ up[2]; | ||
224 | fsidv[1] = up[1] ^ up[3]; | ||
225 | break; | ||
226 | |||
227 | case FSID_UUID16: | ||
228 | /* 16 byte fsid - NFSv3+ only */ | ||
229 | memcpy(fsidv, uuid, 16); | ||
230 | break; | ||
231 | |||
232 | case FSID_UUID16_INUM: | ||
233 | /* 8 byte inode and 16 byte fsid */ | ||
234 | *(u64*)fsidv = (u64)ino; | ||
235 | memcpy(fsidv+2, uuid, 16); | ||
236 | break; | ||
237 | default: BUG(); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | static inline int key_len(int type) | ||
242 | { | ||
243 | switch(type) { | ||
244 | case FSID_DEV: return 8; | ||
245 | case FSID_NUM: return 4; | ||
246 | case FSID_MAJOR_MINOR: return 12; | ||
247 | case FSID_ENCODE_DEV: return 8; | ||
248 | case FSID_UUID4_INUM: return 8; | ||
249 | case FSID_UUID8: return 8; | ||
250 | case FSID_UUID16: return 16; | ||
251 | case FSID_UUID16_INUM: return 24; | ||
252 | default: return 0; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | /* | ||
257 | * Shorthand for dprintk()'s | ||
258 | */ | ||
259 | extern char * SVCFH_fmt(struct svc_fh *fhp); | ||
260 | |||
261 | /* | ||
262 | * Function prototypes | ||
263 | */ | ||
264 | __be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); | ||
265 | __be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); | ||
266 | __be32 fh_update(struct svc_fh *); | ||
267 | void fh_put(struct svc_fh *); | ||
268 | |||
269 | static __inline__ struct svc_fh * | ||
270 | fh_copy(struct svc_fh *dst, struct svc_fh *src) | ||
271 | { | ||
272 | WARN_ON(src->fh_dentry || src->fh_locked); | ||
273 | |||
274 | *dst = *src; | ||
275 | return dst; | ||
276 | } | ||
277 | |||
278 | static inline void | ||
279 | fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) | ||
280 | { | ||
281 | dst->fh_size = src->fh_size; | ||
282 | memcpy(&dst->fh_base, &src->fh_base, src->fh_size); | ||
283 | } | ||
284 | |||
285 | static __inline__ struct svc_fh * | ||
286 | fh_init(struct svc_fh *fhp, int maxsize) | ||
287 | { | ||
288 | memset(fhp, 0, sizeof(*fhp)); | ||
289 | fhp->fh_maxsize = maxsize; | ||
290 | return fhp; | ||
291 | } | ||
292 | |||
293 | #ifdef CONFIG_NFSD_V3 | ||
294 | /* | ||
295 | * Fill in the pre_op attr for the wcc data | ||
296 | */ | ||
297 | static inline void | ||
298 | fill_pre_wcc(struct svc_fh *fhp) | ||
299 | { | ||
300 | struct inode *inode; | ||
301 | |||
302 | inode = fhp->fh_dentry->d_inode; | ||
303 | if (!fhp->fh_pre_saved) { | ||
304 | fhp->fh_pre_mtime = inode->i_mtime; | ||
305 | fhp->fh_pre_ctime = inode->i_ctime; | ||
306 | fhp->fh_pre_size = inode->i_size; | ||
307 | fhp->fh_pre_change = inode->i_version; | ||
308 | fhp->fh_pre_saved = 1; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | extern void fill_post_wcc(struct svc_fh *); | ||
313 | #else | ||
314 | #define fill_pre_wcc(ignored) | ||
315 | #define fill_post_wcc(notused) | ||
316 | #endif /* CONFIG_NFSD_V3 */ | ||
317 | |||
318 | |||
319 | /* | ||
320 | * Lock a file handle/inode | ||
321 | * NOTE: both fh_lock and fh_unlock are done "by hand" in | ||
322 | * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once | ||
323 | * so, any changes here should be reflected there. | ||
324 | */ | ||
325 | |||
326 | static inline void | ||
327 | fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) | ||
328 | { | ||
329 | struct dentry *dentry = fhp->fh_dentry; | ||
330 | struct inode *inode; | ||
331 | |||
332 | dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n", | ||
333 | SVCFH_fmt(fhp), fhp->fh_locked); | ||
334 | |||
335 | BUG_ON(!dentry); | ||
336 | |||
337 | if (fhp->fh_locked) { | ||
338 | printk(KERN_WARNING "fh_lock: %s/%s already locked!\n", | ||
339 | dentry->d_parent->d_name.name, dentry->d_name.name); | ||
340 | return; | ||
341 | } | ||
342 | |||
343 | inode = dentry->d_inode; | ||
344 | mutex_lock_nested(&inode->i_mutex, subclass); | ||
345 | fill_pre_wcc(fhp); | ||
346 | fhp->fh_locked = 1; | ||
347 | } | ||
348 | |||
349 | static inline void | ||
350 | fh_lock(struct svc_fh *fhp) | ||
351 | { | ||
352 | fh_lock_nested(fhp, I_MUTEX_NORMAL); | ||
353 | } | ||
354 | |||
355 | /* | ||
356 | * Unlock a file handle/inode | ||
357 | */ | ||
358 | static inline void | ||
359 | fh_unlock(struct svc_fh *fhp) | ||
360 | { | ||
361 | BUG_ON(!fhp->fh_dentry); | ||
362 | |||
363 | if (fhp->fh_locked) { | ||
364 | fill_post_wcc(fhp); | ||
365 | mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); | ||
366 | fhp->fh_locked = 0; | ||
367 | } | ||
368 | } | ||
369 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
370 | 166 | ||
371 | 167 | ||
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 7a3b565b898f..812bc1e160dc 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h | |||
@@ -9,14 +9,8 @@ | |||
9 | #ifndef NFSD_SYSCALL_H | 9 | #ifndef NFSD_SYSCALL_H |
10 | #define NFSD_SYSCALL_H | 10 | #define NFSD_SYSCALL_H |
11 | 11 | ||
12 | # include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #ifdef __KERNEL__ | ||
14 | # include <linux/in.h> | ||
15 | #endif | ||
16 | #include <linux/posix_types.h> | ||
17 | #include <linux/nfsd/const.h> | ||
18 | #include <linux/nfsd/export.h> | 13 | #include <linux/nfsd/export.h> |
19 | #include <linux/nfsd/nfsfh.h> | ||
20 | 14 | ||
21 | /* | 15 | /* |
22 | * Version of the syscall interface | 16 | * Version of the syscall interface |
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index 10709cbe96fd..c2786f20016f 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
@@ -28,9 +28,6 @@ | |||
28 | 28 | ||
29 | #ifdef __KERNEL__ | 29 | #ifdef __KERNEL__ |
30 | 30 | ||
31 | #include <linux/timer.h> | ||
32 | #include <linux/workqueue.h> | ||
33 | |||
34 | /* | 31 | /* |
35 | * Enable RPC debugging/profiling. | 32 | * Enable RPC debugging/profiling. |
36 | */ | 33 | */ |
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h index 87b895d5c786..b78f16b1dea3 100644 --- a/include/linux/sunrpc/rpc_rdma.h +++ b/include/linux/sunrpc/rpc_rdma.h | |||
@@ -40,6 +40,8 @@ | |||
40 | #ifndef _LINUX_SUNRPC_RPC_RDMA_H | 40 | #ifndef _LINUX_SUNRPC_RPC_RDMA_H |
41 | #define _LINUX_SUNRPC_RPC_RDMA_H | 41 | #define _LINUX_SUNRPC_RPC_RDMA_H |
42 | 42 | ||
43 | #include <linux/types.h> | ||
44 | |||
43 | struct rpcrdma_segment { | 45 | struct rpcrdma_segment { |
44 | __be32 rs_handle; /* Registered memory handle */ | 46 | __be32 rs_handle; /* Registered memory handle */ |
45 | __be32 rs_length; /* Length of the chunk in bytes */ | 47 | __be32 rs_length; /* Length of the chunk in bytes */ |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 52e8cb0a7569..5a3085b9b394 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -29,7 +29,6 @@ struct svc_pool_stats { | |||
29 | unsigned long packets; | 29 | unsigned long packets; |
30 | unsigned long sockets_queued; | 30 | unsigned long sockets_queued; |
31 | unsigned long threads_woken; | 31 | unsigned long threads_woken; |
32 | unsigned long overloads_avoided; | ||
33 | unsigned long threads_timedout; | 32 | unsigned long threads_timedout; |
34 | }; | 33 | }; |
35 | 34 | ||
@@ -50,7 +49,6 @@ struct svc_pool { | |||
50 | struct list_head sp_sockets; /* pending sockets */ | 49 | struct list_head sp_sockets; /* pending sockets */ |
51 | unsigned int sp_nrthreads; /* # of threads in pool */ | 50 | unsigned int sp_nrthreads; /* # of threads in pool */ |
52 | struct list_head sp_all_threads; /* all server threads */ | 51 | struct list_head sp_all_threads; /* all server threads */ |
53 | int sp_nwaking; /* number of threads woken but not yet active */ | ||
54 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ | 52 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ |
55 | } ____cacheline_aligned_in_smp; | 53 | } ____cacheline_aligned_in_smp; |
56 | 54 | ||
@@ -275,16 +273,11 @@ struct svc_rqst { | |||
275 | struct auth_domain * rq_client; /* RPC peer info */ | 273 | struct auth_domain * rq_client; /* RPC peer info */ |
276 | struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ | 274 | struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ |
277 | struct svc_cacherep * rq_cacherep; /* cache info */ | 275 | struct svc_cacherep * rq_cacherep; /* cache info */ |
278 | struct knfsd_fh * rq_reffh; /* Referrence filehandle, used to | ||
279 | * determine what device number | ||
280 | * to report (real or virtual) | ||
281 | */ | ||
282 | int rq_splice_ok; /* turned off in gss privacy | 276 | int rq_splice_ok; /* turned off in gss privacy |
283 | * to prevent encrypting page | 277 | * to prevent encrypting page |
284 | * cache pages */ | 278 | * cache pages */ |
285 | wait_queue_head_t rq_wait; /* synchronization */ | 279 | wait_queue_head_t rq_wait; /* synchronization */ |
286 | struct task_struct *rq_task; /* service thread */ | 280 | struct task_struct *rq_task; /* service thread */ |
287 | int rq_waking; /* 1 if thread is being woken */ | ||
288 | }; | 281 | }; |
289 | 282 | ||
290 | /* | 283 | /* |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 70491d9035eb..0c94a1ac2946 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -166,7 +166,7 @@ config IP_PNP_DHCP | |||
166 | 166 | ||
167 | If unsure, say Y. Note that if you want to use DHCP, a DHCP server | 167 | If unsure, say Y. Note that if you want to use DHCP, a DHCP server |
168 | must be operating on your network. Read | 168 | must be operating on your network. Read |
169 | <file:Documentation/filesystems/nfsroot.txt> for details. | 169 | <file:Documentation/filesystems/nfs/nfsroot.txt> for details. |
170 | 170 | ||
171 | config IP_PNP_BOOTP | 171 | config IP_PNP_BOOTP |
172 | bool "IP: BOOTP support" | 172 | bool "IP: BOOTP support" |
@@ -181,7 +181,7 @@ config IP_PNP_BOOTP | |||
181 | does BOOTP itself, providing all necessary information on the kernel | 181 | does BOOTP itself, providing all necessary information on the kernel |
182 | command line, you can say N here. If unsure, say Y. Note that if you | 182 | command line, you can say N here. If unsure, say Y. Note that if you |
183 | want to use BOOTP, a BOOTP server must be operating on your network. | 183 | want to use BOOTP, a BOOTP server must be operating on your network. |
184 | Read <file:Documentation/filesystems/nfsroot.txt> for details. | 184 | Read <file:Documentation/filesystems/nfs/nfsroot.txt> for details. |
185 | 185 | ||
186 | config IP_PNP_RARP | 186 | config IP_PNP_RARP |
187 | bool "IP: RARP support" | 187 | bool "IP: RARP support" |
@@ -194,7 +194,7 @@ config IP_PNP_RARP | |||
194 | older protocol which is being obsoleted by BOOTP and DHCP), say Y | 194 | older protocol which is being obsoleted by BOOTP and DHCP), say Y |
195 | here. Note that if you want to use RARP, a RARP server must be | 195 | here. Note that if you want to use RARP, a RARP server must be |
196 | operating on your network. Read | 196 | operating on your network. Read |
197 | <file:Documentation/filesystems/nfsroot.txt> for details. | 197 | <file:Documentation/filesystems/nfs/nfsroot.txt> for details. |
198 | 198 | ||
199 | # not yet ready.. | 199 | # not yet ready.. |
200 | # bool ' IP: ARP support' CONFIG_IP_PNP_ARP | 200 | # bool ' IP: ARP support' CONFIG_IP_PNP_ARP |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 4e08b7f2331c..10a6a604bf32 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1446,7 +1446,7 @@ late_initcall(ip_auto_config); | |||
1446 | 1446 | ||
1447 | /* | 1447 | /* |
1448 | * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel | 1448 | * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel |
1449 | * command line parameter. See Documentation/filesystems/nfsroot.txt. | 1449 | * command line parameter. See Documentation/filesystems/nfs/nfsroot.txt. |
1450 | */ | 1450 | */ |
1451 | static int __init ic_proto_name(char *name) | 1451 | static int __init ic_proto_name(char *name) |
1452 | { | 1452 | { |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index b845e2293dfe..1c924ee0a1ef 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -16,8 +16,6 @@ | |||
16 | 16 | ||
17 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT | 17 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT |
18 | 18 | ||
19 | #define SVC_MAX_WAKING 5 | ||
20 | |||
21 | static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt); | 19 | static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt); |
22 | static int svc_deferred_recv(struct svc_rqst *rqstp); | 20 | static int svc_deferred_recv(struct svc_rqst *rqstp); |
23 | static struct cache_deferred_req *svc_defer(struct cache_req *req); | 21 | static struct cache_deferred_req *svc_defer(struct cache_req *req); |
@@ -306,7 +304,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
306 | struct svc_pool *pool; | 304 | struct svc_pool *pool; |
307 | struct svc_rqst *rqstp; | 305 | struct svc_rqst *rqstp; |
308 | int cpu; | 306 | int cpu; |
309 | int thread_avail; | ||
310 | 307 | ||
311 | if (!(xprt->xpt_flags & | 308 | if (!(xprt->xpt_flags & |
312 | ((1<<XPT_CONN)|(1<<XPT_DATA)|(1<<XPT_CLOSE)|(1<<XPT_DEFERRED)))) | 309 | ((1<<XPT_CONN)|(1<<XPT_DATA)|(1<<XPT_CLOSE)|(1<<XPT_DEFERRED)))) |
@@ -318,6 +315,12 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
318 | 315 | ||
319 | spin_lock_bh(&pool->sp_lock); | 316 | spin_lock_bh(&pool->sp_lock); |
320 | 317 | ||
318 | if (!list_empty(&pool->sp_threads) && | ||
319 | !list_empty(&pool->sp_sockets)) | ||
320 | printk(KERN_ERR | ||
321 | "svc_xprt_enqueue: " | ||
322 | "threads and transports both waiting??\n"); | ||
323 | |||
321 | if (test_bit(XPT_DEAD, &xprt->xpt_flags)) { | 324 | if (test_bit(XPT_DEAD, &xprt->xpt_flags)) { |
322 | /* Don't enqueue dead transports */ | 325 | /* Don't enqueue dead transports */ |
323 | dprintk("svc: transport %p is dead, not enqueued\n", xprt); | 326 | dprintk("svc: transport %p is dead, not enqueued\n", xprt); |
@@ -358,15 +361,7 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
358 | } | 361 | } |
359 | 362 | ||
360 | process: | 363 | process: |
361 | /* Work out whether threads are available */ | 364 | if (!list_empty(&pool->sp_threads)) { |
362 | thread_avail = !list_empty(&pool->sp_threads); /* threads are asleep */ | ||
363 | if (pool->sp_nwaking >= SVC_MAX_WAKING) { | ||
364 | /* too many threads are runnable and trying to wake up */ | ||
365 | thread_avail = 0; | ||
366 | pool->sp_stats.overloads_avoided++; | ||
367 | } | ||
368 | |||
369 | if (thread_avail) { | ||
370 | rqstp = list_entry(pool->sp_threads.next, | 365 | rqstp = list_entry(pool->sp_threads.next, |
371 | struct svc_rqst, | 366 | struct svc_rqst, |
372 | rq_list); | 367 | rq_list); |
@@ -381,8 +376,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
381 | svc_xprt_get(xprt); | 376 | svc_xprt_get(xprt); |
382 | rqstp->rq_reserved = serv->sv_max_mesg; | 377 | rqstp->rq_reserved = serv->sv_max_mesg; |
383 | atomic_add(rqstp->rq_reserved, &xprt->xpt_reserved); | 378 | atomic_add(rqstp->rq_reserved, &xprt->xpt_reserved); |
384 | rqstp->rq_waking = 1; | ||
385 | pool->sp_nwaking++; | ||
386 | pool->sp_stats.threads_woken++; | 379 | pool->sp_stats.threads_woken++; |
387 | BUG_ON(xprt->xpt_pool != pool); | 380 | BUG_ON(xprt->xpt_pool != pool); |
388 | wake_up(&rqstp->rq_wait); | 381 | wake_up(&rqstp->rq_wait); |
@@ -651,11 +644,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
651 | return -EINTR; | 644 | return -EINTR; |
652 | 645 | ||
653 | spin_lock_bh(&pool->sp_lock); | 646 | spin_lock_bh(&pool->sp_lock); |
654 | if (rqstp->rq_waking) { | ||
655 | rqstp->rq_waking = 0; | ||
656 | pool->sp_nwaking--; | ||
657 | BUG_ON(pool->sp_nwaking < 0); | ||
658 | } | ||
659 | xprt = svc_xprt_dequeue(pool); | 647 | xprt = svc_xprt_dequeue(pool); |
660 | if (xprt) { | 648 | if (xprt) { |
661 | rqstp->rq_xprt = xprt; | 649 | rqstp->rq_xprt = xprt; |
@@ -1204,16 +1192,15 @@ static int svc_pool_stats_show(struct seq_file *m, void *p) | |||
1204 | struct svc_pool *pool = p; | 1192 | struct svc_pool *pool = p; |
1205 | 1193 | ||
1206 | if (p == SEQ_START_TOKEN) { | 1194 | if (p == SEQ_START_TOKEN) { |
1207 | seq_puts(m, "# pool packets-arrived sockets-enqueued threads-woken overloads-avoided threads-timedout\n"); | 1195 | seq_puts(m, "# pool packets-arrived sockets-enqueued threads-woken threads-timedout\n"); |
1208 | return 0; | 1196 | return 0; |
1209 | } | 1197 | } |
1210 | 1198 | ||
1211 | seq_printf(m, "%u %lu %lu %lu %lu %lu\n", | 1199 | seq_printf(m, "%u %lu %lu %lu %lu\n", |
1212 | pool->sp_id, | 1200 | pool->sp_id, |
1213 | pool->sp_stats.packets, | 1201 | pool->sp_stats.packets, |
1214 | pool->sp_stats.sockets_queued, | 1202 | pool->sp_stats.sockets_queued, |
1215 | pool->sp_stats.threads_woken, | 1203 | pool->sp_stats.threads_woken, |
1216 | pool->sp_stats.overloads_avoided, | ||
1217 | pool->sp_stats.threads_timedout); | 1204 | pool->sp_stats.threads_timedout); |
1218 | 1205 | ||
1219 | return 0; | 1206 | return 0; |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 4a8f6558718a..d8c041114497 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -655,23 +655,25 @@ static struct unix_gid *unix_gid_lookup(uid_t uid) | |||
655 | return NULL; | 655 | return NULL; |
656 | } | 656 | } |
657 | 657 | ||
658 | static int unix_gid_find(uid_t uid, struct group_info **gip, | 658 | static struct group_info *unix_gid_find(uid_t uid, struct svc_rqst *rqstp) |
659 | struct svc_rqst *rqstp) | ||
660 | { | 659 | { |
661 | struct unix_gid *ug = unix_gid_lookup(uid); | 660 | struct unix_gid *ug; |
661 | struct group_info *gi; | ||
662 | int ret; | ||
663 | |||
664 | ug = unix_gid_lookup(uid); | ||
662 | if (!ug) | 665 | if (!ug) |
663 | return -EAGAIN; | 666 | return ERR_PTR(-EAGAIN); |
664 | switch (cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle)) { | 667 | ret = cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle); |
668 | switch (ret) { | ||
665 | case -ENOENT: | 669 | case -ENOENT: |
666 | *gip = NULL; | 670 | return ERR_PTR(-ENOENT); |
667 | return 0; | ||
668 | case 0: | 671 | case 0: |
669 | *gip = ug->gi; | 672 | gi = get_group_info(ug->gi); |
670 | get_group_info(*gip); | ||
671 | cache_put(&ug->h, &unix_gid_cache); | 673 | cache_put(&ug->h, &unix_gid_cache); |
672 | return 0; | 674 | return gi; |
673 | default: | 675 | default: |
674 | return -EAGAIN; | 676 | return ERR_PTR(-EAGAIN); |
675 | } | 677 | } |
676 | } | 678 | } |
677 | 679 | ||
@@ -681,6 +683,8 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) | |||
681 | struct sockaddr_in *sin; | 683 | struct sockaddr_in *sin; |
682 | struct sockaddr_in6 *sin6, sin6_storage; | 684 | struct sockaddr_in6 *sin6, sin6_storage; |
683 | struct ip_map *ipm; | 685 | struct ip_map *ipm; |
686 | struct group_info *gi; | ||
687 | struct svc_cred *cred = &rqstp->rq_cred; | ||
684 | 688 | ||
685 | switch (rqstp->rq_addr.ss_family) { | 689 | switch (rqstp->rq_addr.ss_family) { |
686 | case AF_INET: | 690 | case AF_INET: |
@@ -721,6 +725,17 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) | |||
721 | ip_map_cached_put(rqstp, ipm); | 725 | ip_map_cached_put(rqstp, ipm); |
722 | break; | 726 | break; |
723 | } | 727 | } |
728 | |||
729 | gi = unix_gid_find(cred->cr_uid, rqstp); | ||
730 | switch (PTR_ERR(gi)) { | ||
731 | case -EAGAIN: | ||
732 | return SVC_DROP; | ||
733 | case -ENOENT: | ||
734 | break; | ||
735 | default: | ||
736 | put_group_info(cred->cr_group_info); | ||
737 | cred->cr_group_info = gi; | ||
738 | } | ||
724 | return SVC_OK; | 739 | return SVC_OK; |
725 | } | 740 | } |
726 | 741 | ||
@@ -817,19 +832,11 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp) | |||
817 | slen = svc_getnl(argv); /* gids length */ | 832 | slen = svc_getnl(argv); /* gids length */ |
818 | if (slen > 16 || (len -= (slen + 2)*4) < 0) | 833 | if (slen > 16 || (len -= (slen + 2)*4) < 0) |
819 | goto badcred; | 834 | goto badcred; |
820 | if (unix_gid_find(cred->cr_uid, &cred->cr_group_info, rqstp) | 835 | cred->cr_group_info = groups_alloc(slen); |
821 | == -EAGAIN) | 836 | if (cred->cr_group_info == NULL) |
822 | return SVC_DROP; | 837 | return SVC_DROP; |
823 | if (cred->cr_group_info == NULL) { | 838 | for (i = 0; i < slen; i++) |
824 | cred->cr_group_info = groups_alloc(slen); | 839 | GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); |
825 | if (cred->cr_group_info == NULL) | ||
826 | return SVC_DROP; | ||
827 | for (i = 0; i < slen; i++) | ||
828 | GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); | ||
829 | } else { | ||
830 | for (i = 0; i < slen ; i++) | ||
831 | svc_getnl(argv); | ||
832 | } | ||
833 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { | 840 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
834 | *authp = rpc_autherr_badverf; | 841 | *authp = rpc_autherr_badverf; |
835 | return SVC_DENIED; | 842 | return SVC_DENIED; |