Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 533aea79872ccd7be2635d272acbf7ea > files > 37

autofs-5.0.1-0.rc2.163.el5.src.rpm

autofs-5.0.1 - dont fail mount on access fail

From: Ian Kent <raven@themaw.net>

If we encounter a recursive autofs mount in the mount location
path, and call access(2) to perform the mount, the mount may
succeed but the access(2) call return a fail. In the case where
there are multiple processes waiting on this mount they will all
get the failure return which may be incorrect for other waiters.
Ignoring the return code from the access(2) call and allowing the
mount to go ahead anyway should give the VFS the chance to check
the access for each individual process and so return an accurate
retult.
---

 daemon/spawn.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)


--- autofs-5.0.1.orig/daemon/spawn.c
+++ autofs-5.0.1/daemon/spawn.c
@@ -189,9 +189,15 @@ static int do_spawn(unsigned logopt, uns
 			}
 			setpgrp();
 
-			/* Trigger the recursive mount */
-			if (access(argv[loc], F_OK) == -1)
-				_exit(errno);
+			/*
+			 * Trigger the recursive mount.
+			 *
+			 * Ignore the access(2) return code as there may be
+			 * multiple waiters for this mount and we need to
+			 * let the  VFS handle access returns to each
+			 * individual waiter.
+			 */
+			access(argv[loc], F_OK);
 
 			seteuid(0);
 			setegid(0);