aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4proc.c3
-rw-r--r--fs/nfsd/nfs4state.c6
-rw-r--r--fs/nfsd/nfs4xdr.c19
-rw-r--r--fs/nfsd/xdr4.h6
4 files changed, 22 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 53636ff0e6a..cdb7ca33718 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -311,9 +311,6 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
311 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL) 311 if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
312 return nfserr_inval; 312 return nfserr_inval;
313 313
314 /* We don't yet support WANT bits: */
315 open->op_share_access &= NFS4_SHARE_ACCESS_MASK;
316
317 open->op_created = 0; 314 open->op_created = 0;
318 /* 315 /*
319 * RFC5661 18.51.3 316 * RFC5661 18.51.3
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f89ccc26390..45966a436b0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2637,8 +2637,6 @@ nfs4_check_delegmode(struct nfs4_delegation *dp, int flags)
2637 2637
2638static int share_access_to_flags(u32 share_access) 2638static int share_access_to_flags(u32 share_access)
2639{ 2639{
2640 share_access &= NFS4_SHARE_ACCESS_MASK;
2641
2642 return share_access == NFS4_SHARE_ACCESS_READ ? RD_STATE : WR_STATE; 2640 return share_access == NFS4_SHARE_ACCESS_READ ? RD_STATE : WR_STATE;
2643} 2641}
2644 2642
@@ -3600,7 +3598,9 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
3600 cstate->current_fh.fh_dentry->d_name.name); 3598 cstate->current_fh.fh_dentry->d_name.name);
3601 3599
3602 /* We don't yet support WANT bits: */ 3600 /* We don't yet support WANT bits: */
3603 od->od_share_access &= NFS4_SHARE_ACCESS_MASK; 3601 if (od->od_deleg_want)
3602 dprintk("NFSD: %s: od_deleg_want=0x%x ignored\n", __func__,
3603 od->od_deleg_want);
3604 3604
3605 nfs4_lock_state(); 3605 nfs4_lock_state();
3606 status = nfs4_preprocess_confirmed_seqid_op(cstate, od->od_seqid, 3606 status = nfs4_preprocess_confirmed_seqid_op(cstate, od->od_seqid,
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);
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 12789eb3f91..4949832fd74 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -233,6 +233,7 @@ struct nfsd4_open {
233 u32 op_seqid; /* request */ 233 u32 op_seqid; /* request */
234 u32 op_share_access; /* request */ 234 u32 op_share_access; /* request */
235 u32 op_share_deny; /* request */ 235 u32 op_share_deny; /* request */
236 u32 op_deleg_want; /* request */
236 stateid_t op_stateid; /* response */ 237 stateid_t op_stateid; /* response */
237 u32 op_recall; /* recall */ 238 u32 op_recall; /* recall */
238 struct nfsd4_change_info op_cinfo; /* response */ 239 struct nfsd4_change_info op_cinfo; /* response */
@@ -256,8 +257,9 @@ struct nfsd4_open_confirm {
256struct nfsd4_open_downgrade { 257struct nfsd4_open_downgrade {
257 stateid_t od_stateid; 258 stateid_t od_stateid;
258 u32 od_seqid; 259 u32 od_seqid;
259 u32 od_share_access; 260 u32 od_share_access; /* request */
260 u32 od_share_deny; 261 u32 od_deleg_want; /* request */
262 u32 od_share_deny; /* request */
261}; 263};
262 264
263 265