Loading fs/nfsd/nfs4proc.c +3 −12 Original line number Original line Diff line number Diff line Loading @@ -366,12 +366,6 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, switch (open->op_claim_type) { switch (open->op_claim_type) { case NFS4_OPEN_CLAIM_DELEGATE_CUR: case NFS4_OPEN_CLAIM_DELEGATE_CUR: case NFS4_OPEN_CLAIM_NULL: case NFS4_OPEN_CLAIM_NULL: /* * (1) set CURRENT_FH to the file being opened, * creating it if necessary, (2) set open->op_cinfo, * (3) set open->op_truncate if the file is to be * truncated after opening, (4) do permission checking. */ status = do_open_lookup(rqstp, &cstate->current_fh, status = do_open_lookup(rqstp, &cstate->current_fh, open); open); if (status) if (status) Loading @@ -379,17 +373,14 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, break; break; case NFS4_OPEN_CLAIM_PREVIOUS: case NFS4_OPEN_CLAIM_PREVIOUS: open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; /* case NFS4_OPEN_CLAIM_FH: * The CURRENT_FH is already set to the file being case NFS4_OPEN_CLAIM_DELEG_CUR_FH: * opened. (1) set open->op_cinfo, (2) set * open->op_truncate if the file is to be truncated * after opening, (3) do permission checking. */ status = do_open_fhandle(rqstp, &cstate->current_fh, status = do_open_fhandle(rqstp, &cstate->current_fh, open); open); if (status) if (status) goto out; goto out; break; break; case NFS4_OPEN_CLAIM_DELEG_PREV_FH: case NFS4_OPEN_CLAIM_DELEGATE_PREV: case NFS4_OPEN_CLAIM_DELEGATE_PREV: open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; dprintk("NFSD: unsupported OPEN claim type %d\n", dprintk("NFSD: unsupported OPEN claim type %d\n", Loading fs/nfsd/nfs4state.c +8 −2 Original line number Original line Diff line number Diff line Loading @@ -2587,6 +2587,12 @@ static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, statei return delegstateid(ret); return delegstateid(ret); } } static bool nfsd4_is_deleg_cur(struct nfsd4_open *open) { return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR || open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH; } static __be32 static __be32 nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open, nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_delegation **dp) struct nfs4_delegation **dp) Loading @@ -2602,7 +2608,7 @@ nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open if (status) if (status) *dp = NULL; *dp = NULL; out: out: if (open->op_claim_type != NFS4_OPEN_CLAIM_DELEGATE_CUR) if (!nfsd4_is_deleg_cur(open)) return nfs_ok; return nfs_ok; if (status) if (status) return status; return status; Loading Loading @@ -2879,7 +2885,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf goto out; goto out; } else { } else { status = nfserr_bad_stateid; status = nfserr_bad_stateid; if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR) if (nfsd4_is_deleg_cur(open)) goto out; goto out; status = nfserr_jukebox; status = nfserr_jukebox; fp = open->op_file; fp = open->op_file; Loading fs/nfsd/nfs4xdr.c +13 −0 Original line number Original line Diff line number Diff line Loading @@ -803,6 +803,19 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) return status; return status; break; break; case NFS4_OPEN_CLAIM_FH: case NFS4_OPEN_CLAIM_DELEG_PREV_FH: if (argp->minorversion < 1) goto xdr_error; /* void */ break; case NFS4_OPEN_CLAIM_DELEG_CUR_FH: if (argp->minorversion < 1) goto xdr_error; status = nfsd4_decode_stateid(argp, &open->op_delegate_stateid); if (status) return status; break; default: default: goto xdr_error; goto xdr_error; } } Loading include/linux/nfs4.h +4 −1 Original line number Original line Diff line number Diff line Loading @@ -410,7 +410,10 @@ enum open_claim_type4 { NFS4_OPEN_CLAIM_NULL = 0, NFS4_OPEN_CLAIM_NULL = 0, NFS4_OPEN_CLAIM_PREVIOUS = 1, NFS4_OPEN_CLAIM_PREVIOUS = 1, NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, NFS4_OPEN_CLAIM_DELEGATE_PREV = 3 NFS4_OPEN_CLAIM_DELEGATE_PREV = 3, NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */ NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */ NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */ }; }; enum opentype4 { enum opentype4 { Loading Loading
fs/nfsd/nfs4proc.c +3 −12 Original line number Original line Diff line number Diff line Loading @@ -366,12 +366,6 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, switch (open->op_claim_type) { switch (open->op_claim_type) { case NFS4_OPEN_CLAIM_DELEGATE_CUR: case NFS4_OPEN_CLAIM_DELEGATE_CUR: case NFS4_OPEN_CLAIM_NULL: case NFS4_OPEN_CLAIM_NULL: /* * (1) set CURRENT_FH to the file being opened, * creating it if necessary, (2) set open->op_cinfo, * (3) set open->op_truncate if the file is to be * truncated after opening, (4) do permission checking. */ status = do_open_lookup(rqstp, &cstate->current_fh, status = do_open_lookup(rqstp, &cstate->current_fh, open); open); if (status) if (status) Loading @@ -379,17 +373,14 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, break; break; case NFS4_OPEN_CLAIM_PREVIOUS: case NFS4_OPEN_CLAIM_PREVIOUS: open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; /* case NFS4_OPEN_CLAIM_FH: * The CURRENT_FH is already set to the file being case NFS4_OPEN_CLAIM_DELEG_CUR_FH: * opened. (1) set open->op_cinfo, (2) set * open->op_truncate if the file is to be truncated * after opening, (3) do permission checking. */ status = do_open_fhandle(rqstp, &cstate->current_fh, status = do_open_fhandle(rqstp, &cstate->current_fh, open); open); if (status) if (status) goto out; goto out; break; break; case NFS4_OPEN_CLAIM_DELEG_PREV_FH: case NFS4_OPEN_CLAIM_DELEGATE_PREV: case NFS4_OPEN_CLAIM_DELEGATE_PREV: open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; dprintk("NFSD: unsupported OPEN claim type %d\n", dprintk("NFSD: unsupported OPEN claim type %d\n", Loading
fs/nfsd/nfs4state.c +8 −2 Original line number Original line Diff line number Diff line Loading @@ -2587,6 +2587,12 @@ static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, statei return delegstateid(ret); return delegstateid(ret); } } static bool nfsd4_is_deleg_cur(struct nfsd4_open *open) { return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR || open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH; } static __be32 static __be32 nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open, nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_delegation **dp) struct nfs4_delegation **dp) Loading @@ -2602,7 +2608,7 @@ nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open if (status) if (status) *dp = NULL; *dp = NULL; out: out: if (open->op_claim_type != NFS4_OPEN_CLAIM_DELEGATE_CUR) if (!nfsd4_is_deleg_cur(open)) return nfs_ok; return nfs_ok; if (status) if (status) return status; return status; Loading Loading @@ -2879,7 +2885,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf goto out; goto out; } else { } else { status = nfserr_bad_stateid; status = nfserr_bad_stateid; if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR) if (nfsd4_is_deleg_cur(open)) goto out; goto out; status = nfserr_jukebox; status = nfserr_jukebox; fp = open->op_file; fp = open->op_file; Loading
fs/nfsd/nfs4xdr.c +13 −0 Original line number Original line Diff line number Diff line Loading @@ -803,6 +803,19 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) return status; return status; break; break; case NFS4_OPEN_CLAIM_FH: case NFS4_OPEN_CLAIM_DELEG_PREV_FH: if (argp->minorversion < 1) goto xdr_error; /* void */ break; case NFS4_OPEN_CLAIM_DELEG_CUR_FH: if (argp->minorversion < 1) goto xdr_error; status = nfsd4_decode_stateid(argp, &open->op_delegate_stateid); if (status) return status; break; default: default: goto xdr_error; goto xdr_error; } } Loading
include/linux/nfs4.h +4 −1 Original line number Original line Diff line number Diff line Loading @@ -410,7 +410,10 @@ enum open_claim_type4 { NFS4_OPEN_CLAIM_NULL = 0, NFS4_OPEN_CLAIM_NULL = 0, NFS4_OPEN_CLAIM_PREVIOUS = 1, NFS4_OPEN_CLAIM_PREVIOUS = 1, NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, NFS4_OPEN_CLAIM_DELEGATE_PREV = 3 NFS4_OPEN_CLAIM_DELEGATE_PREV = 3, NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */ NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */ NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */ }; }; enum opentype4 { enum opentype4 { Loading