[autofs] - add two upstream bug fixes.

Ian Kent iankent at fedoraproject.org
Sun Apr 28 06:14:13 UTC 2013


commit bd9a9ee2a7b1537f4db95f4f352bf578dfa353b5
Author: Ian Kent <ikent at redhat.com>
Date:   Sun Apr 28 14:13:33 2013 +0800

    - add two upstream bug fixes.

 ...-5.0.7-fix-submount-tree-not-all-expiring.patch |   70 +++++++++++++++++++
 ...s-5.0.7-syncronize-handle_mounts-shutdown.patch |   73 ++++++++++++++++++++
 autofs.spec                                        |   10 +++-
 3 files changed, 152 insertions(+), 1 deletions(-)
---
diff --git a/autofs-5.0.7-fix-submount-tree-not-all-expiring.patch b/autofs-5.0.7-fix-submount-tree-not-all-expiring.patch
new file mode 100644
index 0000000..09ed383
--- /dev/null
+++ b/autofs-5.0.7-fix-submount-tree-not-all-expiring.patch
@@ -0,0 +1,70 @@
+autofs-5.0.7 - fix submount tree not all expiring
+
+From: Ian Kent <ikent at redhat.com>
+
+Due to the change in the expire-specific-submount-only patch, sub-mounts
+within an indirect mount that follow a submount (in the check order) won't
+be expired if that submount is busy.
+---
+ CHANGELOG    |    1 +
+ lib/master.c |   24 +++++++++++++++---------
+ 2 files changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/CHANGELOG b/CHANGELOG
+index f1ec1e5..4106e7f 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -39,6 +39,7 @@
+ - document browse option in man page.
+ - fix some automount(8) typos.
+ - syncronize handle_mounts() shutdown.
++- fix submount tree not all expiring.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+diff --git a/lib/master.c b/lib/master.c
+index a0e62f2..64dbcb1 100644
+--- a/lib/master.c
++++ b/lib/master.c
+@@ -905,15 +905,24 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
+ 		this = list_entry(p, struct autofs_point, mounts);
+ 		p = p->prev;
+ 
+-		if (!master_submount_list_empty(this)) {
+-			mounts_mutex_unlock(ap);
+-			return master_notify_submount(this, path, state);
+-		}
+-
+ 		/* path not the same */
+ 		if (strcmp(this->path, path))
+ 			continue;
+ 
++		if (!master_submount_list_empty(this)) {
++			char *this_path = strdup(this->path);
++			if (this_path) {
++				mounts_mutex_unlock(ap);
++				master_notify_submount(this, path, state);
++				mounts_mutex_lock(ap);
++				if (!__master_find_submount(ap, this_path)) {
++					free(this_path);
++					continue;
++				}
++				free(this_path);
++			}
++		}
++
+ 		/* Now we have found the submount we want to expire */
+ 
+ 		st_mutex_lock();
+@@ -959,10 +968,7 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
+ 			st_mutex_lock();
+ 		}
+ 		st_mutex_unlock();
+-		mounts_mutex_unlock(ap);
+-
+-		return ret;
+-
++		break;
+ 	}
+ 
+ 	mounts_mutex_unlock(ap);
diff --git a/autofs-5.0.7-syncronize-handle_mounts-shutdown.patch b/autofs-5.0.7-syncronize-handle_mounts-shutdown.patch
new file mode 100644
index 0000000..25b40aa
--- /dev/null
+++ b/autofs-5.0.7-syncronize-handle_mounts-shutdown.patch
@@ -0,0 +1,73 @@
+autofs-5.0.7 - syncronize handle_mounts() shutdown
+
+From: Ian Kent <ikent at redhat.com>
+
+When re-reading the master map the signal handler thread receives
+a SIGTERM signal from handle_mounts_cleanup() for map entries that
+have been removed. This is done to allow joining with handle_mounts()
+threads before shutting down to ensure clean up has been completed
+before the thread terminates.
+
+But, if more than one map entry is removed, multiple threads may be
+cleaned up during the handling of a single signal so there can be no
+work to do when a subsequent signal is received. In this case the
+signal handler thread interprets the additional SIGTERM signal as a
+request to shutdown and exits.
+---
+ CHANGELOG          |    1 +
+ daemon/automount.c |    9 +++++++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/CHANGELOG b/CHANGELOG
+index 488ad1e..f1ec1e5 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -38,6 +38,7 @@
+ - fix systemd unidir in spec file.
+ - document browse option in man page.
+ - fix some automount(8) typos.
++- syncronize handle_mounts() shutdown.
+ 
+ 25/07/2012 autofs-5.0.7
+ =======================
+diff --git a/daemon/automount.c b/daemon/automount.c
+index 4c651cf..3f9337f 100644
+--- a/daemon/automount.c
++++ b/daemon/automount.c
+@@ -1285,7 +1285,8 @@ static int do_hup_signal(struct master *master, time_t age)
+ 	nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
+ 
+ 	master_mutex_lock();
+-	if (master->reading) {
++	/* Already doing a map read or shutdown or no mounts */
++	if (master->reading || list_empty(&master->mounts)) {
+ 		status = pthread_mutex_unlock(&mrc.mutex);
+ 		if (status)
+ 			fatal(status);
+@@ -1449,6 +1450,7 @@ static void handle_mounts_cleanup(void *arg)
+ 	char path[PATH_MAX + 1];
+ 	char buf[MAX_ERR_BUF];
+ 	unsigned int clean = 0, submount, logopt;
++	unsigned int pending = 0;
+ 
+ 	ap = (struct autofs_point *) arg;
+ 
+@@ -1466,6 +1468,9 @@ static void handle_mounts_cleanup(void *arg)
+ 		list_del_init(&ap->mounts);
+ 	}
+ 
++	/* Don't signal the handler if we have already done so */
++	if (!list_empty(&master_list->completed))
++		pending = 1;
+ 	master_remove_mapent(ap->entry);
+ 	master_source_unlock(ap->entry);
+ 
+@@ -1498,7 +1503,7 @@ static void handle_mounts_cleanup(void *arg)
+ 	 * so it can join with any completed handle_mounts() threads and
+ 	 * perform final cleanup.
+ 	 */
+-	if (!submount)
++	if (!submount && !pending)
+ 		pthread_kill(state_mach_thid, SIGTERM);
+ 
+ 	master_mutex_unlock();
diff --git a/autofs.spec b/autofs.spec
index b2c3674..6aaf38c 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -8,7 +8,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.7
-Release: 13%{?dist}
+Release: 14%{?dist}
 Epoch: 1
 License: GPLv2+
 Group: System Environment/Daemons
@@ -55,6 +55,8 @@ Patch39: autofs-5.0.7-fix-systemd-unidir-in-spec-file.patch
 Patch40: autofs-5.0.7-document-browse-option-in-man-page.patch
 Patch41: autofs-5.0.7-fix-automounter-support-on-parisc.patch
 Patch42: autofs-5.0.7-fix-some-automount_8-typos.patch
+Patch43: autofs-5.0.7-syncronize-handle_mounts-shutdown.patch
+Patch44: autofs-5.0.7-fix-submount-tree-not-all-expiring.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 %if %{with_systemd}
 BuildRequires: systemd-units
@@ -154,6 +156,8 @@ echo %{version}-%{release} > .version
 %patch40 -p1
 %patch41 -p1
 %patch42 -p1
+%patch43 -p1
+%patch44 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -245,6 +249,10 @@ fi
 %dir /etc/auto.master.d
 
 %changelog
+* Sun Apr 28 2013 Ian Kent <ikent at redhat.com> - 1:5.0.7-14
+- fix syncronize of handle_mounts() shutdown.
+- fix submount tree not all expiring.
+
 * Tue Mar 26 2013 Ian Kent <ikent at redhat.com> - 1:5.0.7-13
 - fix some automount(8) typos (bz664178).
 


More information about the scm-commits mailing list