drbd/0005-drbd-Proper-locking-around-new_current_uuid-on-a-dis.patch

40 lines
1.2 KiB
Diff
Raw Normal View History

From c7384276634be7c5b49ef0b8d7fa064927a207f8 Mon Sep 17 00:00:00 2001
From: Philipp Reisner <philipp.reisner@linbit.com>
Date: Wed, 14 Aug 2024 19:42:40 +0200
Subject: [PATCH 05/32] drbd: Proper locking around new_current_uuid on a
diskless
Like the current UUID of a diskful node, changing the exposed_uuid of
a diskless node needs to be serialized with the UUID exchange when
establishing new connections.
---
drbd/drbd_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index bc3283b045c9..2792b9896271 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -4827,7 +4827,10 @@ void drbd_uuid_new_current(struct drbd_device *device, bool forced)
current_uuid |= UUID_PRIMARY;
else
current_uuid &= ~UUID_PRIMARY;
+
+ down_write(&device->uuid_sem);
drbd_uuid_set_exposed(device, current_uuid, false);
+ downgrade_write(&device->uuid_sem);
drbd_info(device, "sending new current UUID: %016llX\n", current_uuid);
weak_nodes = drbd_weak_nodes_device(device);
@@ -4837,6 +4840,7 @@ void drbd_uuid_new_current(struct drbd_device *device, bool forced)
peer_device->current_uuid = current_uuid;
}
}
+ up_read(&device->uuid_sem);
}
}
--
2.35.3