aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <benny@tonian.com>2012-02-16 13:57:09 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-02-17 18:38:42 -0500
commit2c8bd7e0d1b66b2f8f267fd6ab62a30569c792c0 (patch)
tree54f90f3eb8c7cebfefea8b11957b2514078fe13d /fs/nfsd/nfs4xdr.c
parent00b5f95a26f2f95b86e59cf86346b06ba14943ee (diff)
nfsd41: split out share_access want and signal flags while decoding
Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 279a70548e4..d241a8571dd 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -638,14 +638,18 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup
638 DECODE_TAIL; 638 DECODE_TAIL;
639} 639}
640 640
641static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *x) 641static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *share_access, u32 *deleg_want, u32 *deleg_when)
642{ 642{
643 __be32 *p; 643 __be32 *p;
644 u32 w; 644 u32 w;
645 645
646 READ_BUF(4); 646 READ_BUF(4);
647 READ32(w); 647 READ32(w);
648 *x = w; 648 *share_access = w & NFS4_SHARE_ACCESS_MASK;
649 *deleg_want = w & NFS4_SHARE_WANT_MASK;
650 if (deleg_when)
651 *deleg_when = w & NFS4_SHARE_WHEN_MASK;
652
649 switch (w & NFS4_SHARE_ACCESS_MASK) { 653 switch (w & NFS4_SHARE_ACCESS_MASK) {
650 case NFS4_SHARE_ACCESS_READ: 654 case NFS4_SHARE_ACCESS_READ:
651 case NFS4_SHARE_ACCESS_WRITE: 655 case NFS4_SHARE_ACCESS_WRITE:
@@ -673,6 +677,9 @@ static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *x)
673 w &= ~NFS4_SHARE_WANT_MASK; 677 w &= ~NFS4_SHARE_WANT_MASK;
674 if (!w) 678 if (!w)
675 return nfs_ok; 679 return nfs_ok;
680
681 if (!deleg_when) /* open_downgrade */
682 return nfserr_inval;
676 switch (w) { 683 switch (w) {
677 case NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL: 684 case NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL:
678 case NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED: 685 case NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED:
@@ -719,6 +726,7 @@ static __be32
719nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) 726nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
720{ 727{
721 DECODE_HEAD; 728 DECODE_HEAD;
729 u32 dummy;
722 730
723 memset(open->op_bmval, 0, sizeof(open->op_bmval)); 731 memset(open->op_bmval, 0, sizeof(open->op_bmval));
724 open->op_iattr.ia_valid = 0; 732 open->op_iattr.ia_valid = 0;
@@ -727,7 +735,9 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
727 /* seqid, share_access, share_deny, clientid, ownerlen */ 735 /* seqid, share_access, share_deny, clientid, ownerlen */
728 READ_BUF(4); 736 READ_BUF(4);
729 READ32(open->op_seqid); 737 READ32(open->op_seqid);
730 status = nfsd4_decode_share_access(argp, &open->op_share_access); 738 /* decode, yet ignore deleg_when until supported */
739 status = nfsd4_decode_share_access(argp, &open->op_share_access,
740 &open->op_deleg_want, &dummy);
731 if (status) 741 if (status)
732 goto xdr_error; 742 goto xdr_error;
733 status = nfsd4_decode_share_deny(argp, &open->op_share_deny); 743 status = nfsd4_decode_share_deny(argp, &open->op_share_deny);
@@ -848,7 +858,8 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
848 return status; 858 return status;
849 READ_BUF(4); 859 READ_BUF(4);
850 READ32(open_down->od_seqid); 860 READ32(open_down->od_seqid);
851 status = nfsd4_decode_share_access(argp, &open_down->od_share_access); 861 status = nfsd4_decode_share_access(argp, &open_down->od_share_access,
862 &open_down->od_deleg_want, NULL);
852 if (status) 863 if (status)
853 return status; 864 return status;
854 status = nfsd4_decode_share_deny(argp, &open_down->od_share_deny); 865 status = nfsd4_decode_share_deny(argp, &open_down->od_share_deny);