[RFC,PATCH 3/4] Dynamic Pseudo Root

Steve Dickson SteveD at redhat.com
Fri Dec 7 14:22:48 EST 2007


commit e9a8e458a9f13a1e1818394dd430a4e271a1cd9f
Author: Steve Dickson <steved at redhat.com>
Date:   Mon Dec 3 08:08:51 2007 -0500

    Added the '-R' command line option that caused mountd to
    dynamically export a pseudo root for v4 mounts.
    
    Signed-off-by: Steve Dickson <steved at redhat.com>
---
 support/export/v4root.c |    2 +-
 support/export/xtab.c   |    4 ++--
 utils/mountd/mountd.c   |    7 ++++++-
 utils/mountd/mountd.man |    6 ++++++
 4 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/support/export/v4root.c b/support/export/v4root.c
index c91fe8d..77f8904 100644
--- a/support/export/v4root.c
+++ b/support/export/v4root.c
@@ -29,7 +29,7 @@ void v4root_destroy(void);
 void v4root_create(void);
 void v4root_umountall(void);
 
-int need_v4root;
+int need_v4root, check_v4root;
 static char errbuf[BUFSIZ];
 static int v4root_mkroot(void);
 static int v4root_mkroot(void);
diff --git a/support/export/xtab.c b/support/export/xtab.c
index bdc76c9..f5fe541 100644
--- a/support/export/xtab.c
+++ b/support/export/xtab.c
@@ -20,7 +20,7 @@
 #include "xio.h"
 #include "xlog.h"
 
-extern int need_v4root, clean_v4root;
+extern int need_v4root, clean_v4root, check_v4root;
 static void cond_rename(char *newfile, char *oldfile);
 
 static int
@@ -37,7 +37,7 @@ xtab_read(char *xtab, int is_export)
 	if ((lockid = xflock(xtab, "r")) < 0)
 		return 0;
 	setexportent(xtab, "r");
-	if (is_export == 1) 
+	if (check_v4root && is_export == 1)
 		need_v4root = 1;
 	while ((xp = getexportent(is_export==0, 0)) != NULL) {
 		if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index a7f3592..9f36549 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -41,6 +41,7 @@ int reverse_resolve = 0;
 int new_cache = 0;
 int manage_gids;
 int use_ipaddr = -1;
+extern int check_v4root;
 
 /* PRC: a high-availability callout program can be specified with -H
  * When this is done, the program will receive callouts whenever clients
@@ -71,6 +72,7 @@ static struct option longopts[] =
 	{ "num-threads", 1, 0, 't' },
 	{ "reverse-lookup", 0, 0, 'r' },
 	{ "manage-gids", 0, 0, 'g' },
+	{ "v4-root", 0, 0, 'R' },
 	{ NULL, 0, 0, 0 }
 };
 
@@ -571,7 +573,7 @@ main(int argc, char **argv)
 
 	/* Parse the command line options and arguments. */
 	opterr = 0;
-	while ((c = getopt_long(argc, argv, "o:nFd:f:p:P:hH:N:V:vrs:t:g", longopts, NULL)) != EOF)
+	while ((c = getopt_long(argc, argv, "o:nFd:f:p:P:hH:N:V:vRrs:t:g", longopts, NULL)) != EOF)
 		switch (c) {
 		case 'g':
 			manage_gids = 1;
@@ -614,6 +616,9 @@ main(int argc, char **argv)
 		case 'n':
 			_rpcfdtype = SOCK_DGRAM;
 			break;
+		case 'R':
+			check_v4root = 1;
+			break;
 		case 'r':
 			reverse_resolve = 1;
 			break;
diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man
index 4276663..db50ac7 100644
--- a/utils/mountd/mountd.man
+++ b/utils/mountd/mountd.man
@@ -125,6 +125,12 @@ If this option is not specified the default of
 .BR /var/lib/nfs
 is used.
 .TP
+.BI "\-R," "" " \-\-v4\-root"
+This option will have mountd create a dynamic pseudo root which
+eliminates the need to explicitly define a pseudo with the
+'fsid=0' option. This allows exports to be accessible 
+by NFS v4 mounts as they are with NFS v2 and v3 mounts.
+.TP
 .BI "\-r," "" " \-\-reverse\-lookup"
 mountd tracks IP addresses in the rmtab, and when a DUMP request is made (by
 someone running showmount -a, for instance), it returns IP addresses instead



More information about the NFSv4 mailing list