drbd: Always use the same protocol version for the same peer
authorAndreas Gruenbacher <agruen@linbit.com>
Mon, 21 Mar 2011 13:10:15 +0000 (14:10 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:44:51 +0000 (16:44 +0100)
There is no need to send protocol 80 headers to peers that understand
protocol 95 headers.  Make sure that we don't send protocol 95 headers
until we have agreed upon a protocol version with our peer, though.

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

index f633c0bd52e418b0c25d670bcaba4c11ece3f6b1..a1deab6f1309f87cf586714a718f093f9ebdc407 100644 (file)
@@ -706,7 +706,7 @@ static void prepare_header95(struct p_header95 *h, enum drbd_packet cmd, int siz
 static void _prepare_header(struct drbd_tconn *tconn, int vnr, struct p_header *h,
                            enum drbd_packet cmd, int size)
 {
-       if (tconn->agreed_pro_version >= 100 || size > DRBD_MAX_SIZE_H80_PACKET)
+       if (tconn->agreed_pro_version >= 95)
                prepare_header95(&h->h95, cmd, size);
        else
                prepare_header80(&h->h80, cmd, size);
index 6a3e628b68c6fc3f9e7ac21ae081ffb4b97c0405..27d4a4520641fc1f526850815040e73a99ad5d9a 100644 (file)
@@ -819,9 +819,9 @@ static int drbd_connect(struct drbd_tconn *tconn)
                return -2;
 
        clear_bit(DISCARD_CONCURRENT, &tconn->flags);
-       tconn->agreed_pro_version = 99;
-       /* agreed_pro_version must be smaller than 100 so we send the old
-          header (h80) in the first packet and in the handshake packet. */
+
+       /* Assume that the peer only understands protocol 80 until we know better.  */
+       tconn->agreed_pro_version = 80;
 
        sock  = NULL;
        msock = NULL;