summaryrefslogtreecommitdiff
path: root/multipath
diff options
context:
space:
mode:
authorKonrad Rzeszutek <konrad@virtualiron.com>2009-03-24 18:49:14 +0100
committerChristophe Varoqui <christophe.varoqui@free.fr>2009-03-24 18:49:14 +0100
commita403f57b991f3be7c7ea6250d95fad1554c9d6ca (patch)
tree8f0fa74a9ca07e58f91df19d9e6f0262aa37ea1f /multipath
parent57a6c5c72399df8b90c8a75666dd812b7b549ccd (diff)
downloadmultipath-tools-a403f57b991f3be7c7ea6250d95fad1554c9d6ca.tar.gz
multipath-tools-a403f57b991f3be7c7ea6250d95fad1554c9d6ca.tar.bz2
multipath-tools-a403f57b991f3be7c7ea6250d95fad1554c9d6ca.zip
Race-condition fix with free_waiter threads during shutdown.
When we shutdown, the main process locks the mutex, causing all of the free_waiter functions to pile up on their lock. Once we unlock in the main process, all of the free_waiters start working. However the next instruction in the main proces is to destroy the mutex. The short window is all the free_waiter threads have to do their cleanup before they attempt to unlock the mutex - which might have been de-allocated (and set to NULL). End result can be a seg-fault. This fix adds a ref-count to the mutex so that during shutdown we spin and wait until all of the free_waiter functions have completed and the ref-count is set to zero.
Diffstat (limited to 'multipath')
-rw-r--r--multipath/main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/multipath/main.c b/multipath/main.c
index 8b38a6e..2f227d1 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -439,6 +439,7 @@ main (int argc, char *argv[])
condlog(3, "restart multipath configuration process");
out:
+
sysfs_cleanup();
dm_lib_release();
dm_lib_exit();