Ian Kent 957595
autofs-5.0.5 - dont fail mount on access fail
Ian Kent 957595
Ian Kent 957595
From: Ian Kent <raven@themaw.net>
Ian Kent 957595
Ian Kent 957595
If we encounter a recursive autofs mount in the mount location
Ian Kent 957595
path, and call access(2) to perform the mount, the mount may
Ian Kent 957595
succeed but the access(2) call return a fail. In the case where
Ian Kent 957595
there are multiple processes waiting on this mount they will all
Ian Kent 957595
get the failure return which may be incorrect for other waiters.
Ian Kent 957595
Ignoring the return code from the access(2) call and allowing the
Ian Kent 957595
mount to go ahead anyway should give the VFS the chance to check
Ian Kent 957595
the access for each individual process and so return an accurate
Ian Kent 957595
retult.
Ian Kent 957595
---
Ian Kent 957595
Ian Kent 957595
 CHANGELOG      |    1 +
Ian Kent 957595
 daemon/spawn.c |   12 +++++++++---
Ian Kent 957595
 2 files changed, 10 insertions(+), 3 deletions(-)
Ian Kent 957595
Ian Kent 957595
Ian Kent 957595
diff --git a/CHANGELOG b/CHANGELOG
Ian Kent 957595
index 8429e20..88bcc1b 100644
Ian Kent 957595
--- a/CHANGELOG
Ian Kent 957595
+++ b/CHANGELOG
Ian Kent 957595
@@ -14,6 +14,7 @@
Ian Kent 957595
 - fix timeout in connect_nb().
Ian Kent 957595
 - fix pidof init script usage.
Ian Kent 957595
 - check for path mount location in generic module.
Ian Kent 957595
+- dont fail mount on access fail.
Ian Kent 957595
 
Ian Kent 957595
 03/09/2009 autofs-5.0.5
Ian Kent 957595
 -----------------------
Ian Kent 957595
diff --git a/daemon/spawn.c b/daemon/spawn.c
Ian Kent 957595
index 7c254d9..285f4d7 100644
Ian Kent 957595
--- a/daemon/spawn.c
Ian Kent 957595
+++ b/daemon/spawn.c
Ian Kent 957595
@@ -189,9 +189,15 @@ static int do_spawn(unsigned logopt, unsigned int wait,
Ian Kent 957595
 			}
Ian Kent 957595
 			setpgrp();
Ian Kent 957595
 
Ian Kent 957595
-			/* Trigger the recursive mount */
Ian Kent 957595
-			if (access(argv[loc], F_OK) == -1)
Ian Kent 957595
-				_exit(errno);
Ian Kent 957595
+			/*
Ian Kent 957595
+			 * Trigger the recursive mount.
Ian Kent 957595
+			 *
Ian Kent 957595
+			 * Ignore the access(2) return code as there may be
Ian Kent 957595
+			 * multiple waiters for this mount and we need to
Ian Kent 957595
+			 * let the  VFS handle access returns to each
Ian Kent 957595
+			 * individual waiter.
Ian Kent 957595
+			 */
Ian Kent 957595
+			access(argv[loc], F_OK);
Ian Kent 957595
 
Ian Kent 957595
 			seteuid(0);
Ian Kent 957595
 			setegid(0);