Skip to content

Commit

Permalink
drbd: Always use the same protocol version for the same peer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andreas Gruenbacher authored and Philipp Reisner committed Nov 8, 2012
1 parent 0829f5e commit 0916e0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0916e0e

Please sign in to comment.