Skip to contentSkip to conversation

mount.nfs - hide EBUSY errors.

PATCH In review NeilBrown 2 participants 2 messages Feb 18, 2016 – Mar 16, 2016

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 mount.nfs - hide EBUSY errors.

Linux only returns EBUSY for a non-remount mount if the exact requested filesystem is already mounted. Arguably this is not an error.

"mount -a" tries to see if each requested filesystem is already mounted. Sometimes it gets it wrong - e.g. hostname aliases can confuse it. So "mount -a" will report a failure "already mounted", which is wrong because it should filter those out.

An easy fix it just to be silent about EBUSY. As the requested result (a given filesystem being mounted at a given location) is in effect after the EBUSY return, we can just treat it as success.

This removes the confusing "already mounted" errors.

---
 utils/mount/stropts.c | 9 +++++++++
 1 file changed, 9 insertions(+)
utils/mount/stropts.c +9 -0
index 86829a902bfd..320dde2fab92 100644
@@ -960,6 +960,15 @@ 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
+			 */
+			return EX_SUCCESS;
+
 		if (nfs_is_permanent_error(errno))
 			break;
 
Signature · 1 line
2.7.1
#1 lore raw
Quoted 10 lines · NeilBrown

Linux only returns EBUSY for a non-remount mount if the exact requested filesystem is already mounted. Arguably this is not an error.

"mount -a" tries to see if each requested filesystem is already mounted. Sometimes it gets it wrong - e.g. hostname aliases can confuse it. So "mount -a" will report a failure "already mounted", which is wrong because it should filter those out.

Quoted 7 lines

An easy fix it just to be silent about EBUSY. As the requested result (a given filesystem being mounted at a given location) is in effect after the EBUSY return, we can just treat it as success.

This removes the confusing "already mounted" errors.

Committed...

steved.

Quoted 25 lines
---
 utils/mount/stropts.c | 9 +++++++++
 1 file changed, 9 insertions(+)
utils/mount/stropts.c +9 -0
index 86829a902bfd..320dde2fab92 100644
@@ -960,6 +960,15 @@ 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
+			 */
+			return EX_SUCCESS;
+
 		if (nfs_is_permanent_error(errno))
 			break;