aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-04-03 01:28:08 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-04-03 20:41:16 -0400
commitb85d4c01b76f6969a085d07a767fa45225cb14be (patch)
tree5441d0f6bcec52fab3b81ad4887239ff784c5ad9 /fs/nfsd/nfs4xdr.c
parenta1bcecd29cdf1670df6908a620add4211c0abb7a (diff)
nfsd41: sequence operation
Implement the sequence operation conforming to http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-26 Check for stale clientid (as derived from the sessionid). Enforce slotid range and exactly-once semantics using the slotid and seqid. If everything went well renew the client lease and mark the slot INPROGRESS. Add a struct nfsd4_slot pointer to struct nfsd4_compound_state. To be used for sessions DRC replay. [nfsd41: rename sequence catchthis to cachethis] Signed-off-by: Andy Adamson<andros@netapp.com> [pulled some code to set cstate->slot from "nfsd DRC logic"] [use sessionid_lock spin lock] [nfsd41: use bool inuse for slot state] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd: add a struct nfsd4_slot pointer to struct nfsd4_compound_state] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: add nfsd4_session pointer to nfsd4_compound_state] [nfsd41: set cstate session] [nfsd41: use cstate session in nfsd4_sequence] Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [simplify nfsd4_encode_sequence error handling] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index bebf6d249069..8556575480ce 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1113,7 +1113,16 @@ static __be32
1113nfsd4_decode_sequence(struct nfsd4_compoundargs *argp, 1113nfsd4_decode_sequence(struct nfsd4_compoundargs *argp,
1114 struct nfsd4_sequence *seq) 1114 struct nfsd4_sequence *seq)
1115{ 1115{
1116 return nfserr_opnotsupp; /* stub */ 1116 DECODE_HEAD;
1117
1118 READ_BUF(NFS4_MAX_SESSIONID_LEN + 16);
1119 COPYMEM(seq->sessionid.data, NFS4_MAX_SESSIONID_LEN);
1120 READ32(seq->seqid);
1121 READ32(seq->slotid);
1122 READ32(seq->maxslots);
1123 READ32(seq->cachethis);
1124
1125 DECODE_TAIL;
1117} 1126}
1118 1127
1119static __be32 1128static __be32
@@ -2828,8 +2837,26 @@ static __be32
2828nfsd4_encode_sequence(struct nfsd4_compoundres *resp, int nfserr, 2837nfsd4_encode_sequence(struct nfsd4_compoundres *resp, int nfserr,
2829 struct nfsd4_sequence *seq) 2838 struct nfsd4_sequence *seq)
2830{ 2839{
2831 /* stub */ 2840 ENCODE_HEAD;
2832 return nfserr; 2841
2842 if (nfserr)
2843 return nfserr;
2844
2845 RESERVE_SPACE(NFS4_MAX_SESSIONID_LEN + 20);
2846 WRITEMEM(seq->sessionid.data, NFS4_MAX_SESSIONID_LEN);
2847 WRITE32(seq->seqid);
2848 WRITE32(seq->slotid);
2849 WRITE32(seq->maxslots);
2850 /*
2851 * FIXME: for now:
2852 * target_maxslots = maxslots
2853 * status_flags = 0
2854 */
2855 WRITE32(seq->maxslots);
2856 WRITE32(0);
2857
2858 ADJUST_ARGS();
2859 return 0;
2833} 2860}
2834 2861
2835static __be32 2862static __be32