Skip to contentSkip to conversation

master - lvmlockd: fix mutex unlock

PATCH David Teigland 1 participant 1 message Aug 23, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e71c3ff18719f240e92bb641b9b9a01b2619cc93
Commit:        e71c3ff18719f240e92bb641b9b9a01b2619cc93
Parent:        46ddd5520cd4d5415ee936b6cbdb6e1936bc7d26
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Aug 23 11:30:55 2017 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Aug 23 11:30:55 2017 -0500

lvmlockd: fix mutex unlock

Remove an unwanted pthread_mutex_unlock which would lead to a double unlock.

---
 daemons/lvmlockd/lvmlockd-core.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
daemons/lvmlockd/lvmlockd-core.c +2 -1
index da17b71..36d84e2 100644
@@ -3842,8 +3842,9 @@ static int add_lock_action(struct action *act)
 	pthread_mutex_lock(&lockspaces_mutex);
 	if (ls_name[0])
 		ls = find_lockspace_name(ls_name);
-	pthread_mutex_unlock(&lockspaces_mutex);
 	if (!ls) {
+		pthread_mutex_unlock(&lockspaces_mutex);
+
 		if (act->op == LD_OP_UPDATE && act->rt == LD_RT_VG) {
 			log_debug("lockspace \"%s\" not found ignored for vg update", ls_name);
 			return -ENOLS;