Patchwork [BUG:902,3/4] nfs3: Round-up read reply bytes of multi-vector reply

login
register
Submitter Shehjar Tikoo
Date 2010-05-10 04:43:54
Message ID <1273466635-16077-3-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/3245/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Shehjar Tikoo - 2010-05-10 04:43:54
From: Shehjar Tikoo <shehjart@zresearch.com>

A previos commit brought in support for returning read replies
when subvolumes return reads in multiple iovecs. This did
not completely fix the problem since the bytes in iovecs
all together could be unaligned with the 4 byte
boundary as needed by XDR for the opaque data. This resulted
in read requests being either retransmitted or rejected with
an error message in syslog on the NFS client.

Signed-off-by: Shehjar Tikoo <shehjart@dev.gluster.com>
Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 xlators/nfs/server/src/nfs3-helpers.c |    4 +---
 xlators/nfs/server/src/nfs3.c         |    1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

Patch

diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index 63d640e..1da8738 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -1526,9 +1526,7 @@  nfs3_fill_read3res (read3res *res, nfsstat3 stat, count3 count,
         res->read3res_u.resok.file_attributes = poa;
         res->read3res_u.resok.count = count;
         res->read3res_u.resok.eof = is_eof;
-        res->read3res_u.resok.data.data_len = xdr_length_round_up (count,
-                                                                   1048576);
-
+        res->read3res_u.resok.data.data_len = count;
 }
 
 
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index fd773fc..704dca3 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -1371,6 +1371,7 @@  nfs3_read_reply (rpcsvc_request_t *req, nfsstat3 stat, count3 count,
         xlid = nfs3_request_xlator_id (req);
         nfs3_fill_read3res (&res, stat, count, poststat, is_eof, xlid);
         if (stat == NFS3_OK) {
+                xdr_vector_round_up (vec, vcount, count);
                 /* iob can be zero if the file size was zero. If so, op_ret
                  * would be 0 and count = 0.
                  */