summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <aahringo@redhat.com>2023-08-01 14:09:44 -0400
committerDavid Teigland <teigland@redhat.com>2023-08-10 10:33:03 -0500
commit643f5cfa610f475c7465e4158b2b1fdd170fac10 (patch)
tree3aa725377f31e997449e54f7a420c5daa32a3f56
parentc84c47333abbbfd83212fcfe2867be4a47e82056 (diff)
downloadlinux-643f5cfa610f475c7465e4158b2b1fdd170fac10.tar.gz
linux-643f5cfa610f475c7465e4158b2b1fdd170fac10.tar.bz2
linux-643f5cfa610f475c7465e4158b2b1fdd170fac10.zip
fs: dlm: cleanup lock order
This patch cleanups the lock order to hold at first the close_lock and then held the nodes_srcu read lock. Probably it will never be a problem as nodes_srcu is only a read lock preventing the node pointer getting freed. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--fs/dlm/midcomms.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
index e1a0df67b566..8ebffbfdc00a 100644
--- a/fs/dlm/midcomms.c
+++ b/fs/dlm/midcomms.c
@@ -1489,12 +1489,12 @@ int dlm_midcomms_close(int nodeid)
synchronize_srcu(&nodes_srcu);
- idx = srcu_read_lock(&nodes_srcu);
mutex_lock(&close_lock);
+ idx = srcu_read_lock(&nodes_srcu);
node = nodeid2node(nodeid, 0);
if (!node) {
- mutex_unlock(&close_lock);
srcu_read_unlock(&nodes_srcu, idx);
+ mutex_unlock(&close_lock);
return dlm_lowcomms_close(nodeid);
}