|
Ian Kent |
597437 |
autofs-5.0.4 - fix st_remove_tasks() locking
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
The autofs serialization of state changing during task (mount, umount etc.)
|
|
Ian Kent |
597437 |
execution was being done twice, with the state queue manager and by using
|
|
Ian Kent |
597437 |
a pipe to communicate state changes to the handle_mounts() thread. This
|
|
Ian Kent |
597437 |
required the use of two mutexes which was unnecessary and problematic. So
|
|
Ian Kent |
597437 |
the pipe was removed and the state queue alone now handles this. When this
|
|
Ian Kent |
597437 |
was done most of the state queue locking was moved into the state queue
|
|
Ian Kent |
597437 |
manager functions, however, the locking was inadvertantly left out of the
|
|
Ian Kent |
597437 |
st_remove_tasks() function.
|
|
Ian Kent |
597437 |
---
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
CHANGELOG | 1 +
|
|
Ian Kent |
597437 |
daemon/state.c | 8 +++++++-
|
|
Ian Kent |
597437 |
2 files changed, 8 insertions(+), 1 deletions(-)
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
Ian Kent |
597437 |
index a143294..c8b88e4 100644
|
|
Ian Kent |
597437 |
--- a/CHANGELOG
|
|
Ian Kent |
597437 |
+++ b/CHANGELOG
|
|
Ian Kent |
597437 |
@@ -37,6 +37,7 @@
|
|
Ian Kent |
597437 |
- clear rpc client on lookup fail.
|
|
Ian Kent |
597437 |
- fix lsb init script header.
|
|
Ian Kent |
597437 |
- fix memory leak reading master map.
|
|
Ian Kent |
597437 |
+- fix st_remove_tasks() locking.
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
4/11/2008 autofs-5.0.4
|
|
Ian Kent |
597437 |
-----------------------
|
|
Ian Kent |
597437 |
diff --git a/daemon/state.c b/daemon/state.c
|
|
Ian Kent |
597437 |
index 417fde1..533e241 100644
|
|
Ian Kent |
597437 |
--- a/daemon/state.c
|
|
Ian Kent |
597437 |
+++ b/daemon/state.c
|
|
Ian Kent |
597437 |
@@ -783,10 +783,14 @@ void st_remove_tasks(struct autofs_point *ap)
|
|
Ian Kent |
597437 |
struct state_queue *task, *waiting;
|
|
Ian Kent |
597437 |
int status;
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
+ st_mutex_lock();
|
|
Ian Kent |
597437 |
+
|
|
Ian Kent |
597437 |
head = &state_queue;
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
- if (list_empty(head))
|
|
Ian Kent |
597437 |
+ if (list_empty(head)) {
|
|
Ian Kent |
597437 |
+ st_mutex_unlock();
|
|
Ian Kent |
597437 |
return;
|
|
Ian Kent |
597437 |
+ }
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
p = head->next;
|
|
Ian Kent |
597437 |
while (p != head) {
|
|
Ian Kent |
597437 |
@@ -823,6 +827,8 @@ void st_remove_tasks(struct autofs_point *ap)
|
|
Ian Kent |
597437 |
if (status)
|
|
Ian Kent |
597437 |
fatal(status);
|
|
Ian Kent |
597437 |
|
|
Ian Kent |
597437 |
+ st_mutex_unlock();
|
|
Ian Kent |
597437 |
+
|
|
Ian Kent |
597437 |
return;
|
|
Ian Kent |
597437 |
}
|
|
Ian Kent |
597437 |
|