aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-11-16 22:28:38 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-11-26 09:08:13 -0500
commit8a61b18c9b13987310d0f3ba13aa04af51f02a1c (patch)
tree0a2b520aed04683bcd3fde519106ed25b5533de2 /fs
parent447bfcc936ce28636833e89c4b82f424a291dde9 (diff)
nfsd4: simplify reading of opnum
The comment here is totally bogus: - OP_WRITE + 1 is RELEASE_LOCKOWNER. Maybe there was some older version of the spec in which that served as a sort of OP_ILLEGAL? No idea, but it's clearly wrong now. - In any case, I can't see that the spec says anything about what to do if the client sends us less ops than promised. It's clearly nutty client behavior, and we should do whatever's easiest: returning an xdr error (even though it won't be consistent with the error on the last op returned) seems fine to me. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 9dfad585d41..cfebc9c4f4c 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1624,38 +1624,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1624 op = &argp->ops[i]; 1624 op = &argp->ops[i];
1625 op->replay = NULL; 1625 op->replay = NULL;
1626 1626
1627 /* 1627 READ_BUF(4);
1628 * We can't use READ_BUF() here because we need to handle 1628 READ32(op->opnum);
1629 * a missing opcode as an OP_WRITE + 1. So we need to check
1630 * to see if we're truly at the end of our buffer or if there
1631 * is another page we need to flip to.
1632 */
1633
1634 if (argp->p == argp->end) {
1635 if (argp->pagelen < 4) {
1636 /* There isn't an opcode still on the wire */
1637 op->opnum = OP_WRITE + 1;
1638 op->status = nfserr_bad_xdr;
1639 argp->opcnt = i+1;
1640 break;
1641 }
1642
1643 /*
1644 * False alarm. We just hit a page boundary, but there
1645 * is still data available. Move pointer across page
1646 * boundary. *snip from READ_BUF*
1647 */
1648 argp->p = page_address(argp->pagelist[0]);
1649 argp->pagelist++;
1650 if (argp->pagelen < PAGE_SIZE) {
1651 argp->end = argp->p + (argp->pagelen>>2);
1652 argp->pagelen = 0;
1653 } else {
1654 argp->end = argp->p + (PAGE_SIZE>>2);
1655 argp->pagelen -= PAGE_SIZE;
1656 }
1657 }
1658 op->opnum = ntohl(*argp->p++);
1659 1629
1660 if (op->opnum >= FIRST_NFS4_OP && op->opnum <= LAST_NFS4_OP) 1630 if (op->opnum >= FIRST_NFS4_OP && op->opnum <= LAST_NFS4_OP)
1661 op->status = ops->decoders[op->opnum](argp, &op->u); 1631 op->status = ops->decoders[op->opnum](argp, &op->u);