Patch "dlm: fix creating multiple node structures" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    dlm: fix creating multiple node structures

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dlm-fix-creating-multiple-node-structures.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2bd55507b9e863c8d28b9b4b2a9bb6fb9b7e766d
Author: Alexander Aring <aahringo@xxxxxxxxxx>
Date:   Tue Oct 10 18:04:44 2023 -0400

    dlm: fix creating multiple node structures
    
    [ Upstream commit fe9b619e6e94acf0b068fb1a8f658f5a96b8fad7 ]
    
    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.
    
    Fixes: 63e711b08160 ("fs: dlm: create midcomms nodes when configure")
    Signed-off-by: Alexander Aring <aahringo@xxxxxxxxxx>
    Signed-off-by: David Teigland <teigland@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
index f641b36a36db0..455265c6ba53d 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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux