aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4callback.c30
-rw-r--r--fs/nfsd/state.h11
2 files changed, 18 insertions, 23 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 4566b69128a3..5687fce85641 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -247,7 +247,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_delegation *dp,
247} 247}
248 248
249static void 249static void
250encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *args, 250encode_cb_sequence(struct xdr_stream *xdr, struct nfs4_rpc_args *args,
251 struct nfs4_cb_compound_hdr *hdr) 251 struct nfs4_cb_compound_hdr *hdr)
252{ 252{
253 __be32 *p; 253 __be32 *p;
@@ -258,8 +258,8 @@ encode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *args,
258 RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20); 258 RESERVE_SPACE(1 + NFS4_MAX_SESSIONID_LEN + 20);
259 259
260 WRITE32(OP_CB_SEQUENCE); 260 WRITE32(OP_CB_SEQUENCE);
261 WRITEMEM(args->cbs_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN); 261 WRITEMEM(args->args_clp->cl_sessionid.data, NFS4_MAX_SESSIONID_LEN);
262 WRITE32(args->cbs_clp->cl_cb_seq_nr); 262 WRITE32(args->args_clp->cl_cb_seq_nr);
263 WRITE32(0); /* slotid, always 0 */ 263 WRITE32(0); /* slotid, always 0 */
264 WRITE32(0); /* highest slotid always 0 */ 264 WRITE32(0); /* highest slotid always 0 */
265 WRITE32(0); /* cachethis always 0 */ 265 WRITE32(0); /* cachethis always 0 */
@@ -285,12 +285,12 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p,
285 struct nfs4_delegation *args = rpc_args->args_op; 285 struct nfs4_delegation *args = rpc_args->args_op;
286 struct nfs4_cb_compound_hdr hdr = { 286 struct nfs4_cb_compound_hdr hdr = {
287 .ident = args->dl_ident, 287 .ident = args->dl_ident,
288 .minorversion = rpc_args->args_seq.cbs_minorversion, 288 .minorversion = rpc_args->args_minorversion,
289 }; 289 };
290 290
291 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 291 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
292 encode_cb_compound_hdr(&xdr, &hdr); 292 encode_cb_compound_hdr(&xdr, &hdr);
293 encode_cb_sequence(&xdr, &rpc_args->args_seq, &hdr); 293 encode_cb_sequence(&xdr, rpc_args, &hdr);
294 encode_cb_recall(&xdr, args, &hdr); 294 encode_cb_recall(&xdr, args, &hdr);
295 encode_cb_nops(&hdr); 295 encode_cb_nops(&hdr);
296 return 0; 296 return 0;
@@ -338,7 +338,7 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected)
338 * with a single slot. 338 * with a single slot.
339 */ 339 */
340static int 340static int
341decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *res, 341decode_cb_sequence(struct xdr_stream *xdr, struct nfs4_rpc_args *res,
342 struct rpc_rqst *rqstp) 342 struct rpc_rqst *rqstp)
343{ 343{
344 struct nfs4_sessionid id; 344 struct nfs4_sessionid id;
@@ -346,7 +346,7 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *res,
346 u32 dummy; 346 u32 dummy;
347 __be32 *p; 347 __be32 *p;
348 348
349 if (res->cbs_minorversion == 0) 349 if (res->args_minorversion == 0)
350 return 0; 350 return 0;
351 351
352 status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE); 352 status = decode_cb_op_hdr(xdr, OP_CB_SEQUENCE);
@@ -362,13 +362,13 @@ decode_cb_sequence(struct xdr_stream *xdr, struct nfsd4_cb_sequence *res,
362 READ_BUF(NFS4_MAX_SESSIONID_LEN + 16); 362 READ_BUF(NFS4_MAX_SESSIONID_LEN + 16);
363 memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN); 363 memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN);
364 p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN); 364 p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN);
365 if (memcmp(id.data, res->cbs_clp->cl_sessionid.data, 365 if (memcmp(id.data, res->args_clp->cl_sessionid.data,
366 NFS4_MAX_SESSIONID_LEN)) { 366 NFS4_MAX_SESSIONID_LEN)) {
367 dprintk("%s Invalid session id\n", __func__); 367 dprintk("%s Invalid session id\n", __func__);
368 goto out; 368 goto out;
369 } 369 }
370 READ32(dummy); 370 READ32(dummy);
371 if (dummy != res->cbs_clp->cl_cb_seq_nr) { 371 if (dummy != res->args_clp->cl_cb_seq_nr) {
372 dprintk("%s Invalid sequence number\n", __func__); 372 dprintk("%s Invalid sequence number\n", __func__);
373 goto out; 373 goto out;
374 } 374 }
@@ -392,7 +392,7 @@ nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p)
392 392
393static int 393static int
394nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p, 394nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
395 struct nfsd4_cb_sequence *seq) 395 struct nfs4_rpc_args *args)
396{ 396{
397 struct xdr_stream xdr; 397 struct xdr_stream xdr;
398 struct nfs4_cb_compound_hdr hdr; 398 struct nfs4_cb_compound_hdr hdr;
@@ -402,8 +402,8 @@ nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
402 status = decode_cb_compound_hdr(&xdr, &hdr); 402 status = decode_cb_compound_hdr(&xdr, &hdr);
403 if (status) 403 if (status)
404 goto out; 404 goto out;
405 if (seq) { 405 if (args) {
406 status = decode_cb_sequence(&xdr, seq, rqstp); 406 status = decode_cb_sequence(&xdr, args, rqstp);
407 if (status) 407 if (status)
408 goto out; 408 goto out;
409 } 409 }
@@ -603,8 +603,8 @@ static int nfsd41_cb_setup_sequence(struct nfs4_client *clp,
603 * We'll need the clp during XDR encoding and decoding, 603 * We'll need the clp during XDR encoding and decoding,
604 * and the sequence during decoding to verify the reply 604 * and the sequence during decoding to verify the reply
605 */ 605 */
606 args->args_seq.cbs_clp = clp; 606 args->args_clp = clp;
607 task->tk_msg.rpc_resp = &args->args_seq; 607 task->tk_msg.rpc_resp = args;
608 608
609out: 609out:
610 dprintk("%s status=%d\n", __func__, status); 610 dprintk("%s status=%d\n", __func__, status);
@@ -623,7 +623,7 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
623 u32 minorversion = clp->cl_cb_conn.cb_minorversion; 623 u32 minorversion = clp->cl_cb_conn.cb_minorversion;
624 int status = 0; 624 int status = 0;
625 625
626 args->args_seq.cbs_minorversion = minorversion; 626 args->args_minorversion = minorversion;
627 if (minorversion) { 627 if (minorversion) {
628 status = nfsd41_cb_setup_sequence(clp, task); 628 status = nfsd41_cb_setup_sequence(clp, task);
629 if (status) { 629 if (status) {
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 322518c88e4b..59313f1d8e67 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -64,15 +64,10 @@ typedef struct {
64 (s)->si_fileid, \ 64 (s)->si_fileid, \
65 (s)->si_generation 65 (s)->si_generation
66 66
67struct nfsd4_cb_sequence {
68 /* args/res */
69 u32 cbs_minorversion;
70 struct nfs4_client *cbs_clp;
71};
72
73struct nfs4_rpc_args { 67struct nfs4_rpc_args {
74 void *args_op; 68 void *args_op;
75 struct nfsd4_cb_sequence args_seq; 69 struct nfs4_client *args_clp;
70 u32 args_minorversion;
76}; 71};
77 72
78struct nfsd4_callback { 73struct nfsd4_callback {