* [PATCH] No-rmdir-patch
@ 2005-01-24 17:35 Chris Feist
2005-01-25 1:01 ` Ian Kent
0 siblings, 1 reply; 2+ messages in thread
From: Chris Feist @ 2005-01-24 17:35 UTC (permalink / raw)
To: raven; +Cc: autofs
[-- Attachment #1: Type: text/plain, Size: 443 bytes --]
When you specify a directory where a map will be mounted in auto.master,
if it does not exist, autofs will create it upon startup and remove the
directory when it shuts down. However, if the directory already exists,
autofs will still remove it when you shut down. I've attached a patch
to autofs-4.1.3 which will prevent autofs from removing previously
exisiting directories.
If you have any questions, let me know!
Thanks,
Chris
[-- Attachment #2: no-rmdir-patch-vanilla --]
[-- Type: text/plain, Size: 1899 bytes --]
--- autofs-4.1.3/daemon/automount.c.orig 2004-04-05 08:14:10.000000000 -0500
+++ autofs-4.1.3/daemon/automount.c 2005-01-24 11:30:37.013417216 -0600
@@ -426,9 +426,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 */
@@ -1341,7 +1349,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);
@@ -1664,6 +1672,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.orig 2004-05-18 07:20:08.000000000 -0500
+++ autofs-4.1.3/include/automount.h 2005-01-24 11:30:37.014417200 -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 */
[-- Attachment #3: Type: text/plain, Size: 140 bytes --]
_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] No-rmdir-patch
2005-01-24 17:35 [PATCH] No-rmdir-patch Chris Feist
@ 2005-01-25 1:01 ` Ian Kent
0 siblings, 0 replies; 2+ messages in thread
From: Ian Kent @ 2005-01-25 1:01 UTC (permalink / raw)
To: Chris Feist; +Cc: autofs
Looks OK.
I'll merge it into 4.1.4 brta1.
It wuould be good if you could make your changes against a current CVS
snapshot as there have been a lot of changes from 4.1.3.
Jeff has the CVS info.
Ian
On Mon, 24 Jan 2005, Chris Feist wrote:
> When you specify a directory where a map will be mounted in auto.master,
> if it does not exist, autofs will create it upon startup and remove the
> directory when it shuts down. However, if the directory already exists,
> autofs will still remove it when you shut down. I've attached a patch
> to autofs-4.1.3 which will prevent autofs from removing previously
> exisiting directories.
>
> If you have any questions, let me know!
>
> Thanks,
> Chris
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-25 1:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-24 17:35 [PATCH] No-rmdir-patch Chris Feist
2005-01-25 1:01 ` Ian Kent
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.