summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-09-16 17:29:21 +0200
committerRaghavendra G <rgowdapp@redhat.com>2016-09-20 20:11:47 -0700
commitbf75a81c9732774d8ec3fbae34329481abb026f5 (patch)
tree8ddefe05b0625ef39259f967dbbea4fa6a44d5da
parentddab7a37b91957a69319be92ba865245eac4e344 (diff)
rpc: increase RPC/XID with each callback
The RPC/XID for callbacks has been hardcoded to GF_UNIVERSAL_ANSWER. In Wireshark these RPC-calls are marked as "RPC retransmissions" because of the repeating RPC/XID. This is most confusing when verifying the callbacks that the upcall framework sends. There is no way to see the difference between real retransmissions and new callbacks. This change was verified by create and removal of files through different Gluster clients. The RPC/XID is increased on a per connection (or client) base. The expectations of the RPC protocol are met this way. > Change-Id: I2116bec0e294df4046d168d8bcbba011284cd0b2 > BUG: 1377097 > Signed-off-by: Niels de Vos <ndevos@redhat.com> > Reviewed-on: http://review.gluster.org/15524 > Smoke: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> (cherry picked from commit e9b39527d5dcfba95c4c52a522c8ce1f4512ac21) Change-Id: I2116bec0e294df4046d168d8bcbba011284cd0b2 BUG: 1377288 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/15527 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r--rpc/rpc-lib/src/rpc-transport.h1
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c21
2 files changed, 19 insertions, 3 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h
index 227911a5935..f0add065065 100644
--- a/rpc/rpc-lib/src/rpc-transport.h
+++ b/rpc/rpc-lib/src/rpc-transport.h
@@ -205,6 +205,7 @@ struct rpc_transport {
uint64_t total_bytes_read;
uint64_t total_bytes_write;
+ uint32_t xid; /* RPC/XID used for callbacks */
struct list_head list;
int bind_insecure;
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 05d269609c5..f07e745a4b3 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -870,6 +870,20 @@ err:
return txrecord;
}
+static uint32_t
+rpc_callback_new_callid (struct rpc_transport *trans)
+{
+ uint32_t callid = 0;
+
+ pthread_mutex_lock (&trans->lock);
+ {
+ callid = ++trans->xid;
+ }
+ pthread_mutex_unlock (&trans->lock);
+
+ return callid;
+}
+
int
rpcsvc_fill_callback (int prognum, int progver, int procnum, int payload,
uint32_t xid, struct rpc_msg *request)
@@ -1048,6 +1062,7 @@ rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans,
rpc_transport_req_t req;
int ret = -1;
int proglen = 0;
+ uint32_t xid = 0;
if (!rpc) {
goto out;
@@ -1059,11 +1074,11 @@ rpcsvc_callback_submit (rpcsvc_t *rpc, rpc_transport_t *trans,
proglen += iov_length (proghdr, proghdrcount);
}
+ xid = rpc_callback_new_callid (trans);
+
request_iob = rpcsvc_callback_build_record (rpc, prog->prognum,
prog->progver, procnum,
- proglen,
- GF_UNIVERSAL_ANSWER,
- &rpchdr);
+ proglen, xid, &rpchdr);
if (!request_iob) {
gf_log ("rpcsvc", GF_LOG_WARNING,
"cannot build rpc-record");