rpms/autofs/F-9 autofs-5.0.3-check-for-kernel-automount.patch, NONE, 1.1 autofs-5.0.3-nss-source-any.patch, NONE, 1.1 autofs-5.0.3-mount-thread-create-cond-handling.patch, 1.2, 1.3 autofs.spec, 1.241, 1.242

Ian Kent (iankent) fedora-extras-commits at redhat.com
Fri May 23 03:18:24 UTC 2008


Author: iankent

Update of /cvs/pkgs/rpms/autofs/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22101

Modified Files:
	autofs-5.0.3-mount-thread-create-cond-handling.patch 
	autofs.spec 
Added Files:
	autofs-5.0.3-check-for-kernel-automount.patch 
	autofs-5.0.3-nss-source-any.patch 
Log Message:
* Fri May 23 2008 Ian Kent <ikent at redhat.com> - 5.0.3-15
- check for nohide mounts (bz 442618).
- ignore nsswitch sources that aren't supported (bz 445880).
- update patch 12, CHANGELOG entry only change.


autofs-5.0.3-check-for-kernel-automount.patch:

--- NEW FILE autofs-5.0.3-check-for-kernel-automount.patch ---
autofs 5.0.3 - check for exported mounts automatically mounted by kernel

From: Ian Kent <raven at themaw.net>

If a server exports file systems that are automatically mounted by
the kernel client autofs will mistakenly over mount them when it
constructs and mounts its multi-mount triggers.

This patch makes autofs check for this case and ignores them if the
kernel mounts them while it mounts multi-mount triggers.

We don't want to fight with NFS over mounting these because it
confuses autofs and they magically go away when the owner mount is
umounted. This isn't ideal because autofs will mount these mounts
while constructing its multi-mount triggers but it is unavoidable
at the moment.
---

 CHANGELOG           |    1 +
 daemon/direct.c     |   26 ++++++++++++++++++--------
 include/automount.h |    4 ++++
 lib/parse_subs.c    |   26 ++++++++++++++++++--------
 4 files changed, 41 insertions(+), 16 deletions(-)


--- autofs-5.0.3.orig/CHANGELOG
+++ autofs-5.0.3/CHANGELOG
@@ -12,6 +12,7 @@
 - init SASL callbacks on every ldap lookup library load.
 - fix incorrect match of map type name when included in map name.
 - fix incorrect pthreads condition handling for mount requests.
+- add check for exports automatically mounted by NFS kernel client.
  
 14/01/2008 autofs-5.0.3
 -----------------------
--- autofs-5.0.3.orig/daemon/direct.c
+++ autofs-5.0.3/daemon/direct.c
@@ -664,12 +664,12 @@ int mount_autofs_offset(struct autofs_po
 		if (ap->state != ST_READMAP)
 			warn(ap->logopt,
 			      "trigger %s already mounted", me->key);
-		return 0;
+		return MOUNT_OFFSET_OK;
 	}
 
 	if (me->ioctlfd != -1) {
 		error(ap->logopt, "active offset mount %s", me->key);
-		return -1;
+		return MOUNT_OFFSET_FAIL;
 	}
 
 	status = pthread_once(&key_mnt_params_once, key_mnt_params_init);
@@ -683,7 +683,7 @@ int mount_autofs_offset(struct autofs_po
 			crit(ap->logopt,
 			  "mnt_params value create failed for offset mount %s",
 			  me->key);
-			return 0;
+			return MOUNT_OFFSET_OK;
 		}
 		mp->options = NULL;
 
