Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 533aea79872ccd7be2635d272acbf7ea > files > 91

autofs-5.0.1-0.rc2.163.el5.src.rpm

autofs-5.0.1 - fix st_remove_tasks() locking

From: Ian Kent <raven@themaw.net>

The autofs serialization of state changing during task (mount, umount etc.)
execution was being done twice, with the state queue manager and by using
a pipe to communicate state changes to the handle_mounts() thread. This
required the use of two mutexes which was unnecessary and problematic. So
the pipe was removed and the state queue alone now handles this. When this
was done most of the state queue locking was moved into the state queue
manager functions, however, the locking was inadvertantly left out of the
st_remove_tasks() function.
---

 daemon/state.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


--- autofs-5.0.1.orig/daemon/state.c
+++ autofs-5.0.1/daemon/state.c
@@ -825,10 +825,14 @@ void st_remove_tasks(struct autofs_point
 	struct state_queue *task, *waiting;
 	int status;
 
+	st_mutex_lock();
+
 	head = &state_queue;
 
-	if (list_empty(head))
+	if (list_empty(head)) {
+		st_mutex_unlock();
 		return;
+	}
 
 	p = head->next;
 	while (p != head) {
@@ -865,6 +869,8 @@ void st_remove_tasks(struct autofs_point
 	if (status)
 		fatal(status);
 
+	st_mutex_unlock();
+
 	return;
 }