* automount removes mountpoint upon exit @ 2006-07-10 10:59 Heinrich Rebehn 2006-07-10 14:28 ` Jeff Moyer 0 siblings, 1 reply; 8+ messages in thread From: Heinrich Rebehn @ 2006-07-10 10:59 UTC (permalink / raw) To: autofs Hi list, We use automount 4.1.3 in our Kubuntu cluster. In this cluster, all machines mount their nfsroot ro for security reasons, except for one "master" machine which is used to maintain the nfsroot. I discovered that every time the master machine shuts down, all the autofs mountpoints are removed. If another machine reboots while the master machine is down, autofs is unable to recreate the mountpoints and thus fails. Is there any way to keep automount from removing the mountpoint upon exit? Thanks for your help, Heinrich Rebehn University of Bremen Physics / Electrical and Electronics Engineering - Department of Telecommunications - Phone : +49/421/218-4664 Fax : -3341 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-10 10:59 automount removes mountpoint upon exit Heinrich Rebehn @ 2006-07-10 14:28 ` Jeff Moyer 2006-07-11 14:06 ` Heinrich Rebehn 0 siblings, 1 reply; 8+ messages in thread From: Jeff Moyer @ 2006-07-10 14:28 UTC (permalink / raw) To: Heinrich Rebehn; +Cc: autofs ==> Regarding [autofs] automount removes mountpoint upon exit; Heinrich Rebehn <rebehn@ant.uni-bremen.de> adds: rebehn> Hi list, rebehn> We use automount 4.1.3 in our Kubuntu cluster. In this cluster, rebehn> all machines mount their nfsroot ro for security reasons, except rebehn> for one "master" machine which is used to maintain the nfsroot. I rebehn> discovered that every time the master machine shuts down, all the rebehn> autofs mountpoints are removed. If another machine reboots while rebehn> the master machine is down, autofs is unable to recreate the rebehn> mountpoints and thus fails. rebehn> Is there any way to keep automount from removing the mountpoint rebehn> upon exit? Well, in the RHEL version of the package we added a patch that causes automount to only remove directories if it had created them. Thus, if you simply create the top-level automount points, those won't be removed by the demon exiting, However, if you rely on path components below the top-level, you are out of luck. I've attached the patch, not sure if it will apply to vanilla 4.1.3. -Jeff --- autofs-4.1.3/daemon/automount.c.no-rmdir 2005-01-21 13:04:38.153059825 -0600 +++ autofs-4.1.3/daemon/automount.c 2005-01-21 13:11:26.316690021 -0600 @@ -429,9 +429,17 @@ static int mount_autofs(char *path) ap.pipefd = ap.ioctlfd = -1; /* In case the directory doesn't exist, try to mkdir it */ - if (mkdir_path(path, 0555) < 0 && errno != EEXIST && errno != EROFS) { - crit("failed to create iautofs directory %s", ap.path); - return -1; + if (mkdir_path(path, 0555) < 0) { + if (errno != EEXIST && errno != EROFS) { + crit("failed to create iautofs directory %s", ap.path); + return -1; + } + /* If we recieve an error, and it's EEXIST or EROFS we know + the directory was not created. */ + ap.dir_created = 0; + } else { + /* No errors so the directory was successfully created */ + ap.dir_created = 1; } /* Pipe for kernel communications */ @@ -1349,7 +1357,7 @@ static void cleanup_exit(const char *pat closelog(); - if ((!ap.ghost || !submount) && *(path + 1) != '-') + if ((!ap.ghost || !submount) && (*(path + 1) != '-') && ap.dir_created) if (rmdir(path) == -1) warn("failed to remove dir %s: %m", path); @@ -1672,6 +1680,7 @@ int main(int argc, char *argv[]) ap.exp_timeout = DEFAULT_TIMEOUT; ap.ghost = DEFAULT_GHOST_MODE; ap.type = LKP_INDIRECT; + ap.dir_created = 0; /* We haven't created the main directory yet */ opterr = 0; while ((opt = getopt_long(argc, argv, "+hp:t:vdVg", long_options, NULL)) != EOF) { --- autofs-4.1.3/include/automount.h.no-rmdir 2005-01-21 13:04:38.157059762 -0600 +++ autofs-4.1.3/include/automount.h 2005-01-21 13:04:38.189059263 -0600 @@ -111,6 +111,8 @@ struct autofs_point { struct lookup_mod *lookup; /* Lookup module */ enum states state; int state_pipe[2]; + unsigned dir_created; /* Was a directory created for this + mount? */ }; /* Standard function used by daemon or modules */ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-10 14:28 ` Jeff Moyer @ 2006-07-11 14:06 ` Heinrich Rebehn 2006-07-11 14:29 ` Jeff Moyer 0 siblings, 1 reply; 8+ messages in thread From: Heinrich Rebehn @ 2006-07-11 14:06 UTC (permalink / raw) To: Jeff Moyer; +Cc: autofs Jeff Moyer wrote: > ==> Regarding [autofs] automount removes mountpoint upon exit; Heinrich Rebehn <rebehn@ant.uni-bremen.de> adds: > > rebehn> Hi list, > > rebehn> We use automount 4.1.3 in our Kubuntu cluster. In this cluster, > rebehn> all machines mount their nfsroot ro for security reasons, except > rebehn> for one "master" machine which is used to maintain the nfsroot. I > rebehn> discovered that every time the master machine shuts down, all the > rebehn> autofs mountpoints are removed. If another machine reboots while > rebehn> the master machine is down, autofs is unable to recreate the > rebehn> mountpoints and thus fails. > > rebehn> Is there any way to keep automount from removing the mountpoint > rebehn> upon exit? > > Well, in the RHEL version of the package we added a patch that causes > automount to only remove directories if it had created them. Thus, if you > simply create the top-level automount points, those won't be removed by the > demon exiting, However, if you rely on path components below the > top-level, you are out of luck. > > I've attached the patch, not sure if it will apply to vanilla 4.1.3. > > -Jeff > > --- autofs-4.1.3/daemon/automount.c.no-rmdir 2005-01-21 13:04:38.153059825 -0600 > +++ autofs-4.1.3/daemon/automount.c 2005-01-21 13:11:26.316690021 -0600 > @@ -429,9 +429,17 @@ static int mount_autofs(char *path) > ap.pipefd = ap.ioctlfd = -1; > > /* In case the directory doesn't exist, try to mkdir it */ > - if (mkdir_path(path, 0555) < 0 && errno != EEXIST && errno != EROFS) { > - crit("failed to create iautofs directory %s", ap.path); > - return -1; > + if (mkdir_path(path, 0555) < 0) { > + if (errno != EEXIST && errno != EROFS) { > + crit("failed to create iautofs directory %s", ap.path); > + return -1; > + } > + /* If we recieve an error, and it's EEXIST or EROFS we know > + the directory was not created. */ > + ap.dir_created = 0; > + } else { > + /* No errors so the directory was successfully created */ > + ap.dir_created = 1; > } > > /* Pipe for kernel communications */ > @@ -1349,7 +1357,7 @@ static void cleanup_exit(const char *pat > > closelog(); > > - if ((!ap.ghost || !submount) && *(path + 1) != '-') > + if ((!ap.ghost || !submount) && (*(path + 1) != '-') && ap.dir_created) > if (rmdir(path) == -1) > warn("failed to remove dir %s: %m", path); > > @@ -1672,6 +1680,7 @@ int main(int argc, char *argv[]) > ap.exp_timeout = DEFAULT_TIMEOUT; > ap.ghost = DEFAULT_GHOST_MODE; > ap.type = LKP_INDIRECT; > + ap.dir_created = 0; /* We haven't created the main directory yet */ > > opterr = 0; > while ((opt = getopt_long(argc, argv, "+hp:t:vdVg", long_options, NULL)) != EOF) { > --- autofs-4.1.3/include/automount.h.no-rmdir 2005-01-21 13:04:38.157059762 -0600 > +++ autofs-4.1.3/include/automount.h 2005-01-21 13:04:38.189059263 -0600 > @@ -111,6 +111,8 @@ struct autofs_point { > struct lookup_mod *lookup; /* Lookup module */ > enum states state; > int state_pipe[2]; > + unsigned dir_created; /* Was a directory created for this > + mount? */ > }; > > /* Standard function used by daemon or modules */ Thank you for the patch, Jeff. However, i failed to understand the debian package system and simply have no time to read a couple of manpages and howtos just to implement this small patch. So i simply set the immutable flag on our server and it works! Will this patch be in the officcial version some day, so we eventually see it in debian or ubuntu? --Heinrich ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-11 14:06 ` Heinrich Rebehn @ 2006-07-11 14:29 ` Jeff Moyer 2006-07-11 15:43 ` Ian Kent 2006-07-11 19:52 ` Steinar H. Gunderson 0 siblings, 2 replies; 8+ messages in thread From: Jeff Moyer @ 2006-07-11 14:29 UTC (permalink / raw) To: Heinrich Rebehn; +Cc: autofs ==> Regarding Re: [autofs] automount removes mountpoint upon exit; Heinrich Rebehn <rebehn@ant.uni-bremen.de> adds: rebehn> Jeff Moyer wrote: rebehn> Thank you for the patch, Jeff. rebehn> However, i failed to understand the debian package system and rebehn> simply have no time to read a couple of manpages and howtos just to rebehn> implement this small patch. So i simply set the immutable flag on rebehn> our server and it works! rebehn> Will this patch be in the officcial version some day, so we rebehn> eventually see it in debian or ubuntu? Yes, it already is in 4.1.4. Ask the debian maintainer to upgrade autofs to that. It's been out for some time, now. -Jeff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-11 14:29 ` Jeff Moyer @ 2006-07-11 15:43 ` Ian Kent 2006-07-11 16:26 ` Jeff Moyer 2006-07-11 19:52 ` Steinar H. Gunderson 1 sibling, 1 reply; 8+ messages in thread From: Ian Kent @ 2006-07-11 15:43 UTC (permalink / raw) To: Jeff Moyer; +Cc: autofs On Tue, 2006-07-11 at 10:29 -0400, Jeff Moyer wrote: > ==> Regarding Re: [autofs] automount removes mountpoint upon exit; Heinrich Rebehn <rebehn@ant.uni-bremen.de> adds: > > rebehn> Jeff Moyer wrote: > rebehn> Thank you for the patch, Jeff. > rebehn> However, i failed to understand the debian package system and > rebehn> simply have no time to read a couple of manpages and howtos just to > rebehn> implement this small patch. So i simply set the immutable flag on > rebehn> our server and it works! > > rebehn> Will this patch be in the officcial version some day, so we > rebehn> eventually see it in debian or ubuntu? > > Yes, it already is in 4.1.4. Ask the debian maintainer to upgrade autofs > to that. It's been out for some time, now. But I thought Heinrich was asking about the top directory of the mount. I don't think we check that in the same way. I'll have a look later. Wonder whether I check that in v5 ..... Ian ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-11 15:43 ` Ian Kent @ 2006-07-11 16:26 ` Jeff Moyer 2006-07-11 17:53 ` Ian Kent 0 siblings, 1 reply; 8+ messages in thread From: Jeff Moyer @ 2006-07-11 16:26 UTC (permalink / raw) To: Ian Kent; +Cc: autofs ==> Regarding Re: [autofs] automount removes mountpoint upon exit; Ian Kent <raven@themaw.net> adds: raven> On Tue, 2006-07-11 at 10:29 -0400, Jeff Moyer wrote: >> ==> Regarding Re: [autofs] automount removes mountpoint upon exit; Heinrich Rebehn <rebehn@ant.uni-bremen.de> adds: >> rebehn> Jeff Moyer wrote: rebehn> Thank you for the patch, Jeff. rebehn> However, i failed to understand the debian package system and rebehn> simply have no time to read a couple of manpages and howtos just to rebehn> implement this small patch. So i simply set the immutable flag on rebehn> our server and it works! >> rebehn> Will this patch be in the officcial version some day, so we rebehn> eventually see it in debian or ubuntu? >> >> Yes, it already is in 4.1.4. Ask the debian maintainer to upgrade autofs >> to that. It's been out for some time, now. raven> But I thought Heinrich was asking about the top directory of the mount. raven> I don't think we check that in the same way. raven> I'll have a look later. raven> Wonder whether I check that in v5 ..... Yeah, he's asking about the top-directory of the mount. That's exactly what that patch takes care to check for. ;) -Jeff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-11 16:26 ` Jeff Moyer @ 2006-07-11 17:53 ` Ian Kent 0 siblings, 0 replies; 8+ messages in thread From: Ian Kent @ 2006-07-11 17:53 UTC (permalink / raw) To: Jeff Moyer; +Cc: autofs On Tue, 2006-07-11 at 12:26 -0400, Jeff Moyer wrote: > ==> Regarding Re: [autofs] automount removes mountpoint upon exit; Ian Kent <raven@themaw.net> adds: > > raven> On Tue, 2006-07-11 at 10:29 -0400, Jeff Moyer wrote: > >> ==> Regarding Re: [autofs] automount removes mountpoint upon exit; Heinrich Rebehn <rebehn@ant.uni-bremen.de> adds: > >> > rebehn> Jeff Moyer wrote: > rebehn> Thank you for the patch, Jeff. > rebehn> However, i failed to understand the debian package system and > rebehn> simply have no time to read a couple of manpages and howtos just to > rebehn> implement this small patch. So i simply set the immutable flag on > rebehn> our server and it works! > >> > rebehn> Will this patch be in the officcial version some day, so we > rebehn> eventually see it in debian or ubuntu? > >> > >> Yes, it already is in 4.1.4. Ask the debian maintainer to upgrade autofs > >> to that. It's been out for some time, now. > > raven> But I thought Heinrich was asking about the top directory of the mount. > raven> I don't think we check that in the same way. > raven> I'll have a look later. > raven> Wonder whether I check that in v5 ..... > > Yeah, he's asking about the top-directory of the mount. That's exactly > what that patch takes care to check for. ;) Oops. Maybe I'll actually pay more attention some time soon! Ian ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automount removes mountpoint upon exit 2006-07-11 14:29 ` Jeff Moyer 2006-07-11 15:43 ` Ian Kent @ 2006-07-11 19:52 ` Steinar H. Gunderson 1 sibling, 0 replies; 8+ messages in thread From: Steinar H. Gunderson @ 2006-07-11 19:52 UTC (permalink / raw) To: autofs On Tue, Jul 11, 2006 at 10:29:56AM -0400, Jeff Moyer wrote: > Yes, it already is in 4.1.4. Ask the debian maintainer to upgrade autofs > to that. It's been out for some time, now. FWIW, the Debian packages for 4.1.4 beta 2 came out Februar 15th, 2005 -- 4.1.4 final June 9th, 2005. If he's using Debian stable, he'll probably have 4.1.4 beta 2 plus a few extra patches; I'm not sure offhand if that has the patch in question or not. /* Steinar */ -- Homepage: http://www.sesse.net/ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-07-11 19:52 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-07-10 10:59 automount removes mountpoint upon exit Heinrich Rebehn 2006-07-10 14:28 ` Jeff Moyer 2006-07-11 14:06 ` Heinrich Rebehn 2006-07-11 14:29 ` Jeff Moyer 2006-07-11 15:43 ` Ian Kent 2006-07-11 16:26 ` Jeff Moyer 2006-07-11 17:53 ` Ian Kent 2006-07-11 19:52 ` Steinar H. Gunderson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.