Skip to contentSkip to conversation

dlm_controld: fix deadlock when nodes without quorum stop services

PATCH New Lidong Zhong 1 participant 1 message May 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dlm_controld: fix deadlock when nodes without quorum stop services

When nodes without quorum start to stop services, node which releases lockspace slower will be hang(because of a deadlock in kernel) until quorum comes back while the one releases faster could stop successfuly. It leads to a different behavior.

please refer to https://bugzilla.novell.com/show_bug.cgi?id=874705
for detail.

---
 dlm_controld/cpg.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
dlm_controld/cpg.c +17 -1
index f971158..754a852 100644
@@ -1261,6 +1261,19 @@ void process_lockspace_changes(void)
 	poll_fs = 0;
 
 	list_for_each_entry_safe(ls, safe, &lockspaces, list) {
+		if (ls->leaving && !(opt(enable_quorum_lockspace_ind) 
+			&& !cluster_quorate)) {
+			log_group(ls, "confchg for our leave");
+			stop_kernel(ls, 0);
+			set_configfs_members(ls, ls->name, 0, NULL, 0, NULL);
+			set_sysfs_event_done(ls->name, 0);
+			cpg_finalize(ls->cpg_handle);
+			client_dead(ls->cpg_client);
+			purge_plocks(ls, our_nodeid, 1);
+			list_del(&ls->list);
+			free_ls(ls);
+			return;
+		}
 		if (!list_empty(&ls->changes))
 			apply_changes(ls);
 	}
@@ -1414,7 +1427,10 @@ static void confchg_cb(cpg_handle_t handle,
 		return;
 	}
 
-	if (ls->leaving && we_left(left_list, left_list_entries)) {
+	/* check currently if we have quorum in order to keep the
+	   same behavior with other nodes */
+	if (ls->leaving && we_left(left_list, left_list_entries)
+		&& !(opt(enable_quorum_lockspace_ind) && !cluster_quorate)) {
 		/* we called cpg_leave(), and this should be the final
 		   cpg callback we receive */
 		log_group(ls, "confchg for our leave");
Signature · 1 line
1.8.1.4