diff options
author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2010-10-05 14:13:58 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-10-14 12:38:44 -0400 |
commit | 004352fa60345e499379af310de73a2df1a5762a (patch) | |
tree | 6a5e0651d30b1c7e4c0964875e44b23aad7f8ea8 | |
parent | f10f262349762c96ab247b6108af3a30b52b6f5a (diff) |
drbd: Fix regression in recv_bm_rle_bits (compressed bitmap)
We used to be16_to_cpu the length field in our received packet header.
drbd commit 17c854fea474a5eb3cfa12e4fb019e46debbc4ec
drbd: receiving of big packets, for payloads between 64kByte and 4GByte
changed this, but forgot to adjust a few places where we relied on
h->length being in native byte order.
This broke the receiving side of the RLE compressed bitmap exchange.
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_receiver.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 9da32ac62c22..b5d3fa6c7a8b 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -970,9 +970,10 @@ static int drbd_recv_header(struct drbd_conf *mdev, enum drbd_packets *cmd, unsi | |||
970 | *cmd = be16_to_cpu(h->h95.command); | 970 | *cmd = be16_to_cpu(h->h95.command); |
971 | *packet_size = be32_to_cpu(h->h95.length); | 971 | *packet_size = be32_to_cpu(h->h95.length); |
972 | } else { | 972 | } else { |
973 | dev_err(DEV, "magic?? on data m: 0x%lx c: %d l: %d\n", | 973 | dev_err(DEV, "magic?? on data m: 0x%08x c: %d l: %d\n", |
974 | (long)be32_to_cpu(h->h80.magic), | 974 | be32_to_cpu(h->h80.magic), |
975 | h->h80.command, h->h80.length); | 975 | be16_to_cpu(h->h80.command), |
976 | be16_to_cpu(h->h80.length)); | ||
976 | return FALSE; | 977 | return FALSE; |
977 | } | 978 | } |
978 | mdev->last_received = jiffies; | 979 | mdev->last_received = jiffies; |
@@ -3421,7 +3422,7 @@ recv_bm_rle_bits(struct drbd_conf *mdev, | |||
3421 | u64 tmp; | 3422 | u64 tmp; |
3422 | unsigned long s = c->bit_offset; | 3423 | unsigned long s = c->bit_offset; |
3423 | unsigned long e; | 3424 | unsigned long e; |
3424 | int len = p->head.length - (sizeof(*p) - sizeof(p->head)); | 3425 | int len = be16_to_cpu(p->head.length) - (sizeof(*p) - sizeof(p->head)); |
3425 | int toggle = DCBP_get_start(p); | 3426 | int toggle = DCBP_get_start(p); |
3426 | int have; | 3427 | int have; |
3427 | int bits; | 3428 | int bits; |
@@ -3570,8 +3571,8 @@ static int receive_bitmap(struct drbd_conf *mdev, enum drbd_packets cmd, unsigne | |||
3570 | memcpy(p, h, sizeof(*h)); | 3571 | memcpy(p, h, sizeof(*h)); |
3571 | if (drbd_recv(mdev, p->head.payload, data_size) != data_size) | 3572 | if (drbd_recv(mdev, p->head.payload, data_size) != data_size) |
3572 | goto out; | 3573 | goto out; |
3573 | if (p->head.length <= (sizeof(*p) - sizeof(p->head))) { | 3574 | if (data_size <= (sizeof(*p) - sizeof(p->head))) { |
3574 | dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", p->head.length); | 3575 | dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", data_size); |
3575 | return FAILED; | 3576 | return FAILED; |
3576 | } | 3577 | } |
3577 | ret = decode_bitmap_c(mdev, p, &c); | 3578 | ret = decode_bitmap_c(mdev, p, &c); |
@@ -4582,17 +4583,19 @@ int drbd_asender(struct drbd_thread *thi) | |||
4582 | 4583 | ||
4583 | if (received == expect && cmd == NULL) { | 4584 | if (received == expect && cmd == NULL) { |
4584 | if (unlikely(h->magic != BE_DRBD_MAGIC)) { | 4585 | if (unlikely(h->magic != BE_DRBD_MAGIC)) { |
4585 | dev_err(DEV, "magic?? on meta m: 0x%lx c: %d l: %d\n", | 4586 | dev_err(DEV, "magic?? on meta m: 0x%08x c: %d l: %d\n", |
4586 | (long)be32_to_cpu(h->magic), | 4587 | be32_to_cpu(h->magic), |
4587 | h->command, h->length); | 4588 | be16_to_cpu(h->command), |
4589 | be16_to_cpu(h->length)); | ||
4588 | goto reconnect; | 4590 | goto reconnect; |
4589 | } | 4591 | } |
4590 | cmd = get_asender_cmd(be16_to_cpu(h->command)); | 4592 | cmd = get_asender_cmd(be16_to_cpu(h->command)); |
4591 | len = be16_to_cpu(h->length); | 4593 | len = be16_to_cpu(h->length); |
4592 | if (unlikely(cmd == NULL)) { | 4594 | if (unlikely(cmd == NULL)) { |
4593 | dev_err(DEV, "unknown command?? on meta m: 0x%lx c: %d l: %d\n", | 4595 | dev_err(DEV, "unknown command?? on meta m: 0x%08x c: %d l: %d\n", |
4594 | (long)be32_to_cpu(h->magic), | 4596 | be32_to_cpu(h->magic), |
4595 | h->command, h->length); | 4597 | be16_to_cpu(h->command), |
4598 | be16_to_cpu(h->length)); | ||
4596 | goto disconnect; | 4599 | goto disconnect; |
4597 | } | 4600 | } |
4598 | expect = cmd->pkt_size; | 4601 | expect = cmd->pkt_size; |