Skip to content

Commit 07ee386

Browse files
Alexander Aringteigland
authored andcommitted
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 <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 70cf2fe commit 07ee386

File tree

4 files changed

+32
-20
lines changed

4 files changed

+32
-20
lines changed

fs/dlm/config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ static void drop_comm(struct config_group *g, struct config_item *i)
532532
struct dlm_comm *cm = config_item_to_comm(i);
533533
if (local_comm == cm)
534534
local_comm = NULL;
535-
dlm_midcomms_close(cm->nodeid);
535+
if (!cm->local)
536+
dlm_midcomms_close(cm->nodeid);
536537
while (cm->addr_count--)
537538
kfree(cm->addr[cm->addr_count]);
538539
config_item_put(i);

fs/dlm/lowcomms.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,6 @@ int dlm_lowcomms_connect_node(int nodeid)
546546
struct connection *con;
547547
int idx;
548548

549-
if (nodeid == dlm_our_nodeid())
550-
return 0;
551-
552549
idx = srcu_read_lock(&connections_srcu);
553550
con = nodeid2con(nodeid, 0);
554551
if (WARN_ON_ONCE(!con)) {

fs/dlm/member.c

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,21 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
307307
}
308308
}
309309

310+
static int add_remote_member(int nodeid)
311+
{
312+
int error;
313+
314+
if (nodeid == dlm_our_nodeid())
315+
return 0;
316+
317+
error = dlm_lowcomms_connect_node(nodeid);
318+
if (error < 0)
319+
return error;
320+
321+
dlm_midcomms_add_member(nodeid);
322+
return 0;
323+
}
324+
310325
static int dlm_add_member(struct dlm_ls *ls, struct dlm_config_node *node)
311326
{
312327
struct dlm_member *memb;
@@ -316,16 +331,16 @@ static int dlm_add_member(struct dlm_ls *ls, struct dlm_config_node *node)
316331
if (!memb)
317332
return -ENOMEM;
318333

319-
error = dlm_lowcomms_connect_node(node->nodeid);
334+
memb->nodeid = node->nodeid;
335+
memb->weight = node->weight;
336+
memb->comm_seq = node->comm_seq;
337+
338+
error = add_remote_member(node->nodeid);
320339
if (error < 0) {
321340
kfree(memb);
322341
return error;
323342
}
324343

325-
memb->nodeid = node->nodeid;
326-
memb->weight = node->weight;
327-
memb->comm_seq = node->comm_seq;
328-
dlm_midcomms_add_member(node->nodeid);
329344
add_ordered_member(ls, memb);
330345
ls->ls_num_nodes++;
331346
return 0;
@@ -370,11 +385,19 @@ static void clear_memb_list(struct list_head *head,
370385
}
371386
}
372387

373-
static void clear_members_cb(int nodeid)
388+
static void remove_remote_member(int nodeid)
374389
{
390+
if (nodeid == dlm_our_nodeid())
391+
return;
392+
375393
dlm_midcomms_remove_member(nodeid);
376394
}
377395

396+
static void clear_members_cb(int nodeid)
397+
{
398+
remove_remote_member(nodeid);
399+
}
400+
378401
void dlm_clear_members(struct dlm_ls *ls)
379402
{
380403
clear_memb_list(&ls->ls_nodes, clear_members_cb);
@@ -562,7 +585,7 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)
562585

563586
neg++;
564587
list_move(&memb->list, &ls->ls_nodes_gone);
565-
dlm_midcomms_remove_member(memb->nodeid);
588+
remove_remote_member(memb->nodeid);
566589
ls->ls_num_nodes--;
567590
dlm_lsop_recover_slot(ls, memb);
568591
}

fs/dlm/midcomms.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,9 +1280,6 @@ void dlm_midcomms_add_member(int nodeid)
12801280
struct midcomms_node *node;
12811281
int idx;
12821282

1283-
if (nodeid == dlm_our_nodeid())
1284-
return;
1285-
12861283
idx = srcu_read_lock(&nodes_srcu);
12871284
node = nodeid2node(nodeid, GFP_NOFS);
12881285
if (!node) {
@@ -1328,9 +1325,6 @@ void dlm_midcomms_remove_member(int nodeid)
13281325
struct midcomms_node *node;
13291326
int idx;
13301327

1331-
if (nodeid == dlm_our_nodeid())
1332-
return;
1333-
13341328
idx = srcu_read_lock(&nodes_srcu);
13351329
node = nodeid2node(nodeid, 0);
13361330
if (!node) {
@@ -1487,9 +1481,6 @@ int dlm_midcomms_close(int nodeid)
14871481
struct midcomms_node *node;
14881482
int idx, ret;
14891483

1490-
if (nodeid == dlm_our_nodeid())
1491-
return 0;
1492-
14931484
idx = srcu_read_lock(&nodes_srcu);
14941485
/* Abort pending close/remove operation */
14951486
node = nodeid2node(nodeid, 0);

0 commit comments

Comments
 (0)