summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2017-09-05 13:30:53 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-09-06 02:31:29 +0000
commite50fc8f4e7eb51386f47bea9e6ca8d8490c09003 (patch)
tree32bb1c642c183f3d5f37d9020cc24733a5ae624e /cli/src
parent91430817ce5bcbeabf057e9c978485728a85fb2b (diff)
features/shard: Increment counts in locks
Problem: Because create_count/eexist_count are incremented without locks, all the shards may not be created because call_count will be lesser than what it needs to be. This can lead to crash in shard_common_inode_write_do() because inode on which we want to do fd_anonymous() is NULL Fix: Increment the counts in frame->lock Change-Id: Ibc87dcb1021e9f4ac2929f662da07aa7662ab0d6 BUG: 1488354 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: https://review.gluster.org/18203 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'cli/src')
0 files changed, 0 insertions, 0 deletions
ort/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c
index ae5c5d3562e..3a8ce9d4350 100644
--- a/rpc/rpc-transport/rdma/src/name.c
+++ b/rpc/rpc-transport/rdma/src/name.c
@@ -37,14 +37,14 @@
#include "rdma.h"
int32_t
-gf_resolve_ip6 (const char *hostname,
- uint16_t port,
- int family,
- void **dnscache,
+gf_resolve_ip6 (const char *hostname,
+ uint16_t port,
+ int family,
+ void **dnscache,
struct addrinfo **addr_info);
static int32_t
-af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
+af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
socklen_t sockaddr_len, int ceiling)
{
int32_t ret = -1;
@@ -80,16 +80,16 @@ af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
}
static int32_t
-af_unix_client_bind (rpc_transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t sockaddr_len,
+af_unix_client_bind (rpc_transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t sockaddr_len,
int sock)
{
data_t *path_data = NULL;
struct sockaddr_un *addr = NULL;
int32_t ret = -1;
- path_data = dict_get (this->options,
+ path_data = dict_get (this->options,
"transport.rdma.bind-path");
if (path_data) {
char *path = data_to_str (path_data);
@@ -106,7 +106,7 @@ af_unix_client_bind (rpc_transport_t *this,
ret = bind (sock, (struct sockaddr *)addr, sockaddr_len);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
- "cannot bind to unix-domain socket %d (%s)",
+ "cannot bind to unix-domain socket %d (%s)",
sock, strerror (errno));
goto err;
}
@@ -121,24 +121,24 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
{
data_t *address_family_data = NULL;
- address_family_data = dict_get (this->options,
+ address_family_data = dict_get (this->options,
"transport.address-family");
if (!address_family_data) {
data_t *remote_host_data = NULL, *connect_path_data = NULL;
remote_host_data = dict_get (this->options, "remote-host");
- connect_path_data = dict_get (this->options,
+ connect_path_data = dict_get (this->options,
"transport.rdma.connect-path");
- if (!(remote_host_data || connect_path_data) ||
+ if (!(remote_host_data || connect_path_data) ||
(remote_host_data && connect_path_data)) {
gf_log (this->name, GF_LOG_ERROR,
"address-family not specified and not able to "
"determine the same from other options "
- "(remote-host:%s and connect-path:%s)",
- data_to_str (remote_host_data),
+ "(remote-host:%s and connect-path:%s)",
+ data_to_str (remote_host_data),
data_to_str (connect_path_data));
return -1;
- }
+ }
if (remote_host_data) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -167,7 +167,7 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
sockaddr->sa_family = AF_UNSPEC;
} else {
gf_log (this->name, GF_LOG_ERROR,
- "unknown address-family (%s) specified",
+ "unknown address-family (%s) specified",
address_family);
return -1;
}
@@ -177,8 +177,8 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
}
static int32_t
-af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
- struct sockaddr *sockaddr,
+af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
+ struct sockaddr *sockaddr,
socklen_t *sockaddr_len,
int16_t remote_port)
{
@@ -193,7 +193,7 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
if (remote_host_data == NULL)
{
gf_log (this->name, GF_LOG_ERROR,
- "option remote-host missing in volume %s",
+ "option remote-host missing in volume %s",
this->name);
ret = -1;
goto err;
@@ -203,7 +203,7 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
if (remote_host == NULL)
{
gf_log (this->name, GF_LOG_ERROR,
- "option remote-host has data NULL in volume %s",
+ "option remote-host has data NULL in volume %s",
this->name);
ret = -1;
goto err;
@@ -238,7 +238,7 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
/* TODO: gf_resolve is a blocking call. kick in some
non blocking dns techniques */
ret = gf_resolve_ip6 (remote_host, remote_port,
- sockaddr->sa_family,
+ sockaddr->sa_family,
&this->dnscache, &addr_info);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
@@ -254,8 +254,8 @@ err:
}
static int32_t
-af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
- struct sockaddr *sockaddr,
+af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
+ struct sockaddr *sockaddr,
socklen_t *sockaddr_len)
{
struct sockaddr_un *sockaddr_un = NULL;
@@ -263,7 +263,7 @@ af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
data_t *connect_path_data = NULL;
int32_t ret = 0;
- connect_path_data = dict_get (this->options,
+ connect_path_data = dict_get (this->options,
"transport.rdma.connect-path");
if (!connect_path_data) {
gf_log (this->name, GF_LOG_ERROR,
@@ -311,7 +311,7 @@ af_unix_server_get_local_sockaddr (rpc_transport_t *this,
struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr;
- listen_path_data = dict_get (this->options,
+ listen_path_data = dict_get (this->options,
"transport.rdma.listen-path");
if (!listen_path_data) {
gf_log (this->name, GF_LOG_ERROR,
@@ -342,9 +342,9 @@ err:
return ret;
}
-static int32_t
-af_inet_server_get_local_sockaddr (rpc_transport_t *this,
- struct sockaddr *addr,
+static int32_t
+af_inet_server_get_local_sockaddr (rpc_transport_t *this,
+ struct sockaddr *addr,
socklen_t *addr_len)
{
struct addrinfo hints, *res = 0;
@@ -364,20 +364,20 @@ af_inet_server_get_local_sockaddr (rpc_transport_t *this,
{
listen_port = data_to_uint16 (listen_port_data);
} else {
- if (addr->sa_family == AF_INET6) {
- struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr;
- in->sin6_addr = in6addr_any;
- in->sin6_port = htons(listen_port);
- *addr_len = sizeof(struct sockaddr_in6);
+ if (addr->sa_family == AF_INET6) {
+ struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr;
+ in->sin6_addr = in6addr_any;
+ in->sin6_port = htons(listen_port);
+ *addr_len = sizeof(struct sockaddr_in6);
goto out;
- } else if (addr->sa_family == AF_INET) {
- struct sockaddr_in *in = (struct sockaddr_in *) addr;
- in->sin_addr.s_addr = htonl(INADDR_ANY);
- in->sin_port = htons(listen_port);
- *addr_len = sizeof(struct sockaddr_in);
+ } else if (addr->sa_family == AF_INET) {
+ struct sockaddr_in *in = (struct sockaddr_in *) addr;
+ in->sin_addr.s_addr = htonl(INADDR_ANY);
+ in->sin_port = htons(listen_port);
+ *addr_len = sizeof(struct sockaddr_in);
goto out;
- }
- }
+ }
+ }
if (listen_port == (uint16_t) -1)
listen_port = GF_DEFAULT_RDMA_LISTEN_PORT;
@@ -400,7 +400,7 @@ af_inet_server_get_local_sockaddr (rpc_transport_t *this,
if (ret != 0) {
gf_log (this->name,
GF_LOG_ERROR,
- "getaddrinfo failed for host %s, service %s (%s)",
+ "getaddrinfo failed for host %s, service %s (%s)",
listen_host, service, gai_strerror (ret));
ret = -1;
goto out;
@@ -417,9 +417,9 @@ out:
int32_t
gf_rdma_client_bind (rpc_transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
- int sock)
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ int sock)
{
int ret = 0;
@@ -431,13 +431,13 @@ gf_rdma_client_bind (rpc_transport_t *this,
*sockaddr_len = sizeof (struct sockaddr_in);
case AF_INET6:
- ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr,
- *sockaddr_len,
+ ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr,
+ *sockaddr_len,
CLIENT_PORT_CEILING);
if (ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
"cannot bind inet socket (%d) to port "
- "less than %d (%s)",
+ "less than %d (%s)",
sock, CLIENT_PORT_CEILING, strerror (errno));
ret = 0;
}
@@ -445,7 +445,7 @@ gf_rdma_client_bind (rpc_transport_t *this,
case AF_UNIX:
*sockaddr_len = sizeof (struct sockaddr_un);
- ret = af_unix_client_bind (this, (struct sockaddr *)sockaddr,
+ ret = af_unix_client_bind (this, (struct sockaddr *)sockaddr,
*sockaddr_len, sock);
break;
@@ -473,7 +473,7 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
ret = -1;
goto err;
}
-
+
switch (sockaddr->sa_family)
{
case AF_INET_SDP:
@@ -483,7 +483,7 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
case AF_INET:
case AF_INET6:
case AF_UNSPEC:
- ret = af_inet_client_get_remote_sockaddr (this,
+ ret = af_inet_client_get_remote_sockaddr (this,
sockaddr,
sockaddr_len,
remote_port);
@@ -495,8 +495,8 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
break;
case AF_UNIX:
- ret = af_unix_client_get_remote_sockaddr (this,
- sockaddr,
+ ret = af_unix_client_get_remote_sockaddr (this,
+ sockaddr,
sockaddr_len);
break;
@@ -505,21 +505,21 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
"unknown address-family %d", sockaddr->sa_family);
ret = -1;
}
-
+
err:
return ret;
}
int32_t
gf_rdma_server_get_local_sockaddr (rpc_transport_t *this,
- struct sockaddr *addr,
- socklen_t *addr_len)
+ struct sockaddr *addr,
+ socklen_t *addr_len)
{
data_t *address_family_data = NULL;
int32_t ret = 0;
char is_inet_sdp = 0;
- address_family_data = dict_get (this->options,
+ address_family_data = dict_get (this->options,
"transport.address-family");
if (address_family_data) {
char *address_family = NULL;
@@ -538,7 +538,7 @@ gf_rdma_server_get_local_sockaddr (rpc_transport_t *this,
addr->sa_family = AF_UNSPEC;
} else {
gf_log (this->name, GF_LOG_ERROR,
- "unknown address family (%s) specified",
+ "unknown address family (%s) specified",
address_family);
ret = -1;
goto err;
@@ -574,8 +574,8 @@ err:
return ret;
}
-int32_t
-fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *addr,
+int32_t
+fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *addr,
int32_t addr_len, char *identifier)
{
int32_t ret = 0, tmpaddr_len = 0;
@@ -589,45 +589,45 @@ fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *add
if (((struct sockaddr *) &tmpaddr)->sa_family == AF_INET6) {
int32_t one_to_four, four_to_eight, twelve_to_sixteen;
int16_t eight_to_ten, ten_to_twelve;
-
+
one_to_four = four_to_eight = twelve_to_sixteen = 0;
eight_to_ten = ten_to_twelve = 0;
-
- one_to_four = ((struct sockaddr_in6 *)
+
+ one_to_four = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr32[0];
- four_to_eight = ((struct sockaddr_in6 *)
+ four_to_eight = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr32[1];
#ifdef GF_SOLARIS_HOST_OS
- eight_to_ten = S6_ADDR16(((struct sockaddr_in6 *)
+ eight_to_ten = S6_ADDR16(((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr)[4];
#else
- eight_to_ten = ((struct sockaddr_in6 *)
+ eight_to_ten = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr16[4];
#endif
#ifdef GF_SOLARIS_HOST_OS
- ten_to_twelve = S6_ADDR16(((struct sockaddr_in6 *)
+ ten_to_twelve = S6_ADDR16(((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr)[5];
#else
- ten_to_twelve = ((struct sockaddr_in6 *)
+ ten_to_twelve = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr16[5];
#endif
- twelve_to_sixteen = ((struct sockaddr_in6 *)
+ twelve_to_sixteen = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr32[3];
/* ipv4 mapped ipv6 address has
bits 0-80: 0
bits 80-96: 0xffff
- bits 96-128: ipv4 address
+ bits 96-128: ipv4 address
*/
-
+
if (one_to_four == 0 &&
four_to_eight == 0 &&
eight_to_ten == 0 &&
ten_to_twelve == -1) {
struct sockaddr_in *in_ptr = (struct sockaddr_in *)&tmpaddr;
memset (&tmpaddr, 0, sizeof (tmpaddr));
-
+
in_ptr->sin_family = AF_INET;
in_ptr->sin_port = ((struct sockaddr_in6 *)addr)->sin6_port;
in_ptr->sin_addr.s_addr = twelve_to_sixteen;
@@ -666,8 +666,8 @@ gf_rdma_get_transport_identifiers (rpc_transport_t *this)
case AF_INET:
case AF_INET6:
{
- ret = fill_inet6_inet_identifiers (this,
- &this->myinfo.sockaddr,
+ ret = fill_inet6_inet_identifiers (this,
+ &this->myinfo.sockaddr,
this->myinfo.sockaddr_len,
this->myinfo.identifier);
if (ret == -1) {
@@ -705,7 +705,7 @@ gf_rdma_get_transport_identifiers (rpc_transport_t *this)
break;
default:
- gf_log (this->name, GF_LOG_ERROR,
+ gf_log (this->name, GF_LOG_ERROR,
"unknown address family (%d)",
((struct sockaddr *) &this->myinfo.sockaddr)->sa_family);
ret = -1;
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 633f57db5b3..81e6e3cf632 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -44,13 +44,13 @@ int
rdma_post_unref (rdma_post_t *post);
int32_t
-gf_resolve_ip6 (const char *hostname,
- uint16_t port,
- int family,
- void **dnscache,
+gf_resolve_ip6 (const char *hostname,
+ uint16_t port,
+ int family,
+ void **dnscache,
struct addrinfo **addr_info);
-static uint16_t
+static uint16_t
rdma_get_local_lid (struct ibv_context *context,
int32_t port)
{
@@ -65,14 +65,14 @@ rdma_get_local_lid (struct ibv_context *context,
static const char *
get_port_state_str(enum ibv_port_state pstate)
{
- switch (pstate) {
- case IBV_PORT_DOWN: return "PORT_DOWN";
- case IBV_PORT_INIT: return "PORT_INIT";
- case IBV_PORT_ARMED: return "PORT_ARMED";
- case IBV_PORT_ACTIVE: return "PORT_ACTIVE";
- case IBV_PORT_ACTIVE_DEFER: return "PORT_ACTIVE_DEFER";
- default: return "invalid state";
- }
+ switch (pstate) {
+ case IBV_PORT_DOWN: return "PORT_DOWN";
+ case IBV_PORT_INIT: return "PORT_INIT";
+ case IBV_PORT_ARMED: return "PORT_ARMED";
+ case IBV_PORT_ACTIVE: return "PORT_ACTIVE";
+ case IBV_PORT_ACTIVE_DEFER: return "PORT_ACTIVE_DEFER";
+ default: return "invalid state";
+ }
}
static int32_t
@@ -84,10 +84,10 @@ ib_check_active_port (struct ibv_context *ctx, uint8_t port)
const char *state_str = NULL;
if (!ctx) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"Error in supplied context");
return -1;
- }
+ }
ret = ibv_query_port (ctx, port, &port_attr);
@@ -105,29 +105,29 @@ ib_check_active_port (struct ibv_context *ctx, uint8_t port)
if (port_attr.state == IBV_PORT_ACTIVE)
return 0;
- return -1;
+ return -1;
}
static int32_t
ib_get_active_port (struct ibv_context *ib_ctx)
{
- struct ibv_device_attr ib_device_attr;
+ struct ibv_device_attr ib_device_attr;
- int32_t ret = -1;
- uint8_t ib_port = 0;
+ int32_t ret = -1;
+ uint8_t ib_port = 0;
- if (!ib_ctx) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ if (!ib_ctx) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"Error in supplied context");
- return -1;
- }
- if (ibv_query_device (ib_ctx, &ib_device_attr)) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ return -1;
+ }
+ if (ibv_query_device (ib_ctx, &ib_device_attr)) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"Failed to query device properties");
- return -1;
- }
+ return -1;
+ }
- for (ib_port = 1; ib_port <= ib_device_attr.phys_port_cnt; ++ib_port) {
+ for (ib_port = 1; ib_port <= ib_device_attr.phys_port_cnt; ++ib_port) {
ret = ib_check_active_port (ib_ctx, ib_port);
if (ret == 0)
return ib_port;
@@ -135,8 +135,8 @@ ib_get_active_port (struct ibv_context *ib_ctx)
gf_log (RDMA_LOG_NAME, GF_LOG_TRACE,
"Port:(%u) not active", ib_port);
continue;
- }
- return ret;
+ }
+ return ret;
}
@@ -228,7 +228,7 @@ rdma_get_post (rdma_queue_t *queue)
post = queue->passive_posts.next;
if (post == &queue->passive_posts)
post = NULL;
-
+
if (post) {
if (post->prev)
post->prev->next = post->next;
@@ -286,7 +286,7 @@ __rdma_quota_get (rdma_peer_t *peer)
}
*/
-static void
+static void
__rdma_ioq_entry_free (rdma_ioq_t *entry)
{
list_del_init (&entry->list);
@@ -333,7 +333,7 @@ __rdma_disconnect (rpc_transport_t *this)
priv->tcp_connected = 0;
}
}
-
+
return ret;
}
@@ -368,7 +368,7 @@ __rdma_encode_error(rdma_peer_t *peer, rdma_reply_info_t *reply_info,
struct iovec *rpchdr, uint32_t *ptr,
rdma_errcode_t err)
{
- uint32_t *startp = NULL;
+ uint32_t *startp = NULL;
struct rpc_msg *rpc_msg = NULL;
startp = ptr;
@@ -382,16 +382,16 @@ __rdma_encode_error(rdma_peer_t *peer, rdma_reply_info_t *reply_info,
*ptr++ = rpc_msg->rm_xid;
}
- *ptr++ = hton32(RDMA_VERSION);
- *ptr++ = hton32(peer->send_count);
- *ptr++ = hton32(RDMA_ERROR);
- *ptr++ = hton32(err);
- if (err == ERR_VERS) {
- *ptr++ = hton32(RDMA_VERSION);
- *ptr++ = hton32(RDMA_VERSION);
- }
+ *ptr++ = hton32(RDMA_VERSION);
+ *ptr++ = hton32(peer->send_count);
+ *ptr++ = hton32(RDMA_ERROR);
+ *ptr++ = hton32(err);
+ if (err == ERR_VERS) {
+ *ptr++ = hton32(RDMA_VERSION);
+ *ptr++ = hton32(RDMA_VERSION);
+ }
- return (int)((unsigned long)ptr - (unsigned long)startp);
+ return (int)((unsigned long)ptr - (unsigned long)startp);
}
@@ -438,7 +438,7 @@ __rdma_create_read_chunks_from_vector (rdma_peer_t *peer,
rdma_private_t *priv = NULL;
rdma_device_t *device = NULL;
struct ibv_mr *mr = NULL;
- rdma_read_chunk_t *readch = NULL;
+ rdma_read_chunk_t *readch = NULL;
int32_t ret = -1;
if ((peer == NULL) || (readch_ptr == NULL) || (*readch_ptr == NULL)
@@ -576,7 +576,7 @@ __rdma_create_write_chunks_from_vector (rdma_peer_t *peer,
rdma_private_t *priv = NULL;
rdma_device_t *device = NULL;
struct ibv_mr *mr = NULL;
- rdma_write_chunk_t *writech = NULL;
+ rdma_write_chunk_t *writech = NULL;
int32_t ret = -1;
if ((peer == NULL) || (writech_ptr == NULL) || (*writech_ptr == NULL)
@@ -588,7 +588,7 @@ __rdma_create_write_chunks_from_vector (rdma_peer_t *peer,
priv = peer->trans->private;
device = priv->device;
-
+
for (i = 0; i < count; i++) {
mr = ibv_reg_mr (device->pd, vector[i].iov_base,
vector[i].iov_len,
@@ -645,15 +645,15 @@ __rdma_create_write_chunks (rdma_peer_t *peer, rdma_ioq_t *entry,
}
/*
- if ((chunk_type == rdma_writech)
- && ((entry->msg.request.rsphdr_count == 0)
- || (entry->msg.request.rsphdr_vec[0].iov_base == NULL))) {
- gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
- "vector specifying buffer to hold the program's reply "
- "header should also be provided when buffers are "
- "provided for holding the program's payload in reply");
- goto out;
- }
+ if ((chunk_type == rdma_writech)
+ && ((entry->msg.request.rsphdr_count == 0)
+ || (entry->msg.request.rsphdr_vec[0].iov_base == NULL))) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
+ "vector specifying buffer to hold the program's reply "
+ "header should also be provided when buffers are "
+ "provided for holding the program's payload in reply");
+ goto out;
+ }
*/
if (chunk_type == rdma_writech) {
@@ -684,7 +684,7 @@ __rdma_create_write_chunks (rdma_peer_t *peer, rdma_ioq_t *entry,
**ptr = 0;
*ptr = *ptr + 1;
} else {
- /* no write chunklist */
+ /* no write chunklist */
**ptr = 0;
*ptr = *ptr + 1;
@@ -693,7 +693,7 @@ __rdma_create_write_chunks (rdma_peer_t *peer, rdma_ioq_t *entry,
warray->wc_nchunks = hton32 (entry->msg.request.rsphdr_count);
*ptr = (uint32_t *)&warray->wc_array[0];
-
+
ret = __rdma_create_write_chunks_from_vector (peer,
(rdma_write_chunk_t **)ptr,
entry->msg.request.rsphdr_vec,
@@ -918,7 +918,7 @@ rdma_post_ref (rdma_post_t *post)
post->refcount++;
}
pthread_mutex_unlock (&post->lock);
-
+
out:
return post;
}
@@ -928,7 +928,7 @@ int32_t
__rdma_ioq_churn_request (rdma_peer_t *peer, rdma_ioq_t *entry,
rdma_post_t *post)
{
- rdma_chunktype_t rtype = rdma_noch, wtype = rdma_noch;
+ rdma_chunktype_t rtype = rdma_noch, wtype = rdma_noch;
uint64_t send_size = 0;
rdma_header_t *hdr = NULL;
struct rpc_msg *rpc_msg = NULL;
@@ -1086,7 +1086,7 @@ __rdma_ioq_churn_request (rdma_peer_t *peer, rdma_ioq_t *entry,
}
len = buf - post->buf;
-
+
rdma_post_ref (post);
ret = rdma_post_send (peer->qp, post, len);
@@ -1127,9 +1127,9 @@ __rdma_fill_reply_header (rdma_header_t *header, struct iovec *rpchdr,
header->rm_xid = hton32 (reply_info->rm_xid);
} else {
rpc_msg = rpchdr[0].iov_base; /* assume rpchdr contains
- * only one vector.
- * (which is true)
- */
+ * only one vector.
+ * (which is true)
+ */
header->rm_xid = rpc_msg->rm_xid;
}
@@ -1188,7 +1188,7 @@ __rdma_send_reply_inline (rdma_peer_t *peer, rdma_ioq_t *entry,
iov_unload (buf, entry->proghdr, entry->proghdr_count);
buf += iov_length (entry->proghdr, entry->proghdr_count);
}
-
+
if (entry->prog_payload_count != 0) {
iov_unload (buf, entry->prog_payload,
entry->prog_payload_count);
@@ -1250,7 +1250,7 @@ __rdma_reply_encode_write_chunks (rdma_peer_t *peer, uint32_t payload_size,
target_array->wc_array[i].wc_target.rs_length
= hton32 (min (payload_size,
- reply_info->wc_array->wc_array[i].wc_target.rs_length));
+ reply_info->wc_array->wc_array[i].wc_target.rs_length));
}
target_array->wc_nchunks = hton32 (i);
@@ -1313,7 +1313,7 @@ out:
* 2. modifies vec
*/
int32_t
-__rdma_write (rdma_peer_t *peer, rdma_post_t *post, struct iovec *vec,
+__rdma_write (rdma_peer_t *peer, rdma_post_t *post, struct iovec *vec,
uint32_t xfer_len, int *idx, rdma_write_chunk_t *writech)
{
int size = 0, num_sge = 0, i = 0;
@@ -1389,7 +1389,7 @@ __rdma_do_rdma_write (rdma_peer_t *peer, rdma_post_t *post,
int i = 0, payload_idx = 0;
uint32_t payload_size = 0, xfer_len = 0;
int32_t ret = -1;
-
+
if (count != 0) {
payload_size = iov_length (vector, count);
}
@@ -1488,7 +1488,7 @@ __rdma_send_reply_type_nomsg (rdma_peer_t *peer, rdma_ioq_t *entry,
if (ret) {
gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
"rdma_post_send to client (%s) failed with "
- "ret = %d (%s)", peer->trans->peerinfo.identifier, ret,
+ "ret = %d (%s)", peer->trans->peerinfo.identifier, ret,
(ret > 0) ? strerror (ret) : "");
ret = -1;
rdma_post_unref (post);
@@ -1689,7 +1689,7 @@ __rdma_ioq_churn_entry (rdma_peer_t *peer, rdma_ioq_t *entry)
quota = __rdma_quota_get (peer);
if (quota > 0) {
post = rdma_get_post (&device->sendq);
- if (post == NULL) {
+ if (post == NULL) {
post = rdma_new_post (device,
(options->send_size + 2048),
RDMA_SEND_POST);
@@ -1821,7 +1821,7 @@ rdma_ioq_new (rpc_transport_t *this, rpc_transport_data_t *data)
if (data->data.req.rsp.rsp_payload_count != 0) {
for (i = 0; i < data->data.req.rsp.rsp_payload_count;
i++) {
- entry->msg.request.rsp_payload[i]
+ entry->msg.request.rsp_payload[i]
= data->data.req.rsp.rsp_payload[i];
}
@@ -1881,7 +1881,7 @@ rdma_submit_request (rpc_transport_t *this,
{
int32_t ret = 0;
rdma_ioq_t *entry = NULL;
- rpc