Skip to contentSkip to conversation

Possbile issue with ghost and timeout

DISCUSSION Phy Prabab 2 participants 6 messages Jun 26, 2004 – Jun 29, 2004 Kernel automounter

lore
Share & tools
lore

Phy Prabab

author
#0 lore raw

Hello,

I am not on this mailing list yet, so please cc me in the mails.

I have an issue with autofs4.1.3 and ghost option. It appears that onve a file system has been mounted and then time-out removed, the file system will not be remounted unless you cd or ls the dir. For example:
I run an executable by using the full path via an rsh command and then run the command again after the timeout (30s in my case) and the file is not found. However if I "ls" the path the executable is there and then accessable.

If I remove the ghost option, everything behaves fine.

Is this a known issue and is there a fix/work around?

Thanks!
Phy

__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

#1 lore raw
Quoted 5 lines · Phy Prabab

Hello,

I am not on this mailing list yet, so please cc me in the mails.

Quoted 9 lines

I have an issue with autofs4.1.3 and ghost option. It appears that onve a file system has been mounted and then time-out removed, the file system will not be remounted unless you cd or ls the dir. For example:
I run an executable by using the full path via an rsh command and then run the command again after the timeout (30s in my case) and the file is not found. However if I "ls" the path the executable is there and then accessable.

Have you applied the kernel module update?
What release?

Quoted 4 lines

If I remove the ghost option, everything behaves fine.

Is this a known issue and is there a fix/work around?

Not aware of this.

Ian

author
#2 lore raw

Ian et al,

Quoted 2 lines

Have you applied the kernel module update?
What release?

