Hi Mike,

I have attached a patch I'd like you to try please.

I think I`ve been able to duplicate the problem here between my Gentoo 2.4 kernel and my Debian 2.4 kernel systems. I've had trouble with NFS export permissions between my FC2 2.6 and the Debian 2.4 systems so I can't be sure about it.

I've used the patch, as an additional patch after all the others, to build rpms with Jefs' autofs-4.1.3-16 and autofs-4.1.3-55.1 source rpms so I hope it will apply OK to the rpm you are using.

On Wed, 12 Jan 2005, David Meleedy wrote:


Mike, I just recompiled my kernel with your xprt-sharing.patch. Although this did fix the port error problems, it did not fix the automounter problem. So I think your patch should be incorporated into Redhat Enterprise 3 (2.4 kernel) because it appears to work.

I think the problem is that the automounter just cannot unmount
the /net/aflac directory, and ends up trying to remount it instead,
here are the log files after the port patch that Mike gave me:
(this is during the reboot after cd'ing to /net/aflac/vol/vol2)

Jan 12 19:23:36 codered automount[5396]: can't shutdown: filesystem /net still
busy
Jan 12 19:23:38 codered autofs: automount -USR2 succeeded
Jan 12 19:23:41 codered automount[5396]: can't shutdown: filesystem /net still
busy
... those lines keep repeating until ....

Jan 12 19:24:08 codered automount[16092]: >> mount table full
Jan 12 19:24:08 codered automount[16092]: mount(nfs): nfs: mount failure
aflac:/vol/vol3/cad_archive on /net/aflac/vol/vol3/cad_archive
Jan 12 19:24:08 codered automount[16092]: >> mount table full
Jan 12 19:24:08 codered automount[16092]: mount(nfs): nfs: mount failure
aflac:/vol/vol3/design on /net/aflac/vol/vol3/design
... those lines repeart for each subdirectory of the volumes ...

Jan 12 19:24:09 codered autofs: automount shutdown failed

As you can see, it keeps trying to unmount /net, and eventually
fills up the mount table because it instead remounts it.  Before,
when the port issue was a problem, it wouldn't get far enough to
fill the mount table, but now it can (thanks Mike!)

-Dave

________________________________________________________________________
David Meleedy                           Analog Devices, Inc.
[EMAIL PROTECTED]               Three Technology Way
Phone: 781 461 3494                     Norwood, MA  02062-9106  USA


_______________________________________________ autofs mailing list [email protected] http://linux.kernel.org/mailman/listinfo/autofs

--- autofs-4.1.3/modules/parse_sun.c.multi-over 2005-01-14 19:44:39.000000000 
+0800
+++ autofs-4.1.3/modules/parse_sun.c    2005-01-14 20:36:17.000000000 +0800
@@ -55,6 +55,13 @@
        int slashify_colons;    /* Change colons to slashes? */
 };
 
+struct multi_mnt {
+       char *path;
+       char *options;
+       char *location;
+       struct multi_mnt *next;
+};
+
 struct utsname un;
 char processor[65];            /* Not defined on Linux, so we make our own */
 
@@ -609,6 +616,69 @@
 }
 
 /*
+ * Build list of mounts in shortest -> longest order.
+ * Pass in list head and return list head.
+ */
+struct multi_mnt *multi_add_list(struct multi_mnt *list,
+                                char *path, char *options, char *location)
+{
+       struct multi_mnt *mmptr, *new, *old = NULL;
+       int plen;
+
+       if (!path || !options || !location)
+               return NULL;
+
+       new = malloc(sizeof(struct multi_mnt));
+       if (!new)
+               return NULL;
+
+       new->path = path;
+       new->options = options;
+       new->location = location;
+
+       plen = strlen(path);
+       mmptr = list;
+       while (mmptr) {
+               if (plen <= strlen(mmptr->path))
+                       break;
+               old = mmptr;
+               mmptr = mmptr->next;
+       }
+
+       if (old)
+               old->next = new;
+       new->next = mmptr;
+
+       return old ? list : new;
+}
+
+void multi_free_list(struct multi_mnt *list)
+{
+       struct multi_mnt *next;
+
+       if (!list)
+               return;
+
+       next = list;
+       while (next) {
+               struct multi_mnt *this = next;
+
+               next = this->next;
+
+               if (this->path)
+                       free(this->path);
+
+               if (this->options)
+                       free(this->options);
+
+               if (this->location)
+                       free(this->location);
+
+               free(this);
+       }
+}
+
+/*
  * syntax is:
  *     [-options] location [location] ...
  *     [-options] [mountpoint [-options] location [location] ... ]...
@@ -661,6 +731,7 @@
        debug(MODPREFIX "gathered options: %s", options);
 
        if (*p == '/') {
+               struct multi_mnt *list, *head = NULL, *next;
                int l;
                char *multi_root;
 
@@ -684,11 +755,11 @@
                        if (myoptions == NULL) {
                                error(MODPREFIX "multi strdup: %m");
                                free(options);
+                               multi_free_list(head);
                                return 1;
                        }
 
                        path = dequote(p, l = chunklen(p, 0));
-                       pathlen = strlen(path);
 
                        p += l;
                        p = skipspace(p);
@@ -706,6 +777,7 @@
                                                    "multi concat_options: %m");
                                                free(options);
                                                free(path);
+                                               multi_free_list(head);
                                                return 1;
                                        }
                                        p = skipspace(p);
@@ -721,28 +793,42 @@
                        l = q - p;
 
                        loc = dequote(p, l);
-                       loclen = strlen(loc);
-
                        if (loc == NULL || path == NULL) {
                                error(MODPREFIX "out of memory");
                                free(loc);
                                free(path);
                                free(options);
+                               free(myoptions);
+                               multi_free_list(head);
                                return 1;
                        }
 
                        p += l;
                        p = skipspace(p);
 
+                       list = head;
+                       head = multi_add_list(list, path, myoptions, loc);
+                       if (!head) {
+                               free(loc);
+                               free(path);
+                               free(options);
+                               free(myoptions);
+                               multi_free_list(head);
+                               return 1;
+                       }
+               } while (*p == '/');
+
+               next = head;
+               while (next) {
                        debug(MODPREFIX
                              "multimount: %.*s on %.*s with options %s",
-                             loclen, loc, pathlen, path, myoptions);
+                             strlen(next->location), next->location,
+                             strlen(next->path), next->path, next->options);
 
-                       rv = sun_mount(multi_root, path, pathlen, loc, loclen,
-                                      myoptions);
-                       free(path);
-                       free(loc);
-                       free(myoptions);
+                       rv = sun_mount(multi_root,
+                                      next->path, strlen(next->path),
+                                      next->location, strlen(next->location),
+                                      next->options);
 
                        /* Convert non-strict failure into success */
                        if (rv < 0) {
@@ -751,7 +837,10 @@
                        } else if (rv > 0)
                                break;
 
-               } while (*p == '/');
+                       next = next->next;
+               }
+
+               multi_free_list(head);
 
                free(options);
                return rv;
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to