aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorBenny Halevy <benny@tonian.com>2012-02-21 17:16:54 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-03-06 18:13:35 -0500
commite27f49c33b7410f4db065bc4382a8e03769eecc3 (patch)
tree2b036ce4d8362762b94df6ac0bf4a3bc97e4392e /fs/nfsd
parent4aa8913cb0cd257543f257ddb4baf0b37eb30b9d (diff)
nfsd41: refactor nfsd4_deleg_xgrade_none_ext logic out of nfsd4_process_open2
Handle the case where the nfsv4.1 client asked to uprade or downgrade its delegations and server returns no delegation. In this case, op_delegate_type is set to NFS4_OPEN_DELEGATE_NONE_EXT and op_why_no_deleg is set respectively to WND4_NOT_SUPP_{UP,DOWN}GRADE Signed-off-by: Benny Halevy <bhalevy@tonian.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1b3e2bd82568..97dd2c75f322 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2951,6 +2951,24 @@ out_no_deleg:
2951 goto out; 2951 goto out;
2952} 2952}
2953 2953
2954static void nfsd4_deleg_xgrade_none_ext(struct nfsd4_open *open,
2955 struct nfs4_delegation *dp)
2956{
2957 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
2958 dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
2959 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
2960 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
2961 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
2962 dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
2963 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
2964 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
2965 }
2966 /* Otherwise the client must be confused wanting a delegation
2967 * it already has, therefore we don't return
2968 * NFS4_OPEN_DELEGATE_NONE_EXT and reason.
2969 */
2970}
2971
2954/* 2972/*
2955 * called with nfs4_lock_state() held. 2973 * called with nfs4_lock_state() held.
2956 */ 2974 */
@@ -3035,21 +3053,8 @@ nodeleg:
3035out: 3053out:
3036 /* 4.1 client trying to upgrade/downgrade delegation? */ 3054 /* 4.1 client trying to upgrade/downgrade delegation? */
3037 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp && 3055 if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
3038 open->op_deleg_want) { 3056 open->op_deleg_want)
3039 if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG && 3057 nfsd4_deleg_xgrade_none_ext(open, dp);
3040 dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
3041 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
3042 open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
3043 } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
3044 dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
3045 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
3046 open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
3047 }
3048 /* Otherwise the client must be confused wanting a delegation
3049 * it already has, therefore we don't return
3050 * NFS4_OPEN_DELEGATE_NONE_EXT and reason.
3051 */
3052 }
3053 3058
3054 if (fp) 3059 if (fp)
3055 put_nfs4_file(fp); 3060 put_nfs4_file(fp);