@@ -697,12 +697,22 @@ int mount_autofs_offset(struct autofs_po
 	if (!mp->options) {
 		mp->options = make_options_string(ap->path, ap->kpipefd, "offset");
 		if (!mp->options)
-			return 0;
+			return MOUNT_OFFSET_OK;
 	}
 
 	/* In case the directory doesn't exist, try to mkdir it */
 	if (mkdir_path(me->key, 0555) < 0) {
 		if (errno == EEXIST) {
+			/*
+			 * If the mount point directory is a real mount
+			 * and it isn't the root offset then it must be
+			 * a mount that has been automatically mounted by
+			 * the kernel NFS client.
+			 */
+			if (me->multi != me &&
+			    is_mounted(_PROC_MOUNTS, me->key, MNTS_REAL))
+				return MOUNT_OFFSET_IGNORE;
+
 			/* 
 			 * If we recieve an error, and it's EEXIST
 			 * we know the directory was not created.
@@ -721,13 +731,13 @@ int mount_autofs_offset(struct autofs_po
 			debug(ap->logopt,
 			     "can't create mount directory: %s, %s",
 			     me->key, estr);
-			return -1;
+			return MOUNT_OFFSET_FAIL;
 		} else {
 			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
 			crit(ap->logopt,
 			     "failed to create mount directory: %s, %s",
 			     me->key, estr);
-			return -1;
+			return MOUNT_OFFSET_FAIL;
 		}
 	} else {
 		/* No errors so the directory was successfully created */
@@ -787,7 +797,7 @@ int mount_autofs_offset(struct autofs_po
 
 	debug(ap->logopt, "mounted trigger %s", me->key);
 
-	return 0;
+	return MOUNT_OFFSET_OK;
 
 out_close:
 	close(ioctlfd);
@@ -797,7 +807,7 @@ out_err:
 	if (stat(me->key, &st) == 0 && me->dir_created)
 		 rmdir_path(ap, me->key, st.st_dev);
 
-	return -1;
+	return MOUNT_OFFSET_FAIL;
 }
 
 static int expire_direct(int ioctlfd, const char *path, unsigned int when, unsigned int logopt)
--- autofs-5.0.3.orig/include/automount.h
+++ autofs-5.0.3/include/automount.h
@@ -468,6 +468,10 @@ struct autofs_point {
 
 /* Standard functions used by daemon or modules */
 
+#define	MOUNT_OFFSET_OK		0
+#define	MOUNT_OFFSET_FAIL	-1
+#define MOUNT_OFFSET_IGNORE	-2
+
 void *handle_mounts(void *arg);
 int umount_multi(struct autofs_point *ap, const char *path, int incl);
 int send_ready(unsigned logopt, int ioctlfd, unsigned int wait_queue_token);
--- autofs-5.0.3.orig/lib/parse_subs.c
+++ autofs-5.0.3/lib/parse_subs.c
@@ -390,7 +390,7 @@ int mount_multi_triggers(struct autofs_p
 	struct list_head *pos = NULL;
 	unsigned int fs_path_len;
 	unsigned int mounted;
-	int start;
+	int ret, start;
 
 	fs_path_len = strlen(root) + strlen(base);
 	if (fs_path_len > PATH_MAX)
@@ -411,15 +411,25 @@ int mount_multi_triggers(struct autofs_p
 		}
 
 		oe = cache_lookup_offset(base, offset, start, &me->multi_list);
-		if (!oe)
+		if (!oe || !oe->mapent)
 			goto cont;
 
 		debug(ap->logopt, "mount offset %s", oe->key);
 
-		if (mount_autofs_offset(ap, oe) < 0)
-			warn(ap->logopt, "failed to mount offset");
-		else
+		ret = mount_autofs_offset(ap, oe);
+		if (ret >= MOUNT_OFFSET_OK)
 			mounted++;
+		else {
+			if (ret != MOUNT_OFFSET_IGNORE)
+				warn(ap->logopt, "failed to mount offset");
+			else {
+				debug(ap->logopt,
+				      "ignoring \"nohide\" trigger %s",
+				      oe->key);
+				free(oe->mapent);
+				oe->mapent = NULL;
+			}
+		}
 cont:
 		offset = cache_get_offset(base,
 				offset, start, &me->multi_list, &pos);
@@ -457,7 +467,7 @@ int umount_multi_triggers(struct autofs_
 
 		oe = cache_lookup_offset(mm_base, offset, start, &me->multi_list);
 		/* root offset is a special case */
-		if (!oe || (strlen(oe->key) - start) == 1)
+		if (!oe || !oe->mapent || (strlen(oe->key) - start) == 1)
 			continue;
 
 		/*
@@ -481,7 +491,7 @@ int umount_multi_triggers(struct autofs_
 	while ((offset = cache_get_offset(mm_base, offset, start, mm_root, &pos))) {
 		oe = cache_lookup_offset(mm_base, offset, start, &me->multi_list);
 		/* root offset is a special case */
-		if (!oe || (strlen(oe->key) - start) == 1)
+		if (!oe || !oe->mapent || (strlen(oe->key) - start) == 1)
 			continue;
 
 		debug(ap->logopt, "umount offset %s", oe->key);
@@ -505,7 +515,7 @@ int umount_multi_triggers(struct autofs_
 		if (is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) {
 			info(ap->logopt, "unmounting dir = %s", root);
 			if (umount_ent(ap, root)) {
-				if (!mount_multi_triggers(ap, root, me, "/"))
+				if (mount_multi_triggers(ap, root, me, "/") < 0)
 					warn(ap->logopt,
 					     "failed to remount offset triggers");
 				return left++;

autofs-5.0.3-nss-source-any.patch:

--- NEW FILE autofs-5.0.3-nss-source-any.patch ---
autofs-5.0.3 - ignore nsswitch sources that aren't supported

From: Ian Kent <raven at themaw.net>

Allow any source name in nsswitch and ignore those we don't support.
This has the side affect of also ignoring any action associated with
a source that isn't supported by autofs.
---

 CHANGELOG       |    1 +
 lib/nss_parse.y |   31 ++++++++++++++++---------------
 lib/nss_tok.l   |   22 ++++++++++++----------
 3 files changed, 29 insertions(+), 25 deletions(-)


--- autofs-5.0.3.orig/CHANGELOG
+++ autofs-5.0.3/CHANGELOG
@@ -13,6 +13,7 @@
 - fix incorrect match of map type name when included in map name.
 - fix incorrect pthreads condition handling for mount requests.
 - add check for exports automatically mounted by NFS kernel client.
+- update nsswitch parser to ignore nsswitch sources that aren't supported.
  
 14/01/2008 autofs-5.0.3
 -----------------------
--- autofs-5.0.3.orig/lib/nss_parse.y
+++ autofs-5.0.3/lib/nss_parse.y
@@ -64,7 +64,6 @@ char strval[128];
 %token <strval> SOURCE
 %token <strval> STATUS
 %token <strval> ACTION
-%token <strval> OTHER
 
 %start file
 
@@ -83,7 +82,9 @@ sources: nss_source
 
 nss_source: SOURCE
 {
-	if (strcmp($1, "winbind"))
+	if (!strcmp($1, "files") || !strcmp($1, "yp") ||
+	    !strcmp($1, "nis") || !strcmp($1, "ldap") ||
+	    !strcmp($1, "nisplus") || !strcmp($1, "hesiod"))
 		src = add_source(nss_list, $1);
 	else
 		nss_ignore($1);
@@ -91,7 +92,9 @@ nss_source: SOURCE
 {
 	enum nsswitch_status a;
 
-	if (strcmp($1, "winbind")) {
+	if (!strcmp($1, "files") || !strcmp($1, "yp") ||
+	    !strcmp($1, "nis") || !strcmp($1, "ldap") ||
+	    !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) {
 		src = add_source(nss_list, $1);
 		for (a = 0; a < NSS_STATUS_MAX; a++) {
 			if (act[a].action != NSS_ACTION_UNKNOWN) {
@@ -101,12 +104,10 @@ nss_source: SOURCE
 		}
 	} else
 		nss_ignore($1);
-} | SOURCE LBRACKET status_exp_list SOURCE { nss_error($4); YYABORT; }
-  | SOURCE LBRACKET status_exp_list OTHER { nss_error($4); YYABORT; }
-  | SOURCE LBRACKET status_exp_list NL { nss_error("no closing bracket"); YYABORT; }
-  | SOURCE LBRACKET OTHER { nss_error($3); YYABORT; }
-  | SOURCE OTHER { nss_error("no opening bracket"); YYABORT; }
-  | error OTHER { nss_error($2); YYABORT; };
+} | SOURCE LBRACKET status_exp_list SOURCE { nss_error("missing close bracket"); YYABORT; }
+  | SOURCE LBRACKET status_exp_list NL { nss_error("missing close bracket"); YYABORT; }
+  | SOURCE LBRACKET SOURCE { nss_error($3); YYABORT; }
+  | error SOURCE { nss_error($2); YYABORT; };
 
 status_exp_list: status_exp
 		| status_exp status_exp_list
@@ -117,17 +118,17 @@ status_exp: STATUS EQUAL ACTION
 } | BANG STATUS EQUAL ACTION
 {
 	set_action(act, $2, $4, 1);
-} | STATUS EQUAL OTHER {nss_error($3); YYABORT; }
-  | STATUS OTHER {nss_error($2); YYABORT; }
-  | BANG STATUS EQUAL OTHER {nss_error($4); YYABORT; }
-  | BANG STATUS OTHER {nss_error($3); YYABORT; }
-  | BANG OTHER {nss_error($2); YYABORT; };
+} | STATUS EQUAL SOURCE {nss_error($3); YYABORT; }
+  | STATUS SOURCE {nss_error($2); YYABORT; }
+  | BANG STATUS EQUAL SOURCE {nss_error($4); YYABORT; }
+  | BANG STATUS SOURCE {nss_error($3); YYABORT; }
+  | BANG SOURCE {nss_error($2); YYABORT; };
 
 %%
 
 static int nss_ignore(const char *s)
 {
-	logmsg("ignored invalid nsswitch config near [ %s ]", s);
+	logmsg("ignored unsupported autofs nsswitch source \"%s\"", s);
 	return(0);
 }
 
--- autofs-5.0.3.orig/lib/nss_tok.l
+++ autofs-5.0.3/lib/nss_tok.l
@@ -62,13 +62,13 @@ extern unsigned int nss_automount_found;
 
 %option nounput
 
-%x AUTOMOUNT
+%x AUTOMOUNT ACTIONSTR
 
 WS		[[:blank:]]+
 
 automount	([Aa][Uu][Tt][Oo][Mm][Oo][Uu][Nn][Tt])
 
-source		files|yp|nis|nisplus|ldap|hesiod|winbind
+source		[[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
 
 success		([Ss][Uu][Cc][Cc][Ee][Ss][Ss])
 notfound	([Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd])
@@ -82,8 +82,6 @@ return		([Rr][Ee][Tt][Uu][Rr][Nn])
 
 action		({continue}|{return})
 
-other		[[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
-
 %%
 
 ^{automount}: {
@@ -101,6 +99,14 @@ other		[[:alnum:]@$%^&*()-+_":;?,<>./'{}
 		return SOURCE;
 	}
 
+	"["	{ BEGIN(ACTIONSTR); yyless(0); }
+
+	\n	{ BEGIN(INITIAL); return NL; }
+}
+
+<ACTIONSTR>{
+	{WS}	{ }
+
 	{status} {
 		strcpy(nss_lval.strval, nss_text);
 		return STATUS;
@@ -112,15 +118,11 @@ other		[[:alnum:]@$%^&*()-+_":;?,<>./'{}
 	}
 
 	"["	{ return LBRACKET; }
-	"]"	{ return RBRACKET; }
+	"]"	{ BEGIN(AUTOMOUNT); return RBRACKET; }
 	"="	{ return EQUAL; }
 	"!"	{ return BANG; }
 
-	{other} {
-		strcpy(nss_lval.strval, nss_text);
-		return OTHER;
-	}
-
+	.	{ BEGIN(AUTOMOUNT); yyless(0); }
 	\n	{ BEGIN(INITIAL); return NL; }
 }
 

autofs-5.0.3-mount-thread-create-cond-handling.patch:

Index: autofs-5.0.3-mount-thread-create-cond-handling.patch
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/F-9/autofs-5.0.3-mount-thread-create-cond-handling.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- autofs-5.0.3-mount-thread-create-cond-handling.patch	17 Apr 2008 06:57:10 -0000	1.2
+++ autofs-5.0.3-mount-thread-create-cond-handling.patch	23 May 2008 03:17:29 -0000	1.3
@@ -1,6 +1,5 @@
-diff -up autofs-5.0.3/daemon/indirect.c.mount-thread-create-cond-handling autofs-5.0.3/daemon/indirect.c
---- autofs-5.0.3/daemon/indirect.c.mount-thread-create-cond-handling	2008-04-14 10:52:47.000000000 +0800
-+++ autofs-5.0.3/daemon/indirect.c	2008-04-14 10:53:04.000000000 +0800
+--- autofs-5.0.3.orig/daemon/indirect.c
++++ autofs-5.0.3/daemon/indirect.c
 @@ -660,7 +660,7 @@ static void mount_mutex_unlock(void *arg
  
  static void *do_mount_indirect(void *arg)
@@ -128,9 +127,8 @@
  
  	return 0;
  }
-diff -up autofs-5.0.3/daemon/direct.c.mount-thread-create-cond-handling autofs-5.0.3/daemon/direct.c
---- autofs-5.0.3/daemon/direct.c.mount-thread-create-cond-handling	2008-04-14 10:52:47.000000000 +0800
-+++ autofs-5.0.3/daemon/direct.c	2008-04-14 10:53:04.000000000 +0800
+--- autofs-5.0.3.orig/daemon/direct.c
++++ autofs-5.0.3/daemon/direct.c
 @@ -1217,7 +1217,7 @@ static void mount_mutex_unlock(void *arg
  
  static void *do_mount_direct(void *arg)
@@ -298,3 +296,13 @@
  
  	return 0;
  }
+--- autofs-5.0.3.orig/CHANGELOG
++++ autofs-5.0.3/CHANGELOG
+@@ -11,6 +11,7 @@
+ - add missing check for zero length NIS key (Wengang Wang).
+ - init SASL callbacks on every ldap lookup library load.
+ - fix incorrect match of map type name when included in map name.
++- fix incorrect pthreads condition handling for mount requests.
+  
+ 14/01/2008 autofs-5.0.3
+ -----------------------


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/F-9/autofs.spec,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -r1.241 -r1.242
--- autofs.spec	17 Apr 2008 06:57:10 -0000	1.241
+++ autofs.spec	23 May 2008 03:17:29 -0000	1.242
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.3
-Release: 13
+Release: 15
 Epoch: 1
 License: GPL
 Group: System Environment/Daemons
@@ -22,6 +22,8 @@
 Patch10: autofs-5.0.2-init-cb-on-load.patch
 Patch11: autofs-5.0.3-map-type-in-map-name.patch
 Patch12: autofs-5.0.3-mount-thread-create-cond-handling.patch
+Patch13: autofs-5.0.3-check-for-kernel-automount.patch
+Patch14: autofs-5.0.3-nss-source-any.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs
 Conflicts: kernel < 2.6.17
@@ -75,6 +77,8 @@
 %patch10 -p1
 %patch11 -p1
 %patch12 -p1
+%patch13 -p1
+%patch14 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -127,6 +131,11 @@
 %{_libdir}/autofs/
 
 %changelog
+* Fri May 23 2008 Ian Kent <ikent at redhat.com> - 5.0.3-15
+- check for nohide mounts (bz 442618).
+- ignore nsswitch sources that aren't supported (bz 445880).
+- update patch 12, CHANGELOG entry only change.
+
 * Thu Apr 17 2008 Ian Kent <ikent at redhat.com> - 5.0.3-13
 - fix typo in patch for incorrect pthreads condition handling patch.
 




More information about the fedora-extras-commits mailing list