提交 720979fb 编写于 作者: L Lars Ellenberg 提交者: Philipp Reisner

drbd: move set_disk_ro() to after we persisted the new role

This probably does not have any real life impact,
but we should first persist any potentially new UUID
and other meta data flags, as well as our new role,
before we allow/disallow write access.
Signed-off-by: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 123ff122
...@@ -655,7 +655,6 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for ...@@ -655,7 +655,6 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for
/* FIXME also wait for all pending P_BARRIER_ACK? */ /* FIXME also wait for all pending P_BARRIER_ACK? */
if (new_role == R_SECONDARY) { if (new_role == R_SECONDARY) {
set_disk_ro(device->vdisk, true);
if (get_ldev(device)) { if (get_ldev(device)) {
device->ldev->md.uuid[UI_CURRENT] &= ~(u64)1; device->ldev->md.uuid[UI_CURRENT] &= ~(u64)1;
put_ldev(device); put_ldev(device);
...@@ -667,7 +666,6 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for ...@@ -667,7 +666,6 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for
nc->discard_my_data = 0; /* without copy; single bit op is atomic */ nc->discard_my_data = 0; /* without copy; single bit op is atomic */
mutex_unlock(&device->resource->conf_update); mutex_unlock(&device->resource->conf_update);
set_disk_ro(device->vdisk, false);
if (get_ldev(device)) { if (get_ldev(device)) {
if (((device->state.conn < C_CONNECTED || if (((device->state.conn < C_CONNECTED ||
device->state.pdsk <= D_FAILED) device->state.pdsk <= D_FAILED)
...@@ -690,7 +688,7 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for ...@@ -690,7 +688,7 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for
} }
drbd_md_sync(device); drbd_md_sync(device);
set_disk_ro(device->vdisk, new_role == R_SECONDARY);
kobject_uevent(&disk_to_dev(device->vdisk)->kobj, KOBJ_CHANGE); kobject_uevent(&disk_to_dev(device->vdisk)->kobj, KOBJ_CHANGE);
out: out:
mutex_unlock(device->state_mutex); mutex_unlock(device->state_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册