Using 2.6.7 (also tried various bk's) with autofs-4.1.3 on x86. I do not use modules and did not see any patches that were applicable.

Thanks,
Phy

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

maintainer
#3 lore raw
Quoted 9 lines · Phy Prabab

Ian et al,

Quoted 2 lines

Have you applied the kernel module update?
What release?

Using 2.6.7 (also tried various bk's) with autofs-4.1.3 on x86. I do not use modules and did not see any patches that were applicable.

2.6.7 has the autofs updates included.

I'll have to compile a 2.6.7 and test this out.
There is a patch for 4.1.3 that might address this. I don't have it with me now so I'll send it tonight. Will you be willing to try it out?

Ian

author
#4 lore raw

Ian,

Of course I am willing to test out patches. Please post location and I can try to test it out tonight/tomrrow morning US time.

Thanks!
Phy

Quoted 15 lines · --- Ian Kent
Quoted 7 lines · Phy Prabab

Ian et al,

Quoted 2 lines

Have you applied the kernel module update?
What release?

Using 2.6.7 (also tried various bk's) with autofs-4.1.3 on x86. I do not use modules and did

not

Quoted 2 lines

see any patches that were applicable.

2.6.7 has the autofs updates included.

Quoted 9 lines

I'll have to compile a 2.6.7 and test this out. There is a patch for 4.1.3 that might address this. I don't have it with
me now so I'll send it tonight. Will you be willing to try it out?

Ian

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

#5 lore raw
Quoted 5 lines · Phy Prabab

Ian,

Of course I am willing to test out patches. Please post location and I can try to test it out tonight/tomrrow morning US time.

Cool.

Attached is the patch that may help with the problem you describe.

I recommend that you first also apply the patches:

autofs-4.1.3-strict.patch
autofs-4.1.3-mtab_lock.patch

located at http://www.kernel.org/pub/linux/daemons/autofs/v4.

Ian

daemon/automount.c +10 -2
diff -Nur autofs-4.1.3.orig/daemon/automount.c autofs-4.1.3/daemon/automount.c
@@ -99,8 +99,11 @@
 
 					if (stat(buf, &st) == 0 && !S_ISDIR(st.st_mode))
 						errno = ENOTDIR;
-					else
-						continue;
+					else {
+						/* last component, return -1 */
+						if (*cp != '\0')
+							continue;
+					}
 				}
 				return -1;
 			}
@@ -1088,9 +1091,11 @@
 			close(ap.state_pipe[0]);
 			close(ap.state_pipe[1]);
 
+			chdir(ap.path);
 			err = ap.lookup->lookup_mount(ap.path,
 						      pkt->name, pkt->len,
 						      ap.lookup->context);
+			chdir("/");
 
 			/*
 			 * If at first you don't succeed, hide all
@@ -1163,8 +1168,11 @@
 		   it.
 		 */
 
+		chdir(ap.path);
 		ret = ap.lookup->lookup_mount(ap.path, 
 					name, namelen, ap.lookup->context);
+		chdir("/");
+
 		if (ret)
 			error("failed to recover from partial expiry of %s\n",
 			       buf);
modules/mount_bind.c +7 -3
diff -Nur autofs-4.1.3.orig/modules/mount_bind.c autofs-4.1.3/modules/mount_bind.c
@@ -107,15 +107,19 @@
 		fullpath[i] = '\0';
 
 	if (bind_works) {
-		int status;
+		int status, existed = 1;
 
 		debug(MODPREFIX "calling mkdir_path %s", fullpath);
 
-		if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
+		status = mkdir_path(fullpath, 0555);
+		if (status && errno != EEXIST) {
 			error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
 			return 1;
 		}
 
+		if (!status)
+			existed = 0;
+
 		if (is_mounted(fullpath)) {
 			warn("BUG: %s already mounted", fullpath);
 			return 0;
@@ -130,7 +134,7 @@
 		unlink(AUTOFS_LOCK);
 
 		if (err) {
-			if (!ap.ghost && name_len)
+			if ((!ap.ghost && name_len) || !existed)
 				rmdir_path(name);
 			return 1;
 		} else {
modules/mount_changer.c +7 -3
diff -Nur autofs-4.1.3.orig/modules/mount_changer.c autofs-4.1.3/modules/mount_changer.c
@@ -52,7 +52,7 @@
 {
 	char *fullpath;
 	int err;
-	int status;
+	int status, existed = 1;
 
 	fstype = "iso9660";
 
@@ -80,11 +80,15 @@
 
 	debug(MODPREFIX "calling mkdir_path %s", fullpath);
 
-	if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
+	status = mkdir_path(fullpath, 0555);
+	if (status && errno != EEXIST) {
 		error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
 		return 1;
 	}
 
+	if (!status)
+		existed = 0;
+
 	debug(MODPREFIX "Swapping CD to slot %s", name);
 
 	err = swapCD(what, name);
@@ -111,7 +115,7 @@
 	unlink(AUTOFS_LOCK);
 
 	if (err) {
-		if (!ap.ghost && name_len)
+		if ((!ap.ghost && name_len) || !existed)
 			rmdir_path(name);
 
 		error(MODPREFIX "failed to mount %s (type %s) on %s",
modules/mount_ext2.c +7 -4
diff -Nur autofs-4.1.3.orig/modules/mount_ext2.c autofs-4.1.3/modules/mount_ext2.c
@@ -40,7 +40,6 @@
 	return 0;
 }
 
-
 int mount_mount(const char *root, const char *name, int name_len,
 		const char *what, const char *fstype, const char *options, void *context)
 {
@@ -48,7 +47,7 @@
 	const char *p, *p1;
 	int err, ro = 0;
 	const char *fsck_prog;
-	int status;
+	int status, existed = 1;
 
 	fullpath = alloca(strlen(root) + name_len + 2);
 	if (!fullpath) {
@@ -63,11 +62,15 @@
 
 	debug(MODPREFIX "calling mkdir_path %s", fullpath);
 
-	if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
+	status = mkdir_path(fullpath, 0555);
+	if (status && errno != EEXIST) {
 		error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
 		return 1;
 	}
 
+	if (!status)
+		existed = 0;
+
 	if (is_mounted(fullpath)) {
 		error("BUG: %s already mounted", fullpath);
 		return 0;
@@ -120,7 +123,7 @@
 	unlink(AUTOFS_LOCK);
 
 	if (err) {
-		if (!ap.ghost && name_len)
+		if ((!ap.ghost && name_len) || !existed)
 			rmdir_path(name);
 		error(MODPREFIX "failed to mount %s (type %s) on %s",
 		      what, fstype, fullpath);
modules/mount_generic.c +7 -3
diff -Nur autofs-4.1.3.orig/modules/mount_generic.c autofs-4.1.3/modules/mount_generic.c
@@ -46,7 +46,7 @@
 {
 	char *fullpath;
 	int err;
-	int status;
+	int status, existed = 1;
 
 	fullpath = alloca(strlen(root) + name_len + 2);
 	if (!fullpath) {
@@ -61,11 +61,15 @@
 
 	debug(MODPREFIX "calling mkdir_path %s", fullpath);
 
-	if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
+	status = mkdir_path(fullpath, 0555);
+	if (status && errno != EEXIST) {
 		error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
 		return 1;
 	}
 
+	if (!status)
+		existed = 0;
+
 	if (is_mounted(fullpath)) {
 		error("BUG: %s already mounted", fullpath);
 		return 0;
@@ -89,7 +93,7 @@
 	unlink(AUTOFS_LOCK);
 
 	if (err) {
-		if (!ap.ghost && name_len)
+		if ((!ap.ghost && name_len) || !existed)
 			rmdir_path(name);
 
 		error(MODPREFIX "failed to mount %s (type %s) on %s",
modules/mount_nfs.c +9 -3
diff -Nur autofs-4.1.3.orig/modules/mount_nfs.c autofs-4.1.3/modules/mount_nfs.c
@@ -445,14 +445,19 @@
 			       whatstr, "bind", NULL, mount_bind->context);
 	} else {
 		/* Not a local host - do an NFS mount */
-		int status;
+		int status, existed = 1;
 
 		debug(MODPREFIX "calling mkdir_path %s", fullpath);
-		if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
+
+		status = mkdir_path(fullpath, 0555);
+		if (status && errno != EEXIST) {
 			error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
 			return 1;
 		}
 
+		if (!status)
+			existed = 0;
+
 		if (is_mounted(fullpath)) {
 			error("BUG: %s already mounted", fullpath);
 			return 0;
@@ -477,8 +482,9 @@
 		unlink(AUTOFS_LOCK);
 
 		if (err) {
-			if (!ap.ghost && name_len)
+			if ((!ap.ghost && name_len) || !existed)
 				rmdir_path(name);
+
 			error(MODPREFIX "nfs: mount failure %s on %s",
 			      whatstr, fullpath);
 			return 1;

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