If you have a wildcard entry in an automount map and refer to an entry which does not exist on the NFS server the entry actually appears within the autofs tree (but with nothing mounted on it).

This causes havoc if you are testing for the existence of a directory in an automount point.

It took a while to track it down, since all of the code to remove the locally-created dir if the mount failed was in place. I eventually found an incorrect reuse of a status variable, which is overwriting the return code from the mount (failed), with that of a mutex unlock (which must succeed, or the process dies..).

   This happens in daemon/spawn.c

   Patch (against distro as on 10 Nov 2006) attached.
--- daemon/spawn.c.orig 2006-11-10 10:28:47.270474000 +0000
+++ daemon/spawn.c      2006-11-10 10:11:22.917315000 +0000
@@ -202,11 +202,25 @@
                if (waitpid(f, &status, 0) != f)
                        status = -1;    /* waitpid() failed */
 
-               if (use_lock) {
+/* GML - Bug.
+ *  This code used status, hence wiping out the result of the mount!
+ *  Hence we always return from here with success, even when the
+ *  mount actually fails, meaning we get directories created for
+ *  non-existent entries...
+ */
+#if 0 
+               if (use_lock) {
                        status = pthread_mutex_unlock(&spawn_mutex);
                        if (status)
                                fatal(status);
                }
+#endif
+               if (use_lock) {
+                        int lstatus;
+                       lstatus = pthread_mutex_unlock(&spawn_mutex);
+                       if (lstatus)
+                               fatal(lstatus);
+               }
                pthread_sigmask(SIG_SETMASK, &oldsig, NULL);
                pthread_setcancelstate(cancel_state, NULL);
 
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to