dlm: fix creating multiple node structures
authorAlexander Aring <aahringo@redhat.com>
Tue, 10 Oct 2023 22:04:44 +0000 (18:04 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:21 +0000 (11:59 +0100)
commitc0c2b34607fd748b9ddbf9cc001171414fea3697
tree22021cfe7180fa0667dbb32b286c1af834ca1476
parent4a31e3c838da6d3f7ad063dba64ccbd492469ac1
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@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/midcomms.c