Blame SOURCES/nfs-utils-2.3.3-mount-sharecache.patch

bc9fd4
diff -up nfs-utils-2.3.3/utils/mount/Makefile.am.orig nfs-utils-2.3.3/utils/mount/Makefile.am
bc9fd4
--- nfs-utils-2.3.3/utils/mount/Makefile.am.orig	2018-09-06 14:09:08.000000000 -0400
bc9fd4
+++ nfs-utils-2.3.3/utils/mount/Makefile.am	2018-10-25 10:27:33.881804941 -0400
bc9fd4
@@ -27,6 +27,7 @@ endif
bc9fd4
 
bc9fd4
 mount_nfs_LDADD = ../../support/nfs/libnfs.la \
bc9fd4
 		  ../../support/export/libexport.a \
bc9fd4
+		  ../../support/misc/libmisc.a \
bc9fd4
 		  $(LIBTIRPC)
bc9fd4
 
bc9fd4
 mount_nfs_SOURCES = $(mount_common)
bc9fd4
diff -up nfs-utils-2.3.3/utils/mount/stropts.c.orig nfs-utils-2.3.3/utils/mount/stropts.c
bc9fd4
--- nfs-utils-2.3.3/utils/mount/stropts.c.orig	2018-09-06 14:09:08.000000000 -0400
bc9fd4
+++ nfs-utils-2.3.3/utils/mount/stropts.c	2018-10-25 10:27:59.733825016 -0400
bc9fd4
@@ -48,6 +48,7 @@
bc9fd4
 #include "version.h"
bc9fd4
 #include "parse_dev.h"
bc9fd4
 #include "conffile.h"
bc9fd4
+#include "misc.h"
bc9fd4
 
bc9fd4
 #ifndef NFS_PROGRAM
bc9fd4
 #define NFS_PROGRAM	(100003)
bc9fd4
@@ -1078,14 +1079,18 @@ static int nfsmount_fg(struct nfsmount_i
bc9fd4
 		if (nfs_try_mount(mi))
bc9fd4
 			return EX_SUCCESS;
bc9fd4
 
bc9fd4
-		if (errno == EBUSY)
bc9fd4
-			/* The only cause of EBUSY is if exactly the desired
bc9fd4
-			 * filesystem is already mounted.  That can arguably
bc9fd4
-			 * be seen as success.  "mount -a" tries to optimise
bc9fd4
-			 * out this case but sometimes fails.  Help it out
bc9fd4
-			 * by pretending everything is rosy
bc9fd4
+#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
bc9fd4
+		if (errno == EBUSY && is_mountpoint(mi->node)) {
bc9fd4
+#pragma GCC diagnostic warning "-Wdiscarded-qualifiers"
bc9fd4
+			/*
bc9fd4
+			 * EBUSY can happen when mounting a filesystem that
bc9fd4
+			 * is already mounted or when the context= are
bc9fd4
+			 * different when using the -o sharecache
bc9fd4
+			 *
bc9fd4
+			 * Only error out in the latter case.
bc9fd4
 			 */
bc9fd4
 			return EX_SUCCESS;
bc9fd4
+		}
bc9fd4
 
bc9fd4
 		if (nfs_is_permanent_error(errno))
bc9fd4
 			break;