Patch "dlm: fix remove member after close call" 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 remove member after close call

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-remove-member-after-close-call.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 2c725725503a7d7e23ae4900165da5bc132b559f
Author: Alexander Aring <aahringo@xxxxxxxxxx>
Date:   Tue Oct 10 18:04:45 2023 -0400

    dlm: fix remove member after close call
    
    [ Upstream commit 2776635edc7fcd62e03cb2efb93c31f685887460 ]
    
    The idea of commit 63e711b08160 ("fs: dlm: create midcomms nodes when
    configure") is to set the midcomms node lifetime when a node joins or
    leaves the cluster. Currently we can hit the following warning:
    
    [10844.611495] ------------[ cut here ]------------
    [10844.615913] WARNING: CPU: 4 PID: 84304 at fs/dlm/midcomms.c:1263
    dlm_midcomms_remove_member+0x13f/0x180 [dlm]
    
    or running in a state where we hit a midcomms node usage count in a
    negative value:
    
    [  260.830782] node 2 users dec count -1
    
    The first warning happens when the a specific node does not exists and
    it was probably removed but dlm_midcomms_close() which is called when a
    node leaves the cluster. The second kernel log message is probably in a
    case when dlm_midcomms_addr() is called when a joined the cluster but
    due fencing a node leaved the cluster without getting removed from the
    lockspace. If the node joins the cluster and it was removed from the
    cluster due fencing the first call is to remove the node from lockspaces
    triggered by the user space. In both cases if the node wasn't found or
    the user count is zero, we should ignore any additional midcomms handling
    of dlm_midcomms_remove_member().
    
    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 455265c6ba53d..4ad71e97cec2a 100644
--- a/fs/dlm/midcomms.c
+++ b/fs/dlm/midcomms.c
@@ -1268,12 +1268,23 @@ void dlm_midcomms_remove_member(int nodeid)
 
 	idx = srcu_read_lock(&nodes_srcu);
 	node = nodeid2node(nodeid);
-	if (WARN_ON_ONCE(!node)) {
+	/* in case of dlm_midcomms_close() removes node */
+	if (!node) {
 		srcu_read_unlock(&nodes_srcu, idx);
 		return;
 	}
 
 	spin_lock(&node->state_lock);
+	/* case of dlm_midcomms_addr() created node but
+	 * was not added before because dlm_midcomms_close()
+	 * removed the node
+	 */
+	if (!node->users) {
+		spin_unlock(&node->state_lock);
+		srcu_read_unlock(&nodes_srcu, idx);
+		return;
+	}
+
 	node->users--;
 	pr_debug("node %d users dec count %d\n", nodeid, node->users);
 



[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