All of lore.kernel.org
 help / color / mirror / Atom feed
From: raven@themaw.net
To: autofs mailing list <autofs@linux.kernel.org>
Subject: Please help
Date: Sun, 2 May 2004 22:13:03 +0800 (WST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0405022201480.25614@donald.themaw.net> (raw)


Hi all,

The recent post regarding replicated server mounts has caused me a bit of 
work.

Basically, I broke the functionality a bit when I merged the patch I 
received from Michael Blandford.

I believe the included patch fixes this.

Additionally, while fixing it I stumbled on the "BUG: dir already mounted" 
message that has been annoying us for so long.

I think I've fixed that as well. It's only about my third attempt at it 
so I'm not expecting it's final. Maybe third time lucky.

Anyway, since the change is a bit more than straight forward I'd like 
as many people as can to test it out before I commit and release it in 
4.1.3. I've probably broken something else.

The patch:

diff -Nur autofs-4.1.3.orig/modules/mount_bind.c autofs-4.1.3/modules/mount_bind.c
--- autofs-4.1.3.orig/modules/mount_bind.c	2004-01-30 00:01:22.000000000 +0800
+++ autofs-4.1.3/modules/mount_bind.c	2004-05-02 20:47:53.000000000 +0800
@@ -125,8 +125,8 @@
 		unlink(AUTOFS_LOCK);
 
 		if (err) {
-			if (!ap.ghost || (ap.ghost && !status))
-				rmdir_path(fullpath);
+			if (!ap.ghost && !(*name == '/' && strlen(name)))
+				rmdir_path(name);
 			return 1;
 		} else {
 			debug(MODPREFIX "mounted %s type %s on %s",
diff -Nur autofs-4.1.3.orig/modules/mount_changer.c autofs-4.1.3/modules/mount_changer.c
--- autofs-4.1.3.orig/modules/mount_changer.c	2004-03-07 20:17:54.000000000 +0800
+++ autofs-4.1.3/modules/mount_changer.c	2004-05-02 20:50:53.000000000 +0800
@@ -106,8 +106,8 @@
 	}
 	unlink(AUTOFS_LOCK);
 	if (err) {
-		if (!ap.ghost || (ap.ghost && !status))
-			rmdir_path(fullpath);
+		if (!ap.ghost && !(*name == '/' && strlen(name) == 1))
+			rmdir_path(name);
 
 		error(MODPREFIX "failed to mount %s (type %s) on %s",
 		      what, fstype, fullpath);
diff -Nur autofs-4.1.3.orig/modules/mount_ext2.c autofs-4.1.3/modules/mount_ext2.c
--- autofs-4.1.3.orig/modules/mount_ext2.c	2004-04-22 22:39:08.000000000 +0800
+++ autofs-4.1.3/modules/mount_ext2.c	2004-05-02 20:53:00.000000000 +0800
@@ -116,8 +116,8 @@
 	unlink(AUTOFS_LOCK);
 
 	if (err) {
-		if (!ap.ghost || (ap.ghost && !status))
-			rmdir_path(fullpath);
+		if (!ap.ghost && !(*name == '/' && strlen(name) == 1))
+			rmdir_path(name);
 		error(MODPREFIX "failed to mount %s (type %s) on %s",
 		      what, fstype, fullpath);
 		return 1;
diff -Nur autofs-4.1.3.orig/modules/mount_generic.c autofs-4.1.3/modules/mount_generic.c
--- autofs-4.1.3.orig/modules/mount_generic.c	2004-01-30 00:01:22.000000000 +0800
+++ autofs-4.1.3/modules/mount_generic.c	2004-05-02 20:54:10.000000000 +0800
@@ -85,8 +85,8 @@
 	unlink(AUTOFS_LOCK);
 
 	if (err) {
-		if (!ap.ghost || (ap.ghost && !status))
-			rmdir_path(fullpath);
+		if (!ap.ghost && !(*name == '/' && strlen(name) == 1))
+			rmdir_path(name);
 
 		error(MODPREFIX "failed to mount %s (type %s) on %s",
 		      what, fstype, fullpath);
diff -Nur autofs-4.1.3.orig/modules/mount_nfs.c autofs-4.1.3/modules/mount_nfs.c
--- autofs-4.1.3.orig/modules/mount_nfs.c	2004-04-03 15:14:33.000000000 +0800
+++ autofs-4.1.3/modules/mount_nfs.c	2004-05-02 21:11:53.000000000 +0800
@@ -131,7 +131,6 @@
 
 	while (p && *p) {
 		char *next;
-		int alive = -1;
 
 		p += strspn(p, " \t,");
 		delim = strpbrk(p, "(, \t:");
@@ -187,29 +186,32 @@
 			for (haddr = he->h_addr_list; *haddr; haddr++) {
 				local = is_local_addr(p, *haddr, he->h_length);
 
-				if (local < 0) {
-					local = 0;
-					p = next;
-				}
+				if (local < 0)
+					continue;
 
 				if (local) {
-					alive = rpc_ping(p, sec, micros);
-					if (alive) {
-						winner = p;
-						break;
-					}
-					local = 0;
+					winner = p;
+					break;
 				}
 			}
+			
+			if (local < 0) {
+				local = 0;
+				p = next;
+				continue;
+			}
+
+			if (local)
+				break;
 		}
 
-		/* Are we actually alive */
-		if (!alive || (alive < 0 && !rpc_ping(p, sec, micros))) {
+		/* If it's not local is it alive */
+		if (!local && !rpc_ping(p, sec, micros)) {
 			p = next;
 			continue;
 		}
 
-		/* Not local, see if we have a previous 'winner' */
+		/* see if we have a previous 'winner' */
 		if (!winner) {
 			winner = p;
 		}
@@ -434,8 +436,8 @@
 		unlink(AUTOFS_LOCK);
 
 		if (err) {
-			if (!ap.ghost || (ap.ghost && !status))
-				rmdir_path(fullpath);
+			if (!ap.ghost && !(*name == '/' && strlen(name) == 1))
+				rmdir_path(name);
 			error(MODPREFIX "nfs: mount failure %s on %s",
 			      whatstr, fullpath);
 			return 1;
diff -Nur autofs-4.1.3.orig/modules/parse_sun.c autofs-4.1.3/modules/parse_sun.c
--- autofs-4.1.3.orig/modules/parse_sun.c	2004-02-03 23:23:21.000000000 +0800
+++ autofs-4.1.3/modules/parse_sun.c	2004-05-02 20:31:32.000000000 +0800
@@ -615,15 +615,15 @@
 
 /*
  * syntax is:
- *	[-options] location
- *	[-options] [mountpoint [-options] location]...
+ *	[-options] location [location] ...
+ *	[-options] [mountpoint [-options] location [location] ... ]...
  */
 int parse_mount(const char *root, const char *name,
 		int name_len, const char *mapent, void *context)
 {
 	struct parse_context *ctxt = (struct parse_context *) context;
 	char *pmapent, *options;
-	const char *p;
+	const char *p, *q;
 	int mapent_len, rv;
 	int optlen;
 
@@ -667,6 +667,18 @@
 
 	if (*p == '/') {
 		int l;
+		char *multi_root;
+
+		multi_root = alloca(strlen(root) + name_len + 2);
+		if (!multi_root) {
+			error(MODPREFIX "alloca: %m");
+			free(options);
+			return 1;
+		}
+
+		strcpy(multi_root, root);
+		strcat(multi_root, "/");
+		strcat(multi_root, name);
 
 		/* It's a multi-mount; deal with it */
 		do {
@@ -705,7 +717,15 @@
 				} while (*p == '-');
 			}
 
-			loc = dequote(p, l = chunklen(p, 1));
+			q = p;
+			while (*q && *q != '/') {
+				l = chunklen(q, 1);
+				q += l;
+				q = skipspace(q);
+			}
+			l = q - p;
+
+			loc = dequote(p, l);
 			loclen = strlen(loc);
 
 			if (loc == NULL || path == NULL) {
@@ -723,7 +743,7 @@
 			      "multimount: %.*s on %.*s with options %s",
 			      loclen, loc, pathlen, path, myoptions);
 
-			rv = sun_mount(root, name, name_len, path, pathlen, loc, loclen,
+			rv = sun_mount(multi_root, path, pathlen, "/", 1, loc, loclen,
 				       myoptions);
 			free(path);
 			free(loc);
@@ -739,12 +759,20 @@
 	} else {
 		/* Normal (non-multi) entries */
 		char *loc;
-		int loclen;
+		int loclen, l;
 
 		if (*p == ':')
 			p++;	/* Sun escape for entries starting with / */
 
-		loc = dequote(p, chunklen(p, 1));
+		q = p;
+		while (*q) {
+			l = chunklen(q, 1);
+			q += l;
+			q = skipspace(q);
+		}
+		l = q - p;
+
+		loc = dequote(p, l);
 		loclen = strlen(loc);
 
 		if (loc == NULL) {

             reply	other threads:[~2004-05-02 14:13 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-02 14:13 raven [this message]
2004-05-03 13:21 ` Please help Jeff Moyer
2004-05-04 14:44 ` Please help - cleanup raven
2004-05-04 14:59   ` Jeff Moyer
2004-05-04 15:16     ` raven
2004-05-05 22:16       ` Jeff Moyer
2004-05-05 23:45         ` Michael Blandford
2004-05-06  1:38           ` Ian Kent
2004-05-06 12:40           ` Jeff Moyer
2004-05-06 14:44             ` raven
2004-05-06 14:30         ` Tom Georgoulias
2004-05-06 15:55           ` Chris Croswhite
2004-05-06 16:04             ` Tom Georgoulias
2004-05-06 19:10               ` Jeff Moyer
2004-05-06 19:34                 ` Peter C. Norton
2004-05-07 15:13                 ` Mike Waychison
2004-05-07  1:50               ` Ian Kent
  -- strict thread matches above, loose matches on Subject: below --
2019-11-12  9:02 Please Help Richard
2019-11-12  8:32 Richard
2019-11-12  8:15 Richard
2019-11-12  8:15 Richard
2019-11-12  7:08 Richard
2014-08-27 17:51 Annie Smith
2014-08-26 10:59 Annie Smith
2012-01-15 23:25 Tai Bei
2012-01-15 23:25 Tai Bei
2012-01-15 23:25 Tai Bei
2012-01-15 21:56 Tai Bei
2012-01-15 21:48 Tai Bei
2012-01-15 21:40 Tai Bei
2012-01-15 21:40 Tai Bei
2010-05-07 11:36 Pol
2009-02-11 14:59 constantine
2007-10-10  5:56 please help cyjoyp
2004-06-28 21:56 Please help Sam Loy
2004-06-28 22:13 ` Antony Stone
2004-06-28 22:18 ` Marek Dohojda
     [not found] ` <16609.34789.711050.944527@saint.heaven.net>
2004-06-29 16:57   ` Sam Loy
     [not found] <001c01c0b04b$7b39df80$4c0c5c8c@trd.iii.org.tw>
2001-03-19 18:21 ` guru
2001-03-19 18:38   ` nick
2001-03-19 23:29   ` Dr. Kelsey Hudson
2001-03-19 18:56 ` Jonathan Lundell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0405022201480.25614@donald.themaw.net \
    --to=raven@themaw.net \
    --cc=autofs@linux.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.