fs: dlm: filter ourself midcomms calls

It makes no sense to call midcomms/lowcomms functionality for the local
node as socket functionality is only required for remote nodes. This
patch filters those calls in the upper layer of lockspace membership
handling instead of doing it in midcomms/lowcomms layer as they should
never be aware of local nodeid.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
Alexander Aring 2023-05-29 17:44:37 -04:00 committed by David Teigland
parent 70cf2fecf8
commit 07ee38674a
4 changed files with 32 additions and 20 deletions

View File

@ -532,7 +532,8 @@ static void drop_comm(struct config_group *g, struct config_item *i)
struct dlm_comm *cm = config_item_to_comm(i);
if (local_comm == cm)
local_comm = NULL;
dlm_midcomms_close(cm->nodeid);
if (!cm->local)
dlm_midcomms_close(cm->nodeid);
while (cm->addr_count--)
kfree(cm->addr[cm->addr_count]);
config_item_put(i);

View File

@ -546,9 +546,6 @@ int dlm_lowcomms_connect_node(int nodeid)
struct connection *con;
int idx;
if (nodeid == dlm_our_nodeid())
return 0;
idx = srcu_read_lock(&connections_srcu);
con = nodeid2con(nodeid, 0);
if (WARN_ON_ONCE(!con)) {

View File

@ -307,6 +307,21 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
}
}
static int add_remote_member(int nodeid)
{
int error;
if (nodeid == dlm_our_nodeid())
return 0;
error = dlm_lowcomms_connect_node(nodeid);
if (error < 0)
return error;
dlm_midcomms_add_member(nodeid);
return 0;
}
static int dlm_add_member(struct dlm_ls *ls, struct dlm_config_node *node)
{
struct dlm_member *memb;
@ -316,16 +331,16 @@ static int dlm_add_member(struct dlm_ls *ls, struct dlm_config_node *node)
if (!memb)
return -ENOMEM;
error = dlm_lowcomms_connect_node(node->nodeid);
memb->nodeid = node->nodeid;
memb->weight = node->weight;
memb->comm_seq = node->comm_seq;
error = add_remote_member(node->nodeid);
if (error < 0) {
kfree(memb);
return error;
}
memb->nodeid = node->nodeid;
memb->weight = node->weight;
memb->comm_seq = node->comm_seq;
dlm_midcomms_add_member(node->nodeid);
add_ordered_member(ls, memb);
ls->ls_num_nodes++;
return 0;
@ -370,9 +385,17 @@ static void clear_memb_list(struct list_head *head,
}
}
static void remove_remote_member(int nodeid)
{
if (nodeid == dlm_our_nodeid())
return;
dlm_midcomms_remove_member(nodeid);
}
static void clear_members_cb(int nodeid)
{
dlm_midcomms_remove_member(nodeid);
remove_remote_member(nodeid);
}
void dlm_clear_members(struct dlm_ls *ls)
@ -562,7 +585,7 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)
neg++;
list_move(&memb->list, &ls->ls_nodes_gone);
dlm_midcomms_remove_member(memb->nodeid);
remove_remote_member(memb->nodeid);
ls->ls_num_nodes--;
dlm_lsop_recover_slot(ls, memb);
}

View File

@ -1280,9 +1280,6 @@ void dlm_midcomms_add_member(int nodeid)
struct midcomms_node *node;
int idx;
if (nodeid == dlm_our_nodeid())
return;
idx = srcu_read_lock(&nodes_srcu);
node = nodeid2node(nodeid, GFP_NOFS);
if (!node) {
@ -1328,9 +1325,6 @@ void dlm_midcomms_remove_member(int nodeid)
struct midcomms_node *node;
int idx;
if (nodeid == dlm_our_nodeid())
return;
idx = srcu_read_lock(&nodes_srcu);
node = nodeid2node(nodeid, 0);
if (!node) {
@ -1487,9 +1481,6 @@ int dlm_midcomms_close(int nodeid)
struct midcomms_node *node;
int idx, ret;
if (nodeid == dlm_our_nodeid())
return 0;
idx = srcu_read_lock(&nodes_srcu);
/* Abort pending close/remove operation */
node = nodeid2node(nodeid, 0);