Commit 28284cef authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: recv_dless_read(): Return 0 upon success and an error code otherwise

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent fc5be839
...@@ -1426,7 +1426,7 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req, ...@@ -1426,7 +1426,7 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
dev_warn(DEV, dev_warn(DEV,
"short read receiving data reply digest: read %d expected %d\n", "short read receiving data reply digest: read %d expected %d\n",
rr, dgs); rr, dgs);
return 0; return rr < 0 ? rr : -EIO;
} }
} }
...@@ -1450,7 +1450,7 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req, ...@@ -1450,7 +1450,7 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
dev_warn(DEV, "short read receiving data reply: " dev_warn(DEV, "short read receiving data reply: "
"read %d expected %d\n", "read %d expected %d\n",
rr, expect); rr, expect);
return 0; return rr < 0 ? rr : -EIO;
} }
data_size -= rr; data_size -= rr;
} }
...@@ -1459,12 +1459,12 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req, ...@@ -1459,12 +1459,12 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
drbd_csum_bio(mdev, mdev->tconn->integrity_r_tfm, bio, dig_vv); drbd_csum_bio(mdev, mdev->tconn->integrity_r_tfm, bio, dig_vv);
if (memcmp(dig_in, dig_vv, dgs)) { if (memcmp(dig_in, dig_vv, dgs)) {
dev_err(DEV, "Digest integrity check FAILED. Broken NICs?\n"); dev_err(DEV, "Digest integrity check FAILED. Broken NICs?\n");
return 0; return -EINVAL;
} }
} }
D_ASSERT(data_size == 0); D_ASSERT(data_size == 0);
return 1; return 0;
} }
/* e_end_resync_block() is called via /* e_end_resync_block() is called via
...@@ -1565,7 +1565,7 @@ static int receive_DataReply(struct drbd_conf *mdev, enum drbd_packet cmd, ...@@ -1565,7 +1565,7 @@ static int receive_DataReply(struct drbd_conf *mdev, enum drbd_packet cmd,
/* hlist_del(&req->collision) is done in _req_may_be_done, to avoid /* hlist_del(&req->collision) is done in _req_may_be_done, to avoid
* special casing it there for the various failure cases. * special casing it there for the various failure cases.
* still no race with drbd_fail_pending_reads */ * still no race with drbd_fail_pending_reads */
ok = recv_dless_read(mdev, req, sector, data_size); ok = !recv_dless_read(mdev, req, sector, data_size);
if (ok) if (ok)
req_mod(req, DATA_RECEIVED); req_mod(req, DATA_RECEIVED);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment