diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-05-16 08:30:24 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:55:52 -0500 |
commit | dcb20d1a8e7d9602e52a9b673ae4d7f746d2cbb2 (patch) | |
tree | 34e9330fab46adf21f9ddf02b8cbea4b2050dbde | |
parent | c5482bbd9607bf38cbc952eacaa429e6ba3160a0 (diff) |
drbd: Refuse to change network options online when...
* 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>
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 22 | ||||
-rw-r--r-- | 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 74c27f1507f3..133a6724657d 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -1722,10 +1722,24 @@ _check_net_options(struct drbd_tconn *tconn, struct net_conf *old_conf, struct n | |||
1722 | struct drbd_conf *mdev; | 1722 | struct drbd_conf *mdev; |
1723 | int i; | 1723 | int i; |
1724 | 1724 | ||
1725 | if (old_conf && tconn->agreed_pro_version < 100 && | 1725 | if (old_conf && tconn->cstate == C_WF_REPORT_PARAMS && tconn->agreed_pro_version < 100) { |
1726 | tconn->cstate == C_WF_REPORT_PARAMS && | 1726 | if (new_conf->wire_protocol != old_conf->wire_protocol) |
1727 | new_conf->wire_protocol != old_conf->wire_protocol) | 1727 | return ERR_NEED_APV_100; |
1728 | return ERR_NEED_APV_100; | 1728 | |
1729 | if (new_conf->two_primaries != old_conf->two_primaries) | ||
1730 | return ERR_NEED_APV_100; | ||
1731 | |||
1732 | if (!new_conf->integrity_alg != !old_conf->integrity_alg) | ||
1733 | return ERR_NEED_APV_100; | ||
1734 | |||
1735 | if (strcmp(new_conf->integrity_alg, old_conf->integrity_alg)) | ||
1736 | return ERR_NEED_APV_100; | ||
1737 | } | ||
1738 | |||
1739 | if (!new_conf->two_primaries && | ||
1740 | conn_highest_role(tconn) == R_PRIMARY && | ||
1741 | conn_highest_peer(tconn) == R_PRIMARY) | ||
1742 | return ERR_NEED_ALLOW_TWO_PRI; | ||
1729 | 1743 | ||
1730 | if (new_conf->two_primaries && | 1744 | if (new_conf->two_primaries && |
1731 | (new_conf->wire_protocol != DRBD_PROT_C)) | 1745 | (new_conf->wire_protocol != DRBD_PROT_C)) |
diff --git a/include/linux/drbd.h b/include/linux/drbd.h index 05063e6db81f..679e81123229 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h | |||
@@ -161,6 +161,7 @@ enum drbd_ret_code { | |||
161 | ERR_MINOR_EXISTS = 161, | 161 | ERR_MINOR_EXISTS = 161, |
162 | ERR_INVALID_REQUEST = 162, | 162 | ERR_INVALID_REQUEST = 162, |
163 | ERR_NEED_APV_100 = 163, | 163 | ERR_NEED_APV_100 = 163, |
164 | ERR_NEED_ALLOW_TWO_PRI = 164, | ||
164 | 165 | ||
165 | /* insert new ones above this line */ | 166 | /* insert new ones above this line */ |
166 | AFTER_LAST_ERR_CODE | 167 | AFTER_LAST_ERR_CODE |