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