mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
12045a6ee9
commit
eb4c86c6a5
|
@ -1425,6 +1425,7 @@ static struct flags {
|
|||
{ NFSEXP_CROSSMOUNT, {"crossmnt", ""}},
|
||||
{ NFSEXP_NOSUBTREECHECK, {"no_subtree_check", ""}},
|
||||
{ NFSEXP_NOAUTHNLM, {"insecure_locks", ""}},
|
||||
{ NFSEXP_V4ROOT, {"v4root", ""}},
|
||||
#ifdef MSNFS
|
||||
{ NFSEXP_MSNFS, {"msnfs", ""}},
|
||||
#endif
|
||||
|
|
|
@ -39,6 +39,16 @@
|
|||
#define NFSEXP_FSID 0x2000
|
||||
#define NFSEXP_CROSSMOUNT 0x4000
|
||||
#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
|
||||
/*
|
||||
* The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4
|
||||
* clients, and only to the single directory that is the root of the
|
||||
* export; further lookup and readdir operations are treated as if every
|
||||
* subdirectory was a mountpoint, and ignored if they are not themselves
|
||||
* exported. This is used by nfsd and mountd to construct the NFSv4
|
||||
* pseudofilesystem, which provides access only to paths leading to each
|
||||
* exported filesystem.
|
||||
*/
|
||||
#define NFSEXP_V4ROOT 0x10000
|
||||
/* All flags that we claim to support. (Note we don't support NOACL.) */
|
||||
#define NFSEXP_ALLFLAGS 0x7E3F
|
||||
|
||||
|
|
Loading…
Reference in New Issue