aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dickson <SteveD@redhat.com>2009-09-09 14:58:22 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-12-15 14:00:40 -0500
commiteb4c86c6a5adec423c9e615d4937fdddd06a16c5 (patch)
tree50aee7013c9ca92cce9828268af4ee3d220a416c
parent12045a6ee9908b38b6d286530c7d816e39071346 (diff)
nfsd: introduce export flag for v4 pseudoroot
NFSv4 differs from v2 and v3 in that it presents a single unified filesystem tree, whereas v2 and v3 exported multiple filesystem (whose roots could be found using a separate mount protocol). Our original NFSv4 server implementation asked the administrator to designate a single filesystem as the NFSv4 root, then to mount filesystems they wished to export underneath. (Often using bind mounts of already-existing filesystems.) This was conceptually simple, and allowed easy implementation, but created a serious obstacle to upgrading between v2/v3: since the paths to v4 filesystems were different, administrators would have to adjust all the paths in client-side mount commands when switching to v4. Various workarounds are possible. For example, the administrator could export "/" and designate it as the v4 root. However, the security risks of that approach are obvious, and in any case we shouldn't be requiring the administrator to take extra steps to fix this problem; instead, the server should present consistent paths across different versions by default. These patches take a modified version of that approach: we provide a new export option which exports only a subset of a filesystem. With this flag, it becomes safe for mountd to export "/" by default, with no need for additional configuration. We begin just by defining the new flag. Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/export.c1
-rw-r--r--include/linux/nfsd/export.h10
2 files changed, 11 insertions, 0 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index cb3dae2fcd86..c64d55f319bd 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1425,6 +1425,7 @@ static struct flags {
1425 { NFSEXP_CROSSMOUNT, {"crossmnt", ""}}, 1425 { NFSEXP_CROSSMOUNT, {"crossmnt", ""}},
1426 { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}}, 1426 { NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
1427 { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}}, 1427 { NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
1428 { NFSEXP_V4ROOT, {"v4root", ""}},
1428#ifdef MSNFS 1429#ifdef MSNFS
1429 { NFSEXP_MSNFS, {"msnfs", ""}}, 1430 { NFSEXP_MSNFS, {"msnfs", ""}},
1430#endif 1431#endif
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 4cafbe1255f0..41f0d4e25374 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -39,6 +39,16 @@
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/*
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
42/* All flags that we claim to support. (Note we don't support NOACL.) */ 52/* All flags that we claim to support. (Note we don't support NOACL.) */
43#define NFSEXP_ALLFLAGS 0x7E3F 53#define NFSEXP_ALLFLAGS 0x7E3F
44 54