diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-06-16 10:18:09 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-10-14 09:04:10 -0400 |
commit | 65d922c33ebd359db25d5846929b2eafc4238fcc (patch) | |
tree | f8393356094f3e9bb62521d50fbf300184851328 | |
parent | 481c6f503213ab14f69ce88fff7b1ece325522f2 (diff) |
drbd: Do not do a hard state change when establishing a connection [bugz 304]
Make sure the state engine can deny two primaries to connect
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_receiver.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 3a8131a26559..224c79ed16e9 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -3188,6 +3188,7 @@ static int receive_state(struct drbd_conf *mdev, struct p_header *h) | |||
3188 | enum drbd_conns nconn, oconn; | 3188 | enum drbd_conns nconn, oconn; |
3189 | union drbd_state ns, peer_state; | 3189 | union drbd_state ns, peer_state; |
3190 | enum drbd_disk_state real_peer_disk; | 3190 | enum drbd_disk_state real_peer_disk; |
3191 | enum chg_state_flags cs_flags; | ||
3191 | int rv; | 3192 | int rv; |
3192 | 3193 | ||
3193 | ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) | 3194 | ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) |
@@ -3265,6 +3266,7 @@ static int receive_state(struct drbd_conf *mdev, struct p_header *h) | |||
3265 | ns.peer_isp = (peer_state.aftr_isp | peer_state.user_isp); | 3266 | ns.peer_isp = (peer_state.aftr_isp | peer_state.user_isp); |
3266 | if ((nconn == C_CONNECTED || nconn == C_WF_BITMAP_S) && ns.disk == D_NEGOTIATING) | 3267 | if ((nconn == C_CONNECTED || nconn == C_WF_BITMAP_S) && ns.disk == D_NEGOTIATING) |
3267 | ns.disk = mdev->new_state_tmp.disk; | 3268 | ns.disk = mdev->new_state_tmp.disk; |
3269 | cs_flags = CS_VERBOSE + (oconn < C_CONNECTED && nconn >= C_CONNECTED ? 0 : CS_HARD); | ||
3268 | if (ns.pdsk == D_CONSISTENT && ns.susp && nconn == C_CONNECTED && oconn < C_CONNECTED && | 3270 | if (ns.pdsk == D_CONSISTENT && ns.susp && nconn == C_CONNECTED && oconn < C_CONNECTED && |
3269 | test_bit(NEW_CUR_UUID, &mdev->flags)) { | 3271 | test_bit(NEW_CUR_UUID, &mdev->flags)) { |
3270 | /* Do not allow tl_restart(resend) for a rebooted peer. We can only allow this | 3272 | /* Do not allow tl_restart(resend) for a rebooted peer. We can only allow this |
@@ -3277,7 +3279,7 @@ static int receive_state(struct drbd_conf *mdev, struct p_header *h) | |||
3277 | drbd_force_state(mdev, NS2(conn, C_PROTOCOL_ERROR, susp, 0)); | 3279 | drbd_force_state(mdev, NS2(conn, C_PROTOCOL_ERROR, susp, 0)); |
3278 | return FALSE; | 3280 | return FALSE; |
3279 | } | 3281 | } |
3280 | rv = _drbd_set_state(mdev, ns, CS_VERBOSE | CS_HARD, NULL); | 3282 | rv = _drbd_set_state(mdev, ns, cs_flags, NULL); |
3281 | ns = mdev->state; | 3283 | ns = mdev->state; |
3282 | spin_unlock_irq(&mdev->req_lock); | 3284 | spin_unlock_irq(&mdev->req_lock); |
3283 | 3285 | ||