drbd: _conn_send_cmd(): Return 0 upon success and an error code otherwise
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 018c336..ff0085b 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -723,17 +723,14 @@
enum drbd_packet cmd, struct p_header *h, size_t size,
unsigned msg_flags)
{
- int sent, ok;
+ int err;
_prepare_header(tconn, vnr, h, cmd, size - sizeof(struct p_header));
-
- sent = drbd_send(tconn, sock, h, size, msg_flags);
-
- ok = (sent == size);
- if (!ok && !signal_pending(current))
- conn_warn(tconn, "short sent %s size=%d sent=%d\n",
- cmdname(cmd), (int)size, sent);
- return ok;
+ err = drbd_send_all(tconn, sock, h, size, msg_flags);
+ if (err && !signal_pending(current))
+ conn_warn(tconn, "short send %s size=%d\n",
+ cmdname(cmd), (int)size);
+ return err;
}
/* don't pass the socket. we may only look at it
@@ -756,7 +753,7 @@
/* drbd_disconnect() could have called drbd_free_sock()
* while we were waiting in down()... */
if (likely(sock != NULL))
- ok = _conn_send_cmd(tconn, vnr, sock, cmd, h, size, 0);
+ ok = !_conn_send_cmd(tconn, vnr, sock, cmd, h, size, 0);
if (use_data_socket)
mutex_unlock(&tconn->data.mutex);