aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-03-21 09:10:15 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 10:44:51 -0500
commit0916e0e308716387f16462f66b53c9128587fd0b (patch)
treee220018d0b28b983b21ff0ab8b4abd1912795f1c
parent0829f5edf37cb1731e97066288f520de85b7b5e5 (diff)
drbd: Always use the same protocol version for the same peer
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>
-rw-r--r--drivers/block/drbd/drbd_main.c2
-rw-r--r--drivers/block/drbd/drbd_receiver.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index f633c0bd52e4..a1deab6f1309 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -706,7 +706,7 @@ static void prepare_header95(struct p_header95 *h, enum drbd_packet cmd, int siz
706static void _prepare_header(struct drbd_tconn *tconn, int vnr, struct p_header *h, 706static void _prepare_header(struct drbd_tconn *tconn, int vnr, struct p_header *h,
707 enum drbd_packet cmd, int size) 707 enum drbd_packet cmd, int size)
708{ 708{
709 if (tconn->agreed_pro_version >= 100 || size > DRBD_MAX_SIZE_H80_PACKET) 709 if (tconn->agreed_pro_version >= 95)
710 prepare_header95(&h->h95, cmd, size); 710 prepare_header95(&h->h95, cmd, size);
711 else 711 else
712 prepare_header80(&h->h80, cmd, size); 712 prepare_header80(&h->h80, cmd, size);
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 6a3e628b68c6..27d4a4520641 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -819,9 +819,9 @@ static int drbd_connect(struct drbd_tconn *tconn)
819 return -2; 819 return -2;
820 820
821 clear_bit(DISCARD_CONCURRENT, &tconn->flags); 821 clear_bit(DISCARD_CONCURRENT, &tconn->flags);
822 tconn->agreed_pro_version = 99; 822
823 /* agreed_pro_version must be smaller than 100 so we send the old 823 /* Assume that the peer only understands protocol 80 until we know better. */
824 header (h80) in the first packet and in the handshake packet. */ 824 tconn->agreed_pro_version = 80;
825 825
826 sock = NULL; 826 sock = NULL;
827 msock = NULL; 827 msock = NULL;