aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback_xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/callback_xdr.c')
-rw-r--r--fs/nfs/callback_xdr.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 13619d24f023..dd0ef34b5845 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -141,7 +141,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
141 /* We do not like overly long tags! */ 141 /* We do not like overly long tags! */
142 if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) { 142 if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) {
143 printk("NFSv4 CALLBACK %s: client sent tag of length %u\n", 143 printk("NFSv4 CALLBACK %s: client sent tag of length %u\n",
144 __FUNCTION__, hdr->taglen); 144 __func__, hdr->taglen);
145 return htonl(NFS4ERR_RESOURCE); 145 return htonl(NFS4ERR_RESOURCE);
146 } 146 }
147 p = read_buf(xdr, 12); 147 p = read_buf(xdr, 12);
@@ -151,7 +151,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
151 /* Check minor version is zero. */ 151 /* Check minor version is zero. */
152 if (minor_version != 0) { 152 if (minor_version != 0) {
153 printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n", 153 printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n",
154 __FUNCTION__, minor_version); 154 __func__, minor_version);
155 return htonl(NFS4ERR_MINOR_VERS_MISMATCH); 155 return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
156 } 156 }
157 hdr->callback_ident = ntohl(*p++); 157 hdr->callback_ident = ntohl(*p++);
@@ -179,7 +179,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
179 args->addr = svc_addr(rqstp); 179 args->addr = svc_addr(rqstp);
180 status = decode_bitmap(xdr, args->bitmap); 180 status = decode_bitmap(xdr, args->bitmap);
181out: 181out:
182 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); 182 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
183 return status; 183 return status;
184} 184}
185 185
@@ -200,7 +200,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr,
200 args->truncate = ntohl(*p); 200 args->truncate = ntohl(*p);
201 status = decode_fh(xdr, &args->fh); 201 status = decode_fh(xdr, &args->fh);
202out: 202out:
203 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); 203 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
204 return status; 204 return status;
205} 205}
206 206
@@ -349,7 +349,7 @@ static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
349 status = encode_attr_mtime(xdr, res->bitmap, &res->mtime); 349 status = encode_attr_mtime(xdr, res->bitmap, &res->mtime);
350 *savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1))); 350 *savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1)));
351out: 351out:
352 dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); 352 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
353 return status; 353 return status;
354} 354}
355 355
@@ -363,7 +363,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
363 long maxlen; 363 long maxlen;
364 __be32 res; 364 __be32 res;
365 365
366 dprintk("%s: start\n", __FUNCTION__); 366 dprintk("%s: start\n", __func__);
367 status = decode_op_hdr(xdr_in, &op_nr); 367 status = decode_op_hdr(xdr_in, &op_nr);
368 if (likely(status == 0)) { 368 if (likely(status == 0)) {
369 switch (op_nr) { 369 switch (op_nr) {
@@ -392,7 +392,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
392 status = res; 392 status = res;
393 if (op->encode_res != NULL && status == 0) 393 if (op->encode_res != NULL && status == 0)
394 status = op->encode_res(rqstp, xdr_out, resp); 394 status = op->encode_res(rqstp, xdr_out, resp);
395 dprintk("%s: done, status = %d\n", __FUNCTION__, ntohl(status)); 395 dprintk("%s: done, status = %d\n", __func__, ntohl(status));
396 return status; 396 return status;
397} 397}
398 398
@@ -401,37 +401,37 @@ static __be32 process_op(struct svc_rqst *rqstp,
401 */ 401 */
402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) 402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp)
403{ 403{
404 struct cb_compound_hdr_arg hdr_arg; 404 struct cb_compound_hdr_arg hdr_arg = { 0 };
405 struct cb_compound_hdr_res hdr_res; 405 struct cb_compound_hdr_res hdr_res = { NULL };
406 struct xdr_stream xdr_in, xdr_out; 406 struct xdr_stream xdr_in, xdr_out;
407 __be32 *p; 407 __be32 *p;
408 __be32 status; 408 __be32 status;
409 unsigned int nops = 1; 409 unsigned int nops = 0;
410 410
411 dprintk("%s: start\n", __FUNCTION__); 411 dprintk("%s: start\n", __func__);
412 412
413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); 413 xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base);
414 414
415 p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); 415 p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len);
416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p); 416 xdr_init_encode(&xdr_out, &rqstp->rq_res, p);
417 417
418 decode_compound_hdr_arg(&xdr_in, &hdr_arg); 418 status = decode_compound_hdr_arg(&xdr_in, &hdr_arg);
419 if (status == __constant_htonl(NFS4ERR_RESOURCE))
420 return rpc_garbage_args;
421
419 hdr_res.taglen = hdr_arg.taglen; 422 hdr_res.taglen = hdr_arg.taglen;
420 hdr_res.tag = hdr_arg.tag; 423 hdr_res.tag = hdr_arg.tag;
421 hdr_res.nops = NULL; 424 if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0)
422 encode_compound_hdr_res(&xdr_out, &hdr_res); 425 return rpc_system_err;
423 426
424 for (;;) { 427 while (status == 0 && nops != hdr_arg.nops) {
425 status = process_op(rqstp, &xdr_in, argp, &xdr_out, resp); 428 status = process_op(rqstp, &xdr_in, argp, &xdr_out, resp);
426 if (status != 0)
427 break;
428 if (nops == hdr_arg.nops)
429 break;
430 nops++; 429 nops++;
431 } 430 }
431
432 *hdr_res.status = status; 432 *hdr_res.status = status;
433 *hdr_res.nops = htonl(nops); 433 *hdr_res.nops = htonl(nops);
434 dprintk("%s: done, status = %u\n", __FUNCTION__, ntohl(status)); 434 dprintk("%s: done, status = %u\n", __func__, ntohl(status));
435 return rpc_success; 435 return rpc_success;
436} 436}
437 437