Commit 7b57b89d authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: drbd_send_block(): 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 9f69230c
...@@ -1608,7 +1608,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req) ...@@ -1608,7 +1608,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd, int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
struct drbd_peer_request *peer_req) struct drbd_peer_request *peer_req)
{ {
int ok; int err;
struct p_data p; struct p_data p;
void *dgb; void *dgb;
int dgs; int dgs;
...@@ -1627,21 +1627,22 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd, ...@@ -1627,21 +1627,22 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
* This one may be interrupted by DRBD_SIG and/or DRBD_SIGKILL * This one may be interrupted by DRBD_SIG and/or DRBD_SIGKILL
* in response to admin command or module unload. * in response to admin command or module unload.
*/ */
if (drbd_get_data_sock(mdev->tconn)) err = drbd_get_data_sock(mdev->tconn);
return 0; if (err)
return err;
ok = sizeof(p) == drbd_send(mdev->tconn, mdev->tconn->data.socket, &p, sizeof(p), dgs ? MSG_MORE : 0); err = drbd_send_all(mdev->tconn, mdev->tconn->data.socket, &p,
if (ok && dgs) { sizeof(p), dgs ? MSG_MORE : 0);
if (!err && dgs) {
dgb = mdev->tconn->int_dig_out; dgb = mdev->tconn->int_dig_out;
drbd_csum_ee(mdev, mdev->tconn->integrity_w_tfm, peer_req, dgb); drbd_csum_ee(mdev, mdev->tconn->integrity_w_tfm, peer_req, dgb);
ok = dgs == drbd_send(mdev->tconn, mdev->tconn->data.socket, dgb, dgs, 0); err = drbd_send_all(mdev->tconn, mdev->tconn->data.socket, dgb,
dgs, 0);
} }
if (ok) if (!err)
ok = !_drbd_send_zc_ee(mdev, peer_req); err = _drbd_send_zc_ee(mdev, peer_req);
drbd_put_data_sock(mdev->tconn); drbd_put_data_sock(mdev->tconn);
return ok; return err;
} }
int drbd_send_oos(struct drbd_conf *mdev, struct drbd_request *req) int drbd_send_oos(struct drbd_conf *mdev, struct drbd_request *req)
......
...@@ -920,7 +920,7 @@ int w_e_end_data_req(struct drbd_work *w, int cancel) ...@@ -920,7 +920,7 @@ int w_e_end_data_req(struct drbd_work *w, int cancel)
} }
if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
ok = drbd_send_block(mdev, P_DATA_REPLY, peer_req); ok = !drbd_send_block(mdev, P_DATA_REPLY, peer_req);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegDReply. sector=%llus.\n", dev_err(DEV, "Sending NegDReply. sector=%llus.\n",
...@@ -966,7 +966,7 @@ int w_e_end_rsdata_req(struct drbd_work *w, int cancel) ...@@ -966,7 +966,7 @@ int w_e_end_rsdata_req(struct drbd_work *w, int cancel)
} else if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { } else if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) {
if (likely(mdev->state.pdsk >= D_INCONSISTENT)) { if (likely(mdev->state.pdsk >= D_INCONSISTENT)) {
inc_rs_pending(mdev); inc_rs_pending(mdev);
ok = drbd_send_block(mdev, P_RS_DATA_REPLY, peer_req); ok = !drbd_send_block(mdev, P_RS_DATA_REPLY, peer_req);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Not sending RSDataReply, " dev_err(DEV, "Not sending RSDataReply, "
...@@ -1040,7 +1040,7 @@ int w_e_end_csum_rs_req(struct drbd_work *w, int cancel) ...@@ -1040,7 +1040,7 @@ int w_e_end_csum_rs_req(struct drbd_work *w, int cancel)
peer_req->block_id = ID_SYNCER; /* By setting block_id, digest pointer becomes invalid! */ peer_req->block_id = ID_SYNCER; /* By setting block_id, digest pointer becomes invalid! */
peer_req->flags &= ~EE_HAS_DIGEST; /* This peer request no longer has a digest pointer */ peer_req->flags &= ~EE_HAS_DIGEST; /* This peer request no longer has a digest pointer */
kfree(di); kfree(di);
ok = drbd_send_block(mdev, P_RS_DATA_REPLY, peer_req); ok = !drbd_send_block(mdev, P_RS_DATA_REPLY, peer_req);
} }
} else { } else {
ok = !drbd_send_ack(mdev, P_NEG_RS_DREPLY, peer_req); ok = !drbd_send_ack(mdev, P_NEG_RS_DREPLY, peer_req);
......
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