mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: drbd-dev@lists.linbit.com
Subject: [PATCH 13/18] drbd: move set_disk_ro() to after we persisted the new role
Date: Mon, 30 Jun 2014 17:53:02 +0200	[thread overview]
Message-ID: <1404143587-24344-14-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1404143587-24344-1-git-send-email-philipp.reisner@linbit.com>

From: Lars Ellenberg <lars.ellenberg@linbit.com>

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: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
 drivers/block/drbd/drbd_nl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 23670d8..ceebd31 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -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? */
 
 	if (new_role == R_SECONDARY) {
-		set_disk_ro(device->vdisk, true);
 		if (get_ldev(device)) {
 			device->ldev->md.uuid[UI_CURRENT] &= ~(u64)1;
 			put_ldev(device);
@@ -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 */
 		mutex_unlock(&device->resource->conf_update);
 
-		set_disk_ro(device->vdisk, false);
 		if (get_ldev(device)) {
 			if (((device->state.conn < C_CONNECTED ||
 			       device->state.pdsk <= D_FAILED)
@@ -690,7 +688,7 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for
 	}
 
 	drbd_md_sync(device);
-
+	set_disk_ro(device->vdisk, new_role == R_SECONDARY);
 	kobject_uevent(&disk_to_dev(device->vdisk)->kobj, KOBJ_CHANGE);
 out:
 	mutex_unlock(device->state_mutex);
-- 
1.9.1


  parent reply	other threads:[~2014-06-30 15:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 15:52 [PATCH 00/18] RFC DRBD fixes Philipp Reisner
2014-06-30 15:52 ` [PATCH 01/18] drbd: Move write_ordering from connection to resource Philipp Reisner
2014-06-30 15:52 ` [PATCH 02/18] drbd: device->ldev is not guaranteed on an D_ATTACHING disk Philipp Reisner
2014-06-30 15:52 ` [PATCH 03/18] drbd: rename drbd_free_bc() to drbd_free_ldev() Philipp Reisner
2014-06-30 15:52 ` [PATCH 04/18] drbd: reduce number of spinlock drop/re-aquire cycles Philipp Reisner
2014-06-30 15:52 ` [PATCH 05/18] drbd: refactor use of first_peer_device() Philipp Reisner
2014-06-30 15:52 ` [PATCH 06/18] drbd: allow write-ordering policy to be bumped up again Philipp Reisner
2014-06-30 15:52 ` [PATCH 07/18] drbd: get rid of atomic update on disk bitmap works Philipp Reisner
2014-06-30 15:52 ` [PATCH 08/18] drbd: fix a race stopping the worker thread Philipp Reisner
2014-06-30 15:52 ` [PATCH 09/18] drbd: fix resync finished detection Philipp Reisner
2014-06-30 15:52 ` [PATCH 10/18] drbd: stop the meta data sync timer before open coded meta data sync Philipp Reisner
2014-06-30 15:53 ` [PATCH 11/18] drbd: re-add lost conf_mutex protection in drbd_set_role Philipp Reisner
2014-06-30 15:53 ` [PATCH 12/18] drbd: trigger tcp_push_pending_frames() for PING and PING_ACK Philipp Reisner
2014-06-30 15:53 ` Philipp Reisner [this message]
2014-06-30 15:53 ` [PATCH 14/18] drbd: explicitly submit meta data requests with REQ_NOIDLE Philipp Reisner
2014-06-30 15:53 ` [PATCH 15/18] drbd: close race when detaching from disk Philipp Reisner
2014-06-30 15:53 ` [PATCH 16/18] drbd: make sure disk cleanup happens in worker context Philipp Reisner
2014-06-30 15:53 ` [PATCH 17/18] drbd: use drbd_device_post_work() in more places Philipp Reisner
2014-06-30 15:53 ` [PATCH 18/18] drbd: get rid of drbd_queue_work_front Philipp Reisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404143587-24344-14-git-send-email-philipp.reisner@linbit.com \
    --to=philipp.reisner@linbit.com \
    --cc=axboe@kernel.dk \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®