drbd: Allow to disconnect if one volume is diskless
authorPhilipp Reisner <philipp.reisner@linbit.com>
Mon, 28 Mar 2011 10:55:03 +0000 (12:55 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:44:58 +0000 (16:44 +0100)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_state.c
drivers/block/drbd/drbd_state.h

index 3243c7849914acd91ae466eb3922be12d716ee39..b9bcb8bf7ec26e006ae6cec1cd9f5c01101ec991 100644 (file)
@@ -3447,7 +3447,7 @@ static int receive_req_conn_state(struct drbd_tconn *tconn, struct packet_info *
        mask = convert_state(mask);
        val = convert_state(val);
 
-       rv = conn_request_state(tconn, mask, val, CS_VERBOSE | CS_LOCAL_ONLY);
+       rv = conn_request_state(tconn, mask, val, CS_VERBOSE | CS_LOCAL_ONLY | CS_IGN_OUTD_FAIL);
        conn_send_sr_reply(tconn, rv);
 
        return 0;
index 164a7f821c781f3a7d31bd6b6f8a43955344130e..ca77da38a0dcd3c1170c9f8e385aa53f88f280bb 100644 (file)
@@ -1433,6 +1433,9 @@ conn_is_valid_transition(struct drbd_tconn *tconn, union drbd_state mask, union
                os = mdev->state;
                ns = sanitize_state(mdev, apply_mask_val(os, mask, val), NULL);
 
+               if (flags & CS_IGN_OUTD_FAIL && ns.disk == D_OUTDATED && os.disk < D_OUTDATED)
+                       ns.disk = os.disk;
+
                if (ns.i == os.i)
                        continue;
 
@@ -1475,6 +1478,9 @@ conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state
                ns = apply_mask_val(os, mask, val);
                ns = sanitize_state(mdev, ns, NULL);
 
+               if (flags & CS_IGN_OUTD_FAIL && ns.disk == D_OUTDATED && os.disk < D_OUTDATED)
+                       ns.disk = os.disk;
+
                rv = __drbd_set_state(mdev, ns, flags, NULL);
                if (rv < SS_SUCCESS)
                        BUG();
index 11fd0f897bdb673e7015d0e7c4a3038c37169678..c0331f18371a1eac1cb360d38a1658923cf877d2 100644 (file)
@@ -69,6 +69,7 @@ enum chg_state_flags {
        CS_DC_DISK       = 1 << 8,
        CS_DC_PDSK       = 1 << 9,
        CS_DC_MASK       = CS_DC_ROLE + CS_DC_PEER + CS_DC_CONN + CS_DC_DISK + CS_DC_PDSK,
+       CS_IGN_OUTD_FAIL = 1 << 10,
 };
 
 extern enum drbd_state_rv drbd_change_state(struct drbd_conf *mdev,