Skip to content

Commit cee9b4e

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: rework NFS4_SHARE_WANT_* flag handling
The delstid draft adds new NFS4_SHARE_WANT_TYPE_MASK values that don't fit neatly into the existing WANT_MASK or WHEN_MASK. Add a new NFS4_SHARE_WANT_MOD_MASK value and redefine NFS4_SHARE_WANT_MASK to include it. Also fix the checks in nfsd4_deleg_xgrade_none_ext() to check for the flags instead of equality, since there may be modifier flags in the value. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 51c0d4f commit cee9b4e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

fs/nfsd/nfs4state.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6224,10 +6224,10 @@ static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
62246224
struct nfs4_delegation *dp)
62256225
{
62266226
if (deleg_is_write(dp->dl_type)) {
6227-
if (open->op_deleg_want == OPEN4_SHARE_ACCESS_WANT_READ_DELEG) {
6227+
if (open->op_deleg_want & OPEN4_SHARE_ACCESS_WANT_READ_DELEG) {
62286228
open->op_delegate_type = OPEN_DELEGATE_NONE_EXT;
62296229
open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
6230-
} else if (open->op_deleg_want == OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG) {
6230+
} else if (open->op_deleg_want & OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG) {
62316231
open->op_delegate_type = OPEN_DELEGATE_NONE_EXT;
62326232
open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
62336233
}

fs/nfsd/nfs4xdr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *sh
10671067
return nfs_ok;
10681068
if (!argp->minorversion)
10691069
return nfserr_bad_xdr;
1070-
switch (w & NFS4_SHARE_WANT_MASK) {
1070+
switch (w & NFS4_SHARE_WANT_TYPE_MASK) {
10711071
case OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE:
10721072
case OPEN4_SHARE_ACCESS_WANT_READ_DELEG:
10731073
case OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG:

include/uapi/linux/nfs4.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,24 @@
5858
#define NFS4_SHARE_DENY_BOTH 0x0003
5959

6060
/* nfs41 */
61-
#define NFS4_SHARE_WANT_MASK 0xFF00
61+
#define NFS4_SHARE_WANT_TYPE_MASK 0xFF00
6262
#define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000
6363
#define NFS4_SHARE_WANT_READ_DELEG 0x0100
6464
#define NFS4_SHARE_WANT_WRITE_DELEG 0x0200
6565
#define NFS4_SHARE_WANT_ANY_DELEG 0x0300
6666
#define NFS4_SHARE_WANT_NO_DELEG 0x0400
6767
#define NFS4_SHARE_WANT_CANCEL 0x0500
6868

69-
#define NFS4_SHARE_WHEN_MASK 0xF0000
69+
#define NFS4_SHARE_WHEN_MASK 0xF0000
7070
#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
7171
#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
7272

73+
#define NFS4_SHARE_WANT_MOD_MASK 0xF00000
7374
#define NFS4_SHARE_WANT_DELEG_TIMESTAMPS 0x100000
7475
#define NFS4_SHARE_WANT_OPEN_XOR_DELEGATION 0x200000
7576

77+
#define NFS4_SHARE_WANT_MASK (NFS4_SHARE_WANT_TYPE_MASK | NFS4_SHARE_WANT_MOD_MASK)
78+
7679
#define NFS4_CDFC4_FORE 0x1
7780
#define NFS4_CDFC4_BACK 0x2
7881
#define NFS4_CDFC4_BOTH 0x3

0 commit comments

Comments
 (0)