Blame SOURCES/nfs-utils-1.3.0-mountd-root.patch

e19a30
commit 710a492fda68092a02d6360d7a185f6a4dcaea85
e19a30
Author: NeilBrown <neilb@suse.de>
e19a30
Date:   Thu Feb 26 14:10:35 2015 -0500
e19a30
e19a30
    exports.man: improve documentation of 'nohide' and 'crossmnt'
e19a30
    
e19a30
    - note that 'nohide' is irrelevant for NFSv4
e19a30
    - note that children on a 'crossmnt' filesystem cannot be unexported
e19a30
    - note that 'nocrossmnt' is a valid option, but probably not useful.
e19a30
    
e19a30
    Signed-off-by: NeilBrown <neilb@suse.de>
e19a30
    Signed-off-by: Steve Dickson <steved@redhat.com>
e19a30
e19a30
diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man
e19a30
index 59358e6..9309246 100644
e19a30
--- a/utils/exportfs/exports.man
e19a30
+++ b/utils/exportfs/exports.man
e19a30
@@ -218,16 +218,46 @@ This option can be very useful in some situations, but it should be
e19a30
 used with due care, and only after confirming that the client system
e19a30
 copes with the situation effectively.
e19a30
 
e19a30
-The option can be explicitly disabled with
e19a30
+The option can be explicitly disabled for NFSv2 and NFSv3 with
e19a30
 .IR hide .
e19a30
+
e19a30
+This option is not relevant when NFSv4 is use.  NFSv4 never hides
e19a30
+subordinate filesystems.  Any filesystem that is exported will be
e19a30
+visible where expected when using NFSv4.
e19a30
 .TP
e19a30
-.IR crossmnt
e19a30
+.I crossmnt
e19a30
 This option is similar to
e19a30
 .I nohide
e19a30
-but it makes it possible for clients to move from the filesystem marked
e19a30
-with crossmnt to exported filesystems mounted on it.  Thus when a child
e19a30
-filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has
e19a30
-the same effect as setting "nohide" on B.
e19a30
+but it makes it possible for clients to access all filesystems mounted
e19a30
+on a filesystem marked with
e19a30
+.IR crossmnt .
e19a30
+Thus when a child filesystem "B" is mounted on a parent "A", setting
e19a30
+crossmnt on "A" has a similar effect to setting "nohide" on B.
e19a30
+
e19a30
+With
e19a30
+.I nohide
e19a30
+the child filesystem needs to be explicitly exported.  With
e19a30
+.I crossmnt
e19a30
+it need not.  If a child of a
e19a30
+.I crossmnt
e19a30
+file is not explicitly exported, then it will be implicitly exported
e19a30
+with the same export options as the parent, except for
e19a30
+.IR fsid= .
e19a30
+This makes it impossible to
e19a30
+.B not
e19a30
+export a child of a
e19a30
+.I crossmnt
e19a30
+filesystem.  If some but not all subordinate filesystems of a parent
e19a30
+are to be exported, then they must be explicitly exported and the
e19a30
+parent should not have
e19a30
+.I crossmnt
e19a30
+set.
e19a30
+
e19a30
+The
e19a30
+.I nocrossmnt
e19a30
+option can explictly disable
e19a30
+.I crossmnt
e19a30
+if it was previously set.  This is rarely useful.
e19a30
 .TP
e19a30
 .IR no_subtree_check
e19a30
 This option disables subtree checking, which has mild security
e19a30
e19a30
commit b7341b19d62481504f1820414159009535d37809
e19a30
Author: NeilBrown <neilb@suse.de>
e19a30
Date:   Wed Feb 25 16:47:56 2015 -0500
e19a30
e19a30
    mountd: fix next_mnt handling for "/"
e19a30
    
e19a30
    If the (exported) path passed to next_mnt() is simply "/", next_mnt()
e19a30
    will not report any children, as none start with "/" followed by a '/'.
e19a30
    So make a special case for strlen(p)==1.  In that case, return all
e19a30
    children.
e19a30
    
e19a30
    This gives correct handling if only "/" is exported.
e19a30
    
