drbd: Fixed compat issue with disconnecting 8.4 from a primary 8.3
authorPhilipp Reisner <philipp.reisner@linbit.com>
Fri, 20 Jan 2012 12:52:27 +0000 (13:52 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:58:14 +0000 (16:58 +0100)
For compatibility reasons 8.4 has to send P_STATE_CHG_REQ (instead
of P_CONN_ST_CHG_REQ) when disconnecting.

In the receiving code path we missed to convert the old
answer (P_STATE_CHG_REPLY) back to 8.4 logic. Therefore
the CL_ST_CHG_SUCCESS or CL_ST_CHG_FAIL bit in the flags word
of mdev got set, while the state code was waiting for
the CONN_WD_ST_CHG_OKAY or CONN_WD_ST_CHG_FAIL bits in tconn.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_state.c

index 8001b7a2063be629c9845983fe89fbeb01c21ba3..e8461f8cb046b8f599df095c5794d80a7838837b 100644 (file)
@@ -811,6 +811,7 @@ enum {
        SEND_PING,              /* whether asender should send a ping asap */
        SIGNAL_ASENDER,         /* whether asender wants to be interrupted */
        GOT_PING_ACK,           /* set when we receive a ping_ack packet, ping_wait gets woken */
+       CONN_WD_ST_CHG_REQ,     /* A cluster wide state change on the connection is active */
        CONN_WD_ST_CHG_OKAY,
        CONN_WD_ST_CHG_FAIL,
        CONN_DRY_RUN,           /* Expect disconnect after resync handshake. */
index c8d3f38d539f9fa4ebe3b6c56efb52fffa2db526..9b83f88c0e82ddf1cbc8ff0e8a8a2da3a0a3815f 100644 (file)
@@ -4827,6 +4827,11 @@ static int got_RqSReply(struct drbd_tconn *tconn, struct packet_info *pi)
        if (!mdev)
                return -EIO;
 
+       if (test_bit(CONN_WD_ST_CHG_REQ, &tconn->flags)) {
+               D_ASSERT(tconn->agreed_pro_version < 100);
+               return got_conn_RqSReply(tconn, pi);
+       }
+
        if (retcode >= SS_SUCCESS) {
                set_bit(CL_ST_CHG_SUCCESS, &mdev->flags);
        } else {
index 70aa9603e3682da2bee6961f0ef0072b8fdcc75d..05ed131a5a878c2f75827ff767330f92df4e342d 100644 (file)
@@ -1671,7 +1671,9 @@ conn_cl_wide(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state v
        spin_unlock_irq(&tconn->req_lock);
        mutex_lock(&tconn->cstate_mutex);
 
+       set_bit(CONN_WD_ST_CHG_REQ, &tconn->flags);
        if (conn_send_state_req(tconn, mask, val)) {
+               clear_bit(CONN_WD_ST_CHG_REQ, &tconn->flags);
                rv = SS_CW_FAILED_BY_PEER;
                /* if (f & CS_VERBOSE)
                   print_st_err(mdev, os, ns, rv); */
@@ -1679,6 +1681,7 @@ conn_cl_wide(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state v
        }
 
        wait_event(tconn->ping_wait, (rv = _conn_rq_cond(tconn, mask, val)));
+       clear_bit(CONN_WD_ST_CHG_REQ, &tconn->flags);
 
 abort:
        mutex_unlock(&tconn->cstate_mutex);