mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
04dfa13788
commit
596a37f9ef
|
@ -1932,7 +1932,7 @@ static inline int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock,
|
|||
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,
|
||||
|
@ -1945,13 +1945,13 @@ 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,
|
||||
|
|
|
@ -739,8 +739,8 @@ int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct socket *sock,
|
|||
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);
|
||||
|
@ -753,13 +753,13 @@ int conn_send_cmd(struct drbd_tconn *tconn, int vnr, int use_data_socket,
|
|||
/* 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,
|
||||
|
@ -1011,7 +1011,7 @@ int _conn_send_state_req(struct drbd_tconn *tconn, int vnr, enum drbd_packet cmd
|
|||
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)
|
||||
|
@ -1030,7 +1030,7 @@ int conn_send_sr_reply(struct drbd_tconn *tconn, 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,
|
||||
|
|
Loading…
Reference in New Issue