aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2010-09-24 09:17:01 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-09-24 09:17:01 -0400
commitdfb4f309830359352539919f23accc59a20a3758 (patch)
treec692dbb873e212bd919e6b98dac62478cb9ba968 /fs/nfs/nfs4xdr.c
parent7c563cc9f3f4aca70c27bd08a135499227f67014 (diff)
NFSv4.1: keep seq_res.sr_slot as pointer rather than an index
Having to explicitly initialize sr_slotid to NFS4_MAX_SLOT_TABLE resulted in numerous bugs. Keeping the current slot as a pointer to the slot table is more straight forward and robust as it's implicitly set up to NULL wherever the seq_res member is initialized to zeroes. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 86ab69eb149..3feace66b98 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4665,7 +4665,6 @@ static int decode_sequence(struct xdr_stream *xdr,
4665 struct rpc_rqst *rqstp) 4665 struct rpc_rqst *rqstp)
4666{ 4666{
4667#if defined(CONFIG_NFS_V4_1) 4667#if defined(CONFIG_NFS_V4_1)
4668 struct nfs4_slot *slot;
4669 struct nfs4_sessionid id; 4668 struct nfs4_sessionid id;
4670 u32 dummy; 4669 u32 dummy;
4671 int status; 4670 int status;
@@ -4697,15 +4696,14 @@ static int decode_sequence(struct xdr_stream *xdr,
4697 goto out_overflow; 4696 goto out_overflow;
4698 4697
4699 /* seqid */ 4698 /* seqid */
4700 slot = &res->sr_session->fc_slot_table.slots[res->sr_slotid];
4701 dummy = be32_to_cpup(p++); 4699 dummy = be32_to_cpup(p++);
4702 if (dummy != slot->seq_nr) { 4700 if (dummy != res->sr_slot->seq_nr) {
4703 dprintk("%s Invalid sequence number\n", __func__); 4701 dprintk("%s Invalid sequence number\n", __func__);
4704 goto out_err; 4702 goto out_err;
4705 } 4703 }
4706 /* slot id */ 4704 /* slot id */
4707 dummy = be32_to_cpup(p++); 4705 dummy = be32_to_cpup(p++);
4708 if (dummy != res->sr_slotid) { 4706 if (dummy != res->sr_slot - res->sr_session->fc_slot_table.slots) {
4709 dprintk("%s Invalid slot id\n", __func__); 4707 dprintk("%s Invalid slot id\n", __func__);
4710 goto out_err; 4708 goto out_err;
4711 } 4709 }