nfs-utils/6001-ignore-EBUSY-when-a-filesystem-is-already-mount.patch

63 lines
1.9 KiB
Diff
Raw Normal View History

2019-09-30 11:09:50 -04:00
From 62796bf26e196da724f86bcbc327f5f9f999d305 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 14:53:30 +0800
Subject: [PATCH] backport ignore EBUSY when a filesystem is already mount
---
utils/mount/Makefile.am | 1 +
utils/mount/stropts.c | 17 +++++++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am
index 7b97c31..ad0be93 100644
--- a/utils/mount/Makefile.am
+++ b/utils/mount/Makefile.am
@@ -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 --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 4d2e37e..5333498 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -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_info *mi)
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;
--
1.8.3.1