Skip to content

Commit 2776635

Browse files
Alexander Aringteigland
authored andcommitted
dlm: fix remove member after close call
The idea of commit 63e711b ("fs: dlm: create midcomms nodes when configure") is to set the midcomms node lifetime when a node joins or leaves the cluster. Currently we can hit the following warning: [10844.611495] ------------[ cut here ]------------ [10844.615913] WARNING: CPU: 4 PID: 84304 at fs/dlm/midcomms.c:1263 dlm_midcomms_remove_member+0x13f/0x180 [dlm] or running in a state where we hit a midcomms node usage count in a negative value: [ 260.830782] node 2 users dec count -1 The first warning happens when the a specific node does not exists and it was probably removed but dlm_midcomms_close() which is called when a node leaves the cluster. The second kernel log message is probably in a case when dlm_midcomms_addr() is called when a joined the cluster but due fencing a node leaved the cluster without getting removed from the lockspace. If the node joins the cluster and it was removed from the cluster due fencing the first call is to remove the node from lockspaces triggered by the user space. In both cases if the node wasn't found or the user count is zero, we should ignore any additional midcomms handling of dlm_midcomms_remove_member(). Fixes: 63e711b ("fs: dlm: create midcomms nodes when configure") Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent fe9b619 commit 2776635

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

fs/dlm/midcomms.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,12 +1268,23 @@ void dlm_midcomms_remove_member(int nodeid)
12681268

12691269
idx = srcu_read_lock(&nodes_srcu);
12701270
node = nodeid2node(nodeid);
1271-
if (WARN_ON_ONCE(!node)) {
1271+
/* in case of dlm_midcomms_close() removes node */
1272+
if (!node) {
12721273
srcu_read_unlock(&nodes_srcu, idx);
12731274
return;
12741275
}
12751276

12761277
spin_lock(&node->state_lock);
1278+
/* case of dlm_midcomms_addr() created node but
1279+
* was not added before because dlm_midcomms_close()
1280+
* removed the node
1281+
*/
1282+
if (!node->users) {
1283+
spin_unlock(&node->state_lock);
1284+
srcu_read_unlock(&nodes_srcu, idx);
1285+
return;
1286+
}
1287+
12771288
node->users--;
12781289
pr_debug("node %d users dec count %d\n", nodeid, node->users);
12791290

0 commit comments

Comments
 (0)