aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4callback.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4callback.c')
-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{