summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-05-24 12:58:04 +0530
committerAnand Avati <avati@redhat.com>2012-05-24 17:32:32 -0700
commit89b3466373191b7d2f0001778308b2393ea74da6 (patch)
tree00a69678ad54be29d9b487c2f01a70ffeaeceef7
parent9f81eb0b24f27ea9797bb8a4ff062e6f77e872fd (diff)
rpc: fix the vecsizer issue
* currently, we needed 'base-address' of the header for glusterfs writev vecsizer and 'current-address' of the buffer which is reading the data on socket, for nfs write vecsizer. * nfs write issues started coming after http://review.gluster.com/3182 was pushed into repo, now fixed. * fixed by sending both as argument for vecsizer from the transport Change-Id: I6db360ce265ce5f083f1794ebdb3867f8cfad9ec Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 824472 Reviewed-on: http://review.gluster.com/3431 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--rpc/rpc-lib/src/rpcsvc.h3
-rw-r--r--rpc/rpc-transport/socket/src/socket.c6
-rw-r--r--xlators/nfs/server/src/nfs3.c11
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c5
4 files changed, 15 insertions, 10 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h
index 95f2c4e8461..847ec1b336e 100644
--- a/rpc/rpc-lib/src/rpcsvc.h
+++ b/rpc/rpc-lib/src/rpcsvc.h
@@ -278,7 +278,8 @@ struct rpcsvc_request {
typedef int (*rpcsvc_actor) (rpcsvc_request_t *req);
typedef int (*rpcsvc_vector_actor) (rpcsvc_request_t *req, struct iovec *vec,
int count, struct iobref *iobref);
-typedef int (*rpcsvc_vector_sizer) (int state, ssize_t *readsize, char *addr);
+typedef int (*rpcsvc_vector_sizer) (int state, ssize_t *readsize,
+ char *base_addr, char *curr_addr);
/* Every protocol actor will also need to specify the function the RPC layer
* will use to serialize or encode the message into XDR format just before
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 5e65755d813..2476b13f7ee 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -875,7 +875,8 @@ sp_state_read_verfbytes:
proghdr_buf = priv->incoming.frag.fragcurrent;
priv->incoming.frag.call_body.request.vector_sizer_state =
vector_sizer (priv->incoming.frag.call_body.request.vector_sizer_state,
- &readsize, proghdr_buf);
+ &readsize, proghdr_buf,
+ priv->incoming.frag.fragcurrent);
__socket_proto_init_pending (priv, readsize);
priv->incoming.frag.call_body.request.vector_state
= SP_STATE_READING_PROGHDR;
@@ -887,7 +888,8 @@ sp_state_read_verfbytes:
sp_state_reading_proghdr:
priv->incoming.frag.call_body.request.vector_sizer_state =
vector_sizer (priv->incoming.frag.call_body.request.vector_sizer_state,
- &readsize, proghdr_buf);
+ &readsize, proghdr_buf,
+ priv->incoming.frag.fragcurrent);
if (readsize == 0) {
priv->incoming.frag.call_body.request.vector_state =
SP_STATE_READ_PROGHDR;
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index f950b9273ee..684123958b8 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -2238,17 +2238,18 @@ out:
int
-nfs3svc_write_vecsizer (int state, ssize_t *readsize, char *addr)
+nfs3svc_write_vecsizer (int state, ssize_t *readsize, char *base_addr,
+ char *curr_addr)
{
- int ret = 0;
- uint32_t fhlen = 0;
- uint32_t fhlen_n = 0;
+ int ret = 0;
+ uint32_t fhlen = 0;
+ uint32_t fhlen_n = 0;
if (state == 0) {
ret = NFS3_VECWRITE_READFHLEN;
*readsize = 4;
} else if (state == NFS3_VECWRITE_READFHLEN) {
- fhlen_n = *(uint32_t *)(addr - 4);
+ fhlen_n = *(uint32_t *)(curr_addr - 4);
fhlen = ntohl (fhlen_n);
*readsize = xdr_length_round_up (fhlen, NFS3_FHSIZE);
ret = NFS3_VECWRITE_READFH;
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 06283461d06..166f720941a 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -3431,7 +3431,8 @@ server_writev_vec (rpcsvc_request_t *req, struct iovec *payload,
#define SERVER3_1_VECWRITE_READING_OPAQUE 2
int
-server_writev_vecsizer (int state, ssize_t *readsize, char *addr)
+server_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
+ char *curr_addr)
{
ssize_t size = 0;
int nextstate = 0;
@@ -3449,7 +3450,7 @@ server_writev_vecsizer (int state, ssize_t *readsize, char *addr)
size = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req,
&write_req);
- xdrmem_create (&xdr, addr, size, XDR_DECODE);
+ xdrmem_create (&xdr, base_addr, size, XDR_DECODE);
/* This will fail if there is xdata sent from client, if not,
well and good */