drbd: re-add lost conf_mutex protection in drbd_set_role
authorLars Ellenberg <lars.ellenberg@linbit.com>
Wed, 5 Feb 2014 05:17:01 +0000 (06:17 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Jul 2014 16:34:52 +0000 (18:34 +0200)
The conf_update mutex used to be held while clearing the
net_conf->discard_my_data flag inside drbd_set_role.

It was moved into drbd_adm_set_role with
    drbd: allow parallel promote/demote actions
but then replaced at that location by the newly introduced adm_mutex with
    drbd: Fix a potential deadlock in drbdsetup, introduce resource->adm_mutex

And I simply forgot to put it back in at the original location.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_nl.c

index 133e9b37c6c27e5d86488da2e000e4eabb30ffde..23670d81ec32401a1884f3e57cde3a635a5f13cd 100644 (file)
@@ -661,11 +661,11 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for
                        put_ldev(device);
                }
        } else {
-               /* Called from drbd_adm_set_role only.
-                * We are still holding the conf_update mutex. */
+               mutex_lock(&device->resource->conf_update);
                nc = connection->net_conf;
                if (nc)
                        nc->discard_my_data = 0; /* without copy; single bit op is atomic */
+               mutex_unlock(&device->resource->conf_update);
 
                set_disk_ro(device->vdisk, false);
                if (get_ldev(device)) {
This page took 0.028521 seconds and 5 git commands to generate.