[pnfs] [PATCH] sequence xdr fix
Dean Hildebrand
seattleplus at gmail.com
Wed Oct 3 23:14:43 EDT 2007
Sorry about that Benny, here is another shot at the *quick fix* patch.
I'm in transition email-wise, and I'm trying to get stg mail to work
nicely with gmail (because it sure won't with lotus).
-----
Eliminate duplicate response xdr headers for NFSv4.1 operations
with regards to sequence id space. For now, I just made every
static and used the xdr constants from the top of nfs4xdr.c.
Eliminated global variable nr_sequence_quads to allow a more
flexible approach in the future that will support NFSv4.0 and
NFSv4.1. We still need to separate out xdr header sizes between
NFSv4.0 and NFSv4.1.
---
fs/nfs/nfs4xdr.c | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 6e620ea..9dcd97b 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -60,7 +60,6 @@
/* Mapping from NFS error code to "errno" error code. */
#define errno_NFSERR_IO EIO
-static int nr_sequence_quads = 0;
static int nfs_stat_to_errno(int);
@@ -198,7 +197,7 @@ static int nfs_stat_to_errno(int);
#define NFS4_dec_readlink_sz (compound_decode_hdr_maxsz + \
decode_sequence_maxsz + \
decode_putfh_maxsz + \
- op_decode_hdr_maxsz)
+ op_decode_hdr_maxsz + 1)
#define NFS4_enc_readdir_sz (compound_encode_hdr_maxsz + \
encode_sequence_maxsz +\
encode_putfh_maxsz + \
@@ -1300,10 +1299,9 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
/* set up reply kvec
* toplevel_status + taglen + rescount + OP_PUTFH + status
* + OP_READDIR + status + verifer(2) = 9
- * Add to this the size for the sequence op; 0 if no sessions,
- * 11 otherwise
+ * TODO: Session sequence space is statically added.
*/
- replen = (RPC_REPHDRSIZE + auth->au_rslack + 9 + nr_sequence_quads) << 2;
+ replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readdir_sz) << 2;
xdr_inline_pages(&req->rq_rcv_buf, replen, readdir->pages,
readdir->pgbase, readdir->count);
dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
@@ -1325,9 +1323,9 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r
/* set up reply kvec
* toplevel_status + taglen + rescount + OP_PUTFH + status
* + OP_READLINK + status + string length = 8
- * Similar to readdir, add space for the sequence op
+ * TODO: Session sequence space is statically added.
*/
- replen = (RPC_REPHDRSIZE + auth->au_rslack + 8 + nr_sequence_quads) << 2;
+ replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2;
xdr_inline_pages(&req->rq_rcv_buf, replen, readlink->pages,
readlink->pgbase, readlink->pglen);
@@ -2626,9 +2624,9 @@ static int nfs4_xdr_enc_read(struct rpc_rqst *req, const struct nfs_readargs *ar
/* set up reply kvec
* toplevel status + taglen=0 + rescount + OP_PUTFH + status
* + OP_READ + status + eof + datalen = 9
- * Add space for sequence op too.
+ * TODO: Session sequence space is statically added.
*/
- replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_read_sz + nr_sequence_quads) << 2;
+ replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_read_sz) << 2;
xdr_inline_pages(&req->rq_rcv_buf, replen,
args->pages, args->pgbase, args->count);
out:
@@ -2729,8 +2727,10 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, const struct nfs_getaclargs *args,
if (status)
goto out;
status = encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0);
- /* set up reply buffer: */
- replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz + nr_sequence_quads) << 2;
+ /* set up reply buffer:
+ * TODO: Session sequence space is statically added.
+ */
+ replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz) << 2;
xdr_inline_pages(&req->rq_rcv_buf, replen,
args->acl_pages, args->acl_pgbase, args->acl_len);
out:
@@ -3246,8 +3246,9 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, const struct nfs4_fs_
/* set up reply
* toplevel_status + OP_PUTFH + status
* + OP_LOOKUP + status + OP_GETATTR + status = 7
+ * TODO: Session sequence space is statically added.
*/
- replen = (RPC_REPHDRSIZE + auth->au_rslack + 7 + nr_sequence_quads) << 2;
+ replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_fs_locations_sz) << 2;
xdr_inline_pages(&req->rq_rcv_buf, replen, &args->page,
0, PAGE_SIZE);
out:
@@ -6761,10 +6762,6 @@ static int nfs41_xdr_dec_create_session(struct rpc_rqst *rqstp, uint32_t *p, str
status = decode_create_session(&xdr, res);
- if (!status) {
- /* Decode session succeeded; set nr_sequence_quads */
- nr_sequence_quads = decode_sequence_maxsz;
- }
return status;
}
More information about the pNFS
mailing list