aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorBenny Halevy <benny@tonian.com>2012-02-21 17:16:44 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-03-06 18:13:34 -0500
commit4aa8913cb0cd257543f257ddb4baf0b37eb30b9d (patch)
tree5a277572634a66f6298f2d3c1a2f0be71aa7f64d /fs/nfsd
parent1fa9c4440c151c61eb3309579a85aae22c9adb6d (diff)
nfsd41: refactor nfs4_open_deleg_none_ext logic out of nfs4_open_delegation
When a 4.1 client asks for a delegation and the server returns none op_delegate_type is set to NFS4_OPEN_DELEGATE_NONE_EXT and op_why_no_deleg is set to either WND4_CONTENTION or WND4_RESOURCE. Or, if the client sent a NFS4_SHARE_WANT_CANCEL (which it is not supposed to ever do until our server supports delegations signaling), op_why_no_deleg is set to WND4_CANCELLED. Note that for WND4_CONTENTION and WND4_RESOURCE, the xdr layer is hard coded at this time to encode boolean FALSE for ond_server_will_push_deleg / ond_server_will_signal_avail. 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.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 90c7e06ea2e8..1b3e2bd82568 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2862,6 +2862,27 @@ static int nfs4_set_delegation(struct nfs4_delegation *dp, int flag)
2862 return 0; 2862 return 0;
2863} 2863}
2864 2864
2865static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status)
2866{
2867 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
2868 if (status == -EAGAIN)
2869 open->op_why_no_deleg = WND4_CONTENTION;
2870 else {
2871 open->op_why_no_deleg = WND4_RESOURCE;
2872 switch (open->op_deleg_want) {
2873 case NFS4_SHARE_WANT_READ_DELEG:
2874 case NFS4_SHARE_WANT_WRITE_DELEG:
2875 case NFS4_SHARE_WANT_ANY_DELEG:
2876 break;
2877 case NFS4_SHARE_WANT_CANCEL:
2878 open->op_why_no_deleg = WND4_CANCELLED;
2879 break;
2880 case NFS4_SHARE_WANT_NO_DELEG:
2881 BUG(); /* not supposed to get here */
2882 }
2883 }
2884}
2885
2865/* 2886/*
2866 * Attempt to hand out a delegation. 2887 * Attempt to hand out a delegation.
2867 */ 2888 */
@@ -2918,25 +2939,9 @@ out:
2918 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE) 2939 open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE)
2919 dprintk("NFSD: WARNING: refusing delegation reclaim\n"); 2940 dprintk("NFSD: WARNING: refusing delegation reclaim\n");
2920 2941
2921 if (open->op_deleg_want) { 2942 /* 4.1 client asking for a delegation? */
2922 open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT; 2943 if (open->op_deleg_want)
2923 if (status == -EAGAIN) 2944 nfsd4_open_deleg_none_ext(open, status);
2924 open->op_why_no_deleg = WND4_CONTENTION;
2925 else {
2926 open->op_why_no_deleg = WND4_RESOURCE;
2927 switch (open->op_deleg_want) {
2928 case NFS4_SHARE_WANT_READ_DELEG:
2929 case NFS4_SHARE_WANT_WRITE_DELEG:
2930 case NFS4_SHARE_WANT_ANY_DELEG:
2931 break;
2932 case NFS4_SHARE_WANT_CANCEL:
2933 open->op_why_no_deleg = WND4_CANCELLED;
2934 break;
2935 case NFS4_SHARE_WANT_NO_DELEG:
2936 BUG(); /* not supposed to get here */
2937 }
2938 }
2939 }
2940 } 2945 }
2941 return; 2946 return;
2942out_free: 2947out_free: