Skip to contentSkip to conversation

fs: dlm: add dlm_is_member() check if fenced

PATCH New Alexander Aring 1 participant 2 messages Jun 15, 2022 – Jun 20, 2022 Distributed lock manager (DLM)

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

PATCH 1/1 fs: dlm: add dlm_is_member() check if fenced

This patch adds an additional check if the "fenced" node is part of any lockspace. A node should not be part of any lockspace when it's got fenced. This is an additional requirement besides that all lockspace activity should be stopped before calling dlm_midcomms_close().

---
 fs/dlm/lockspace.c | 5 ++++-
 fs/dlm/lockspace.h | 2 +-
 fs/dlm/midcomms.c  | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
fs/dlm/lockspace.c +4 -1
index 0c3613d09c5e..a4f492189a08 100644
@@ -923,12 +923,15 @@ void dlm_stop_lockspaces(void)
 		log_print("dlm user daemon left %d lockspaces", count);
 }
 
-void dlm_stop_lockspaces_check(void)
+void dlm_stop_lockspaces_check(int nodeid)
 {
 	struct dlm_ls *ls;
 
 	spin_lock(&lslist_lock);
 	list_for_each_entry(ls, &lslist, ls_list) {
+		if (WARN_ON(dlm_is_member(ls, nodeid)))
+			break;
+
 		if (WARN_ON(!rwsem_is_locked(&ls->ls_in_recovery) ||
 			    !dlm_locking_stopped(ls)))
 			break;
fs/dlm/lockspace.h +1 -1
index 306fc4f4ea15..9d1ea1013650 100644
@@ -19,7 +19,7 @@ struct dlm_ls *dlm_find_lockspace_local(void *id);
 struct dlm_ls *dlm_find_lockspace_device(int minor);
 void dlm_put_lockspace(struct dlm_ls *ls);
 void dlm_stop_lockspaces(void);
-void dlm_stop_lockspaces_check(void);
+void dlm_stop_lockspaces_check(int nodeid);
 
 #endif				/* __LOCKSPACE_DOT_H__ */
 
fs/dlm/midcomms.c +1 -1
index 6489bc22ad61..22037183f565 100644
@@ -1413,7 +1413,7 @@ int dlm_midcomms_close(int nodeid)
 	if (nodeid == dlm_our_nodeid())
 		return 0;
 
-	dlm_stop_lockspaces_check();
+	dlm_stop_lockspaces_check(nodeid);
 
 	idx = srcu_read_lock(&nodes_srcu);
 	/* Abort pending close/remove operation */
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/1 fs: dlm: add dlm_is_member() check if fenced

Hi,

Quoted 21 lines · Alexander Aring

This patch adds an additional check if the "fenced" node is part of any lockspace. A node should not be part of any lockspace when it's got fenced. This is an additional requirement besides that all lockspace activity should be stopped before calling dlm_midcomms_close().

---
 fs/dlm/lockspace.c | 5 ++++-
 fs/dlm/lockspace.h | 2 +-
 fs/dlm/midcomms.c  | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
fs/dlm/lockspace.c +0 -0
index 0c3613d09c5e..a4f492189a08 100644
@@ -923,12 +923,15 @@ void dlm_stop_lockspaces(void)
                log_print("dlm user daemon left %d lockspaces", count);
 }
 

fs/dlm/lockspace.c void dlm_stop_lockspaces(void) · line 934

Quoted 10 lines
fs/dlm/lockspace.c +4 -1
-void dlm_stop_lockspaces_check(void)
+void dlm_stop_lockspaces_check(int nodeid)
 {
        struct dlm_ls *ls;
 
        spin_lock(&lslist_lock);
        list_for_each_entry(ls, &lslist, ls_list) {
+               if (WARN_ON(dlm_is_member(ls, nodeid)))
+                       break;
+

I will drop this patch. I currently run into this warning. We can assume that there are no dlm messages processed that we transmit any new reply message. Also no new message can be triggered by e.g. dlm_lock(), because the previously checked if recovery lock is held and the lockspace running check.

There exist two kinds of "memberships" one is nodeid (lockspace level) and one is node IP (socket level). This one will cut socket level and there is a MUST requirement which is probably done afterwards to remove the node from all lockspaces. I probably would like to see first the lockspace member being removed THEN the socket connection gets closed... however it's probably the other way around and maybe due the fact of corosync chronological order callback handling (e.g. lost quorum vs resource membership), I will look again into that in another time to see how things can maybe be changed... (if possible)

Maybe midcomms_close can also remove the lockspace member and if there is a "nodeid from resource membership removal" afterwards, we simply don't care if it's already removed...

- Alex