multipath: fix shutdown crashes
authorBenjamin Marzinski <bmarzins@redhat.com>
Fri, 10 Feb 2012 18:10:11 +0000 (12:10 -0600)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sat, 11 Feb 2012 08:19:58 +0000 (09:19 +0100)
commit03ec4efe8775f0ca076df3fb85b9defab4ffad30
tree8a90f43939a9d4bbe16a4b12ed2f5a14b39e50cd
parentae4e8a681e918d9835d4692801fed92c199f4ef5
multipath: fix shutdown crashes

A number of processes don't reach a pthread cancellation point
before they use the pathvec or mpvec vectors, after they've
locked the vecs lock.  This can cause crashes on shutdown, since
these vectors are deallocated.  Also, the log thread accesses a
number of resources which may have been deallocated during shutdown
without holding any locks. This patch avoids these issues by
adding pthread_testcancel() checks after acquiring the vecs lock,
and having the child process make sure the log thread has exitted
before deallocating the resources.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
libmultipath/log_pthread.c
libmultipath/waiter.c
multipathd/main.c