static inline int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket,
enum drbd_packet cmd, struct p_header *h, size_t size)
{
- return conn_send_cmd(mdev->tconn, mdev->vnr, use_data_socket, cmd, h, size);
+ return !conn_send_cmd(mdev->tconn, mdev->vnr, use_data_socket, cmd, h, size);
}
static inline int drbd_send_short_cmd(struct drbd_conf *mdev,
static inline int drbd_send_ping(struct drbd_tconn *tconn)
{
struct p_header h;
- return conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING, &h, sizeof(h));
+ return !conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING, &h, sizeof(h));
}
static inline int drbd_send_ping_ack(struct drbd_tconn *tconn)
{
struct p_header h;
- return conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h));
+ return !conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h));
}
static inline int drbd_send_state_req(struct drbd_conf *mdev,
int conn_send_cmd(struct drbd_tconn *tconn, int vnr, int use_data_socket,
enum drbd_packet cmd, struct p_header *h, size_t size)
{
- int ok = 0;
struct socket *sock;
+ int err = -EIO;
if (use_data_socket) {
mutex_lock(&tconn->data.mutex);
/* 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);
+ err = _conn_send_cmd(tconn, vnr, sock, cmd, h, size, 0);
if (use_data_socket)
mutex_unlock(&tconn->data.mutex);
else
mutex_unlock(&tconn->meta.mutex);
- return ok;
+ return err;
}
int conn_send_cmd2(struct drbd_tconn *tconn, enum drbd_packet cmd, char *data,
p.mask = cpu_to_be32(mask.i);
p.val = cpu_to_be32(val.i);
- return conn_send_cmd(tconn, vnr, USE_DATA_SOCKET, cmd, &p.head, sizeof(p));
+ return !conn_send_cmd(tconn, vnr, USE_DATA_SOCKET, cmd, &p.head, sizeof(p));
}
int drbd_send_sr_reply(struct drbd_conf *mdev, enum drbd_state_rv retcode)
p.retcode = cpu_to_be32(retcode);
- return conn_send_cmd(tconn, 0, USE_META_SOCKET, cmd, &p.head, sizeof(p));
+ return !conn_send_cmd(tconn, 0, USE_META_SOCKET, cmd, &p.head, sizeof(p));
}
int fill_bitmap_rle_bits(struct drbd_conf *mdev,