e19a30
    Signed-off-by: NeilBrown <neilb@suse.de>
e19a30
    Signed-off-by: Steve Dickson <steved@redhat.com>
e19a30
e19a30
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
e19a30
index 1430aee..23af4a9 100644
e19a30
--- a/utils/mountd/cache.c
e19a30
+++ b/utils/mountd/cache.c
e19a30
@@ -365,7 +365,7 @@ static char *next_mnt(void **v, char *p)
e19a30
 		*v = f;
e19a30
 	} else
e19a30
 		f = *v;
e19a30
-	while ((me = getmntent(f)) != NULL &&
e19a30
+	while ((me = getmntent(f)) != NULL && l > 1 &&
e19a30
 	       (strncmp(me->mnt_dir, p, l) != 0 ||
e19a30
 		me->mnt_dir[l] != '/'))
e19a30
 		;
e19a30
e19a30
commit 7e27d4a542bf97e0ddc1036010e1b2d218a01c2b
e19a30
Author: Vivek Trivedi <t.vivek@samsung.com>
e19a30
Date:   Wed Sep 16 11:14:03 2015 -0400
e19a30
e19a30
    mountd: fix mount issue due to comparison with uninitialized uuid
e19a30
    
e19a30
    Fix mount issue due to comparison of uninitialized variable
e19a30
    u(uuid) with parsed->fhuuid when uuid_by_path return 0.
e19a30
    
e19a30
    /tmp/usb
e19a30
    192.168.1.0/16(ro,no_root_squash,no_subtree_check,fsid=0)
e19a30
    /tmp/usb/sda1       192.168.1.0/16(ro,no_root_squash,no_subtree_check)
e19a30
    /tmp/usb/sdb1       192.168.1.0/16(ro,no_root_squash,no_subtree_check)
e19a30
    
e19a30
    mount -t nfs -o nolock,nfsvers=3 192.168.1.2:/tmp/usb/sda1 /tmp/sda1
e19a30
    mount -t nfs -o nolock,nfsvers=3 192.168.1.2:/tmp/usb/sdb1 /tmp/sdb1
e19a30
    
e19a30
    results in below mountd error:
e19a30
    mountd: /tmp/usb and /tmp/usb/sdb1 have same filehandle for
e19a30
    192.168.1.0/16, using first
e19a30
    
e19a30
    when uuid_by_path returned 0, by chance, garbage value of u was same as
e19a30
    parsed->fhuuid(of sdb1), and comparison of these resulted in above
e19a30
    error.
e19a30
    
e19a30
    Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
e19a30
    Reviewed-by: Amit Sahrawat <a.sahrawat@samsung.com>
e19a30
    Signed-off-by: Steve Dickson <steved@redhat.com>
e19a30
e19a30
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
e19a30
index 9a1bb27..1430aee 100644
e19a30
--- a/utils/mountd/cache.c
e19a30
+++ b/utils/mountd/cache.c
e19a30
@@ -547,18 +547,17 @@ static bool match_fsid(struct parsed_fsid *parsed, nfs_export *exp, char *path)
e19a30
 		if (!is_mountpoint(path))
e19a30
 			return false;
e19a30
 	check_uuid:
e19a30
-		if (exp->m_export.e_uuid)
e19a30
+		if (exp->m_export.e_uuid) {
e19a30
 			get_uuid(exp->m_export.e_uuid, parsed->uuidlen, u);
e19a30
+			if (memcmp(u, parsed->fhuuid, parsed->uuidlen) == 0)
e19a30
+				return true;
e19a30
+		}
e19a30
 		else
e19a30
 			for (type = 0;
e19a30
 			     uuid_by_path(path, type, parsed->uuidlen, u);
e19a30
 			     type++)
e19a30
 				if (memcmp(u, parsed->fhuuid, parsed->uuidlen) == 0)
e19a30
 					return true;
e19a30
-
e19a30
-		if (memcmp(u, parsed->fhuuid, parsed->uuidlen) != 0)
e19a30
-			return false;
e19a30
-		return true;
e19a30
 	}
e19a30
 	/* Well, unreachable, actually: */
e19a30
 	return false;