aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-10-19 11:52:12 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-10-19 11:52:12 -0400
commit8b289b2c2355c3bea75f3e499b4aa251a3191382 (patch)
tree1811962d5409e5585d9e21921080bf007dfe554b /fs
parenta8d86cd75b709a9c9402c46674ea188493c53901 (diff)
nfsd4: implement new 4.1 open reclaim types
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4proc.c15
-rw-r--r--fs/nfsd/nfs4state.c10
-rw-r--r--fs/nfsd/nfs4xdr.c13
3 files changed, 24 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 710b97b7a2f3..458ebb6b59c7 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -366,12 +366,6 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
366 switch (open->op_claim_type) { 366 switch (open->op_claim_type) {
367 case NFS4_OPEN_CLAIM_DELEGATE_CUR: 367 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
368 case NFS4_OPEN_CLAIM_NULL: 368 case NFS4_OPEN_CLAIM_NULL:
369 /*
370 * (1) set CURRENT_FH to the file being opened,
371 * creating it if necessary, (2) set open->op_cinfo,
372 * (3) set open->op_truncate if the file is to be
373 * truncated after opening, (4) do permission checking.
374 */
375 status = do_open_lookup(rqstp, &cstate->current_fh, 369 status = do_open_lookup(rqstp, &cstate->current_fh,
376 open); 370 open);
377 if (status) 371 if (status)
@@ -379,17 +373,14 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
379 break; 373 break;
380 case NFS4_OPEN_CLAIM_PREVIOUS: 374 case NFS4_OPEN_CLAIM_PREVIOUS:
381 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; 375 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
382 /* 376 case NFS4_OPEN_CLAIM_FH:
383 * The CURRENT_FH is already set to the file being 377 case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
384 * opened. (1) set open->op_cinfo, (2) set
385 * open->op_truncate if the file is to be truncated
386 * after opening, (3) do permission checking.
387 */
388 status = do_open_fhandle(rqstp, &cstate->current_fh, 378 status = do_open_fhandle(rqstp, &cstate->current_fh,
389 open); 379 open);
390 if (status) 380 if (status)
391 goto out; 381 goto out;
392 break; 382 break;
383 case NFS4_OPEN_CLAIM_DELEG_PREV_FH:
393 case NFS4_OPEN_CLAIM_DELEGATE_PREV: 384 case NFS4_OPEN_CLAIM_DELEGATE_PREV:
394 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; 385 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
395 dprintk("NFSD: unsupported OPEN claim type %d\n", 386 dprintk("NFSD: unsupported OPEN claim type %d\n",
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 15e0db140403..e8c2a3ec0e60 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2587,6 +2587,12 @@ static struct nfs4_delegation *find_deleg_stateid(struct nfs4_client *cl, statei
2587 return delegstateid(ret); 2587 return delegstateid(ret);
2588} 2588}
2589 2589
2590static bool nfsd4_is_deleg_cur(struct nfsd4_open *open)
2591{
2592 return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR ||
2593 open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH;
2594}
2595
2590static __be32 2596static __be32
2591nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open, 2597nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open,
2592 struct nfs4_delegation **dp) 2598 struct nfs4_delegation **dp)
@@ -2602,7 +2608,7 @@ nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open
2602 if (status) 2608 if (status)
2603 *dp = NULL; 2609 *dp = NULL;
2604out: 2610out:
2605 if (open->op_claim_type != NFS4_OPEN_CLAIM_DELEGATE_CUR) 2611 if (!nfsd4_is_deleg_cur(open))
2606 return nfs_ok; 2612 return nfs_ok;
2607 if (status) 2613 if (status)
2608 return status; 2614 return status;
@@ -2879,7 +2885,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
2879 goto out; 2885 goto out;
2880 } else { 2886 } else {
2881 status = nfserr_bad_stateid; 2887 status = nfserr_bad_stateid;
2882 if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR) 2888 if (nfsd4_is_deleg_cur(open))
2883 goto out; 2889 goto out;
2884 status = nfserr_jukebox; 2890 status = nfserr_jukebox;
2885 fp = open->op_file; 2891 fp = open->op_file;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 645a0a9d8073..fdc09a52cd8d 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -803,6 +803,19 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
803 if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) 803 if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval)))
804 return status; 804 return status;
805 break; 805 break;
806 case NFS4_OPEN_CLAIM_FH:
807 case NFS4_OPEN_CLAIM_DELEG_PREV_FH:
808 if (argp->minorversion < 1)
809 goto xdr_error;
810 /* void */
811 break;
812 case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
813 if (argp->minorversion < 1)
814 goto xdr_error;
815 status = nfsd4_decode_stateid(argp, &open->op_delegate_stateid);
816 if (status)
817 return status;
818 break;
806 default: 819 default:
807 goto xdr_error; 820 goto xdr_error;
808 } 821 }