Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd4: implement new 4.1 open reclaim types

Signed-off-by: J. Bruce Fields <bfields@redhat.com>

+28 -15
+3 -12
fs/nfsd/nfs4proc.c
··· 366 366 switch (open->op_claim_type) { 367 367 case NFS4_OPEN_CLAIM_DELEGATE_CUR: 368 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 369 status = do_open_lookup(rqstp, &cstate->current_fh, 376 370 open); 377 371 if (status) ··· 373 379 break; 374 380 case NFS4_OPEN_CLAIM_PREVIOUS: 375 381 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; 376 - /* 377 - * The CURRENT_FH is already set to the file being 378 - * opened. (1) set open->op_cinfo, (2) set 379 - * open->op_truncate if the file is to be truncated 380 - * after opening, (3) do permission checking. 381 - */ 382 + case NFS4_OPEN_CLAIM_FH: 383 + case NFS4_OPEN_CLAIM_DELEG_CUR_FH: 382 384 status = do_open_fhandle(rqstp, &cstate->current_fh, 383 385 open); 384 386 if (status) 385 387 goto out; 386 388 break; 389 + case NFS4_OPEN_CLAIM_DELEG_PREV_FH: 387 390 case NFS4_OPEN_CLAIM_DELEGATE_PREV: 388 391 open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; 389 392 dprintk("NFSD: unsupported OPEN claim type %d\n",
+8 -2
fs/nfsd/nfs4state.c
··· 2587 2587 return delegstateid(ret); 2588 2588 } 2589 2589 2590 + static 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 + 2590 2596 static __be32 2591 2597 nfs4_check_deleg(struct nfs4_client *cl, struct nfs4_file *fp, struct nfsd4_open *open, 2592 2598 struct nfs4_delegation **dp) ··· 2608 2602 if (status) 2609 2603 *dp = NULL; 2610 2604 out: 2611 - if (open->op_claim_type != NFS4_OPEN_CLAIM_DELEGATE_CUR) 2605 + if (!nfsd4_is_deleg_cur(open)) 2612 2606 return nfs_ok; 2613 2607 if (status) 2614 2608 return status; ··· 2885 2879 goto out; 2886 2880 } else { 2887 2881 status = nfserr_bad_stateid; 2888 - if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR) 2882 + if (nfsd4_is_deleg_cur(open)) 2889 2883 goto out; 2890 2884 status = nfserr_jukebox; 2891 2885 fp = open->op_file;
+13
fs/nfsd/nfs4xdr.c
··· 803 803 if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) 804 804 return status; 805 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 819 default: 807 820 goto xdr_error; 808 821 }
+4 -1
include/linux/nfs4.h
··· 410 410 NFS4_OPEN_CLAIM_NULL = 0, 411 411 NFS4_OPEN_CLAIM_PREVIOUS = 1, 412 412 NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, 413 - NFS4_OPEN_CLAIM_DELEGATE_PREV = 3 413 + NFS4_OPEN_CLAIM_DELEGATE_PREV = 3, 414 + NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */ 415 + NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */ 416 + NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */ 414 417 }; 415 418 416 419 enum opentype4 {