aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-09-10 05:26:51 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-15 20:49:56 -0400
commit2af73580b7d7b687175f47ba092640761602b221 (patch)
tree6136af3800ff00204b8a07b4f7b07472b8b06206
parent2a1d1b593803d7c18a369bf148f3b48c5a3260fc (diff)
nfsd41: Backchannel: cb_sequence callback
Implement the cb_sequence callback conforming to draft-ietf-nfsv4-minorversion1 Note: highest slot id and target highest slot id do not have to be 0 as was previously implemented. They can be greater than what the nfs server sent if the client supports a larger slot table on the backchannel. At this point we just ignore that. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> [Rework the back channel xdr using the shared v4.0 and v4.1 framework.] Signed-off-by: Andy Adamson <andros@netapp.com> [fixed indentation] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: use nfsd4_cb_sequence for callback minorversion] Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: fix verification of CB_SEQUENCE highest slot id[ Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: Backchannel: Remove old backchannel serialization] [nfsd41: Backchannel: First callback sequence ID should be 1] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: decode_cb_sequence does not need to actually decode ignored fields] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/nfs4callback.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 25a09069e458..d37707d26dee 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -256,6 +256,27 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp,
256 hdr->nops++; 256 hdr->nops++;
257} 257}
258 258
259static void
260encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *args,
261 struct nfs4_cb_compound_hdr *hdr)
262{
263 __be32 *p;
264
265 if (hdr->minorversion == 0)
266 return;
267
268 RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20);
269
270 WRITE32(OP_CB_SEQUENCE);
271 WRITEMEM(args->cbs_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN);
272 WRITE32(args->cbs_clp->cl_cb_seq_nr);
273 WRITE32(0); /* slotid, always 0 */
274 WRITE32(0); /* highest slotid always 0 */
275 WRITE32(0); /* cachethis always 0 */
276 WRITE32(0); /* FIXME: support referring_call_lists */
277 hdr->nops++;
278}
279
259static int 280static int
260nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p) 281nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p)
261{ 282{
@@ -317,6 +338,57 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
317 return 0; 338 return 0;
318} 339}
319 340
341/*
342 * Our current back channel implmentation supports a single backchannel
343 * with a single slot.
344 */
345static int
346decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *res,
347 struct rpc_rqst *rqstp)
348{
349 struct nfs4_sessionid id;
350 int status;
351 u32 dummy;
352 __be32 *p;
353
354 if (res->cbs_minorversion == 0)
355 return 0;
356
357 status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE);
358 if (status)
359 return status;
360
361 /*
362 * If the server returns different values for sessionID, slotID or
363 * sequence number, the server is looney tunes.
364 */
365 status = -ESERVERFAULT;
366
367 READ_BUF(NFS4_MAX_SESSIONID_LEN + 16);
368 memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
369 p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN);
370 if (memcmp(id.data, res->cbs_clp->cl_sessionid.data,
371 NFS4_MAX_SESSIONID_LEN)) {
372 dprintk("%s Invalid session id\n", __func__);
373 goto out;
374 }
375 READ32(dummy);
376 if (dummy != res->cbs_clp->cl_cb_seq_nr) {
377 dprintk("%s Invalid sequence number\n", __func__);
378 goto out;
379 }
380 READ32(dummy); /* slotid must be 0 */
381 if (dummy != 0) {
382 dprintk("%s Invalid slotid\n", __func__);
383 goto out;
384 }
385 /* FIXME: process highest slotid and target highest slotid */
386 status = 0;
387out:
388 return status;
389}
390
391
320static int 392static int
321nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p) 393nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
322{ 394{