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 01/13] drbd: Refuse to change network options online when...
Date: Mon, 10 Oct 2011 13:54:54 +0200	[thread overview]
Message-ID: <1318247706-7732-2-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1318247706-7732-1-git-send-email-philipp.reisner@linbit.com>

* the peer does not speak protocol_version 100 and the
  user wants to change one of:
    - wire_protocol
    - two_primaries
    - integrity_alg

* the user wants to remove the allow_two_primaries flag
  when there are two primaries

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
 drivers/block/drbd/drbd_nl.c |   22 ++++++++++++++++++----
 include/linux/drbd.h         |    1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 972178b..87fd3bf 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1771,10 +1771,24 @@ _check_net_options(struct drbd_tconn *tconn, struct net_conf *old_conf, struct n
 	struct drbd_conf *mdev;
 	int i;
 
-	if (old_conf && tconn->agreed_pro_version < 100 &&
-	    tconn->cstate == C_WF_REPORT_PARAMS &&
-	    new_conf->wire_protocol != old_conf->wire_protocol)
-		return ERR_NEED_APV_100;
+	if (old_conf && tconn->cstate == C_WF_REPORT_PARAMS && tconn->agreed_pro_version < 100) {
+		if (new_conf->wire_protocol != old_conf->wire_protocol)
+			return ERR_NEED_APV_100;
+
+		if (new_conf->two_primaries != old_conf->two_primaries)
+			return ERR_NEED_APV_100;
+
+		if (!new_conf->integrity_alg != !old_conf->integrity_alg)
+			return ERR_NEED_APV_100;
+
+		if (strcmp(new_conf->integrity_alg, old_conf->integrity_alg))
+			return ERR_NEED_APV_100;
+	}
+
+	if (!new_conf->two_primaries &&
+	    conn_highest_role(tconn) == R_PRIMARY &&
+	    conn_highest_peer(tconn) == R_PRIMARY)
+		return ERR_NEED_ALLOW_TWO_PRI;
 
 	if (new_conf->two_primaries &&
 	    (new_conf->wire_protocol != DRBD_PROT_C))
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 05063e6..679e811 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -161,6 +161,7 @@ enum drbd_ret_code {
 	ERR_MINOR_EXISTS	= 161,
 	ERR_INVALID_REQUEST	= 162,
 	ERR_NEED_APV_100	= 163,
+	ERR_NEED_ALLOW_TWO_PRI  = 164,
 
 	/* insert new ones above this line */
 	AFTER_LAST_ERR_CODE
-- 
1.7.4.1


  reply	other threads:[~2011-10-10 11:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
2011-10-10 11:54 ` Philipp Reisner [this message]
2011-10-10 11:54 ` [PATCH 02/13] drbd: protect updates to integrits_tfm by tconn->data->mutex Philipp Reisner
2011-10-10 11:54 ` [PATCH 03/13] drbd: Made cmp_after_sb() more generic into convert_after_sb() Philipp Reisner
2011-10-10 11:54 ` [PATCH 04/13] drbd: Allocation of int_dig_in and int_dig_vv was missing Philipp Reisner
2011-10-10 11:54 ` [PATCH 05/13] drbd: Receiving part for the PROTOCOL_UPDATE packet Philipp Reisner
2011-10-10 11:54 ` [PATCH 06/13] drbd: Send PROTOCOL_UPDATE packets when appropriate Philipp Reisner
2011-10-10 11:55 ` [PATCH 07/13] drbd: Use more generic constant names Philipp Reisner
2011-10-10 11:55 ` [PATCH 08/13] drbd: Output signed / unsigned netlink fields correctly Philipp Reisner
2011-10-10 11:55 ` [PATCH 09/13] drbd: Remove unused GENLA_F_MAY_IGNORE flag Philipp Reisner
2011-10-10 11:55 ` [PATCH 10/13] drbd: Make drbd's use of netlink attribute flags less confusing Philipp Reisner
2011-10-10 11:55 ` [PATCH 11/13] drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first Philipp Reisner
2011-10-10 11:55 ` [PATCH 12/13] drbd: drbd_adm_prepare(): Pass through error codes Philipp Reisner
2011-10-10 11:55 ` [PATCH 13/13] drbd: Don't use empty nested netlink attributes 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=1318247706-7732-2-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

Powered by JetHome