drbd: Make sure that drbd_send() has sent the right number of bytes
authorAndreas Gruenbacher <agruen@linbit.com>
Thu, 9 Dec 2010 15:08:46 +0000 (16:08 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:36:08 +0000 (11:36 +0100)
Reviewed-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
drivers/block/drbd/drbd_main.c

index 150ed16d26efa7e3cc76de0a5b8ff8150a61fcde..50b6841d135b3a30b32f52786d64d08ef05bb15c 100644 (file)
@@ -2580,7 +2580,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
        if (ok && dgs) {
                dgb = mdev->int_dig_out;
                drbd_csum_bio(mdev, mdev->integrity_w_tfm, req->master_bio, dgb);
-               ok = drbd_send(mdev, mdev->data.socket, dgb, dgs, 0);
+               ok = dgs == drbd_send(mdev, mdev->data.socket, dgb, dgs, 0);
        }
        if (ok) {
                /* For protocol A, we have to memcpy the payload into
@@ -2662,7 +2662,7 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packets cmd,
        if (ok && dgs) {
                dgb = mdev->int_dig_out;
                drbd_csum_ee(mdev, mdev->integrity_w_tfm, e, dgb);
-               ok = drbd_send(mdev, mdev->data.socket, dgb, dgs, 0);
+               ok = dgs == drbd_send(mdev, mdev->data.socket, dgb, dgs, 0);
        }
        if (ok)
                ok = _drbd_send_zc_ee(mdev, e);