Message ID | 1466070465-1021-38-git-send-email-hare@suse.de (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | christophe varoqui |
Headers | show |
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index bd7372d..2edc8ad 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c @@ -331,9 +331,11 @@ libcheck_check (struct checker * c) setup_thread_attr(&attr, 32 * 1024, 1); r = pthread_create(&ct->thread, &attr, tur_thread, ct); if (r) { + pthread_spin_lock(&ct->hldr_lock); + ct->holders--; + pthread_spin_unlock(&ct->hldr_lock); pthread_mutex_unlock(&ct->lock); ct->thread = 0; - ct->holders--; condlog(3, "%d:%d: failed to start tur thread, using" " sync mode", TUR_DEVT(ct)); return tur_check(c->fd, c->timeout, c->message);
When failing to start the pthread we still should be taking the spin lock; there might be other threads pending. Found by coverity. Signed-off-by: Hannes Reinecke <hare@suse.com> --- libmultipath/checkers/tur.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)