cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH dlm/next 1/6] dlm: fix creating multiple node structures
@ 2023-09-06 14:31 Alexander Aring
  2023-09-06 14:31 ` [Cluster-devel] [PATCH dlm/next 2/6] dlm: fix remove member after close call Alexander Aring
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Alexander Aring @ 2023-09-06 14:31 UTC (permalink / raw)
  To: teigland; +Cc: cluster-devel, gfs2, stable

This patch will lookup existing nodes instead of always creating them
when dlm_midcomms_addr() is called. The idea is here to create midcomms
nodes when user space getting informed that nodes joins the cluster. This
is the case when dlm_midcomms_addr() is called, however it can be called
multiple times by user space to add several address configurations to one
node e.g. when using SCTP. Those multiple times need to be filtered out
and we doing that by looking up if the node exists before. Due configfs
entry it is safe that this function gets only called once at a time.

Cc: stable@vger.kernel.org
Fixes: 63e711b08160 ("fs: dlm: create midcomms nodes when configure")
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/midcomms.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
index f641b36a36db..455265c6ba53 100644
--- a/fs/dlm/midcomms.c
+++ b/fs/dlm/midcomms.c
@@ -337,13 +337,21 @@ static struct midcomms_node *nodeid2node(int nodeid)
 
 int dlm_midcomms_addr(int nodeid, struct sockaddr_storage *addr, int len)
 {
-	int ret, r = nodeid_hash(nodeid);
+	int ret, idx, r = nodeid_hash(nodeid);
 	struct midcomms_node *node;
 
 	ret = dlm_lowcomms_addr(nodeid, addr, len);
 	if (ret)
 		return ret;
 
+	idx = srcu_read_lock(&nodes_srcu);
+	node = __find_node(nodeid, r);
+	if (node) {
+		srcu_read_unlock(&nodes_srcu, idx);
+		return 0;
+	}
+	srcu_read_unlock(&nodes_srcu, idx);
+
 	node = kmalloc(sizeof(*node), GFP_NOFS);
 	if (!node)
 		return -ENOMEM;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-06 14:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-06 14:31 [Cluster-devel] [PATCH dlm/next 1/6] dlm: fix creating multiple node structures Alexander Aring
2023-09-06 14:31 ` [Cluster-devel] [PATCH dlm/next 2/6] dlm: fix remove member after close call Alexander Aring
2023-09-06 14:31 ` [Cluster-devel] [PATCH dlm/next 3/6] dlm: be sure we reset all nodes at forced shutdown Alexander Aring
2023-09-06 14:31 ` [Cluster-devel] [PATCH dlm/next 4/6] dlm: fix no ack after final message Alexander Aring
2023-09-06 14:31 ` [Cluster-devel] [PATCH dlm/next 5/6] dlm: fix string may be truncated Alexander Aring
2023-09-06 14:31 ` [Cluster-devel] [PATCH dlm/next 6/6] dlm: slow down filling up processing queue Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).