diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-03-15 18:55:59 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:44:31 -0500 |
commit | 596a37f9eff332fa034cd6bea0c0ee2e09c7d900 (patch) | |
tree | be63b26228ad9c95e40ae21ffbb78da0ecc5f768 | |
parent | 04dfa137881efc890544c5cd3af94e54cfe0c480 (diff) |
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>
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 6 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 0bd8c2a800c2..4efb5358a616 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -1932,7 +1932,7 @@ static inline int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, | |||
1932 | static inline int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, | 1932 | static inline int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket, |
1933 | enum drbd_packet cmd, struct p_header *h, size_t size) | 1933 | enum drbd_packet cmd, struct p_header *h, size_t size) |
1934 | { | 1934 | { |
1935 | return conn_send_cmd(mdev->tconn, mdev->vnr, use_data_socket, cmd, h, size); | 1935 | return !conn_send_cmd(mdev->tconn, mdev->vnr, use_data_socket, cmd, h, size); |
1936 | } | 1936 | } |
1937 | 1937 | ||
1938 | static inline int drbd_send_short_cmd(struct drbd_conf *mdev, | 1938 | 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, | |||
1945 | static inline int drbd_send_ping(struct drbd_tconn *tconn) | 1945 | static inline int drbd_send_ping(struct drbd_tconn *tconn) |
1946 | { | 1946 | { |
1947 | struct p_header h; | 1947 | struct p_header h; |
1948 | return conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING, &h, sizeof(h)); | 1948 | return !conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING, &h, sizeof(h)); |
1949 | } | 1949 | } |
1950 | 1950 | ||
1951 | static inline int drbd_send_ping_ack(struct drbd_tconn *tconn) | 1951 | static inline int drbd_send_ping_ack(struct drbd_tconn *tconn) |
1952 | { | 1952 | { |
1953 | struct p_header h; | 1953 | struct p_header h; |
1954 | return conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h)); | 1954 | return !conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h)); |
1955 | } | 1955 | } |
1956 | 1956 | ||
1957 | static inline int drbd_send_state_req(struct drbd_conf *mdev, | 1957 | static inline int drbd_send_state_req(struct drbd_conf *mdev, |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 2177915f04aa..1fcbaa178b4b 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -739,8 +739,8 @@ int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct socket *sock, | |||
739 | int conn_send_cmd(struct drbd_tconn *tconn, int vnr, int use_data_socket, | 739 | int conn_send_cmd(struct drbd_tconn *tconn, int vnr, int use_data_socket, |
740 | enum drbd_packet cmd, struct p_header *h, size_t size) | 740 | enum drbd_packet cmd, struct p_header *h, size_t size) |
741 | { | 741 | { |
742 | int ok = 0; | ||
743 | struct socket *sock; | 742 | struct socket *sock; |
743 | int err = -EIO; | ||
744 | 744 | ||
745 | if (use_data_socket) { | 745 | if (use_data_socket) { |
746 | mutex_lock(&tconn->data.mutex); | 746 | mutex_lock(&tconn->data.mutex); |
@@ -753,13 +753,13 @@ int conn_send_cmd(struct drbd_tconn *tconn, int vnr, int use_data_socket, | |||
753 | /* drbd_disconnect() could have called drbd_free_sock() | 753 | /* drbd_disconnect() could have called drbd_free_sock() |
754 | * while we were waiting in down()... */ | 754 | * while we were waiting in down()... */ |
755 | if (likely(sock != NULL)) | 755 | if (likely(sock != NULL)) |
756 | ok = !_conn_send_cmd(tconn, vnr, sock, cmd, h, size, 0); | 756 | err = _conn_send_cmd(tconn, vnr, sock, cmd, h, size, 0); |
757 | 757 | ||
758 | if (use_data_socket) | 758 | if (use_data_socket) |
759 | mutex_unlock(&tconn->data.mutex); | 759 | mutex_unlock(&tconn->data.mutex); |
760 | else | 760 | else |
761 | mutex_unlock(&tconn->meta.mutex); | 761 | mutex_unlock(&tconn->meta.mutex); |
762 | return ok; | 762 | return err; |
763 | } | 763 | } |
764 | 764 | ||
765 | int conn_send_cmd2(struct drbd_tconn *tconn, enum drbd_packet cmd, char *data, | 765 | 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 | |||
1011 | p.mask = cpu_to_be32(mask.i); | 1011 | p.mask = cpu_to_be32(mask.i); |
1012 | p.val = cpu_to_be32(val.i); | 1012 | p.val = cpu_to_be32(val.i); |
1013 | 1013 | ||
1014 | return conn_send_cmd(tconn, vnr, USE_DATA_SOCKET, cmd, &p.head, sizeof(p)); | 1014 | return !conn_send_cmd(tconn, vnr, USE_DATA_SOCKET, cmd, &p.head, sizeof(p)); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | int drbd_send_sr_reply(struct drbd_conf *mdev, enum drbd_state_rv retcode) | 1017 | 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) | |||
1030 | 1030 | ||
1031 | p.retcode = cpu_to_be32(retcode); | 1031 | p.retcode = cpu_to_be32(retcode); |
1032 | 1032 | ||
1033 | return conn_send_cmd(tconn, 0, USE_META_SOCKET, cmd, &p.head, sizeof(p)); | 1033 | return !conn_send_cmd(tconn, 0, USE_META_SOCKET, cmd, &p.head, sizeof(p)); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | int fill_bitmap_rle_bits(struct drbd_conf *mdev, | 1036 | int fill_bitmap_rle_bits(struct drbd_conf *mdev, |