diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2013-08-09 12:49:56 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-09-03 15:26:38 -0400 |
commit | 2cf8bca8b9980c58eab9f2f47586eb16a6e63300 (patch) | |
tree | 73a83bf535562ddb5df3a347f380f82fee940d4a /fs/nfs | |
parent | be05c860d79bd2688486e78a3b7a298543f0c6f1 (diff) |
NFS: Update session draining barriers for NFSv4.0 transport blocking
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4state.c | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index f5b043474c55..4e956669d4fb 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -215,32 +215,6 @@ out: | |||
215 | return cred; | 215 | return cred; |
216 | } | 216 | } |
217 | 217 | ||
218 | #if defined(CONFIG_NFS_V4_1) | ||
219 | |||
220 | static int nfs41_setup_state_renewal(struct nfs_client *clp) | ||
221 | { | ||
222 | int status; | ||
223 | struct nfs_fsinfo fsinfo; | ||
224 | |||
225 | if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) { | ||
226 | nfs4_schedule_state_renewal(clp); | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | status = nfs4_proc_get_lease_time(clp, &fsinfo); | ||
231 | if (status == 0) { | ||
232 | /* Update lease time and schedule renewal */ | ||
233 | spin_lock(&clp->cl_lock); | ||
234 | clp->cl_lease_time = fsinfo.lease_time * HZ; | ||
235 | clp->cl_last_renewal = jiffies; | ||
236 | spin_unlock(&clp->cl_lock); | ||
237 | |||
238 | nfs4_schedule_state_renewal(clp); | ||
239 | } | ||
240 | |||
241 | return status; | ||
242 | } | ||
243 | |||
244 | static void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl) | 218 | static void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl) |
245 | { | 219 | { |
246 | if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) { | 220 | if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) { |
@@ -254,6 +228,11 @@ static void nfs4_end_drain_session(struct nfs_client *clp) | |||
254 | { | 228 | { |
255 | struct nfs4_session *ses = clp->cl_session; | 229 | struct nfs4_session *ses = clp->cl_session; |
256 | 230 | ||
231 | if (clp->cl_slot_tbl) { | ||
232 | nfs4_end_drain_slot_table(clp->cl_slot_tbl); | ||
233 | return; | ||
234 | } | ||
235 | |||
257 | if (ses != NULL) { | 236 | if (ses != NULL) { |
258 | nfs4_end_drain_slot_table(&ses->bc_slot_table); | 237 | nfs4_end_drain_slot_table(&ses->bc_slot_table); |
259 | nfs4_end_drain_slot_table(&ses->fc_slot_table); | 238 | nfs4_end_drain_slot_table(&ses->fc_slot_table); |
@@ -278,6 +257,9 @@ static int nfs4_begin_drain_session(struct nfs_client *clp) | |||
278 | struct nfs4_session *ses = clp->cl_session; | 257 | struct nfs4_session *ses = clp->cl_session; |
279 | int ret = 0; | 258 | int ret = 0; |
280 | 259 | ||
260 | if (clp->cl_slot_tbl) | ||
261 | return nfs4_drain_slot_tbl(clp->cl_slot_tbl); | ||
262 | |||
281 | /* back channel */ | 263 | /* back channel */ |
282 | ret = nfs4_drain_slot_tbl(&ses->bc_slot_table); | 264 | ret = nfs4_drain_slot_tbl(&ses->bc_slot_table); |
283 | if (ret) | 265 | if (ret) |
@@ -286,6 +268,32 @@ static int nfs4_begin_drain_session(struct nfs_client *clp) | |||
286 | return nfs4_drain_slot_tbl(&ses->fc_slot_table); | 268 | return nfs4_drain_slot_tbl(&ses->fc_slot_table); |
287 | } | 269 | } |
288 | 270 | ||
271 | #if defined(CONFIG_NFS_V4_1) | ||
272 | |||
273 | static int nfs41_setup_state_renewal(struct nfs_client *clp) | ||
274 | { | ||
275 | int status; | ||
276 | struct nfs_fsinfo fsinfo; | ||
277 | |||
278 | if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) { | ||
279 | nfs4_schedule_state_renewal(clp); | ||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | status = nfs4_proc_get_lease_time(clp, &fsinfo); | ||
284 | if (status == 0) { | ||
285 | /* Update lease time and schedule renewal */ | ||
286 | spin_lock(&clp->cl_lock); | ||
287 | clp->cl_lease_time = fsinfo.lease_time * HZ; | ||
288 | clp->cl_last_renewal = jiffies; | ||
289 | spin_unlock(&clp->cl_lock); | ||
290 | |||
291 | nfs4_schedule_state_renewal(clp); | ||
292 | } | ||
293 | |||
294 | return status; | ||
295 | } | ||
296 | |||
289 | static void nfs41_finish_session_reset(struct nfs_client *clp) | 297 | static void nfs41_finish_session_reset(struct nfs_client *clp) |
290 | { | 298 | { |
291 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | 299 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); |
@@ -2085,7 +2093,6 @@ static int nfs4_bind_conn_to_session(struct nfs_client *clp) | |||
2085 | } | 2093 | } |
2086 | #else /* CONFIG_NFS_V4_1 */ | 2094 | #else /* CONFIG_NFS_V4_1 */ |
2087 | static int nfs4_reset_session(struct nfs_client *clp) { return 0; } | 2095 | static int nfs4_reset_session(struct nfs_client *clp) { return 0; } |
2088 | static void nfs4_end_drain_session(struct nfs_client *clp) { } | ||
2089 | 2096 | ||
2090 | static int nfs4_bind_conn_to_session(struct nfs_client *clp) | 2097 | static int nfs4_bind_conn_to_session(struct nfs_client *clp) |
2091 | { | 2098 | { |