aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/delegation.c14
-rw-r--r--fs/nfs/delegation.h1
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4state.c9
4 files changed, 16 insertions, 10 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index bc9d4f9a788d..ff2c1585d23f 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -258,7 +258,7 @@ static int __nfs_inode_return_delegation(struct inode *inode, struct nfs_delegat
258/* 258/*
259 * Return all delegations that have been marked for return 259 * Return all delegations that have been marked for return
260 */ 260 */
261static void nfs_client_return_marked_delegations(struct nfs_client *clp) 261void nfs_client_return_marked_delegations(struct nfs_client *clp)
262{ 262{
263 struct nfs_delegation *delegation; 263 struct nfs_delegation *delegation;
264 struct inode *inode; 264 struct inode *inode;
@@ -342,15 +342,16 @@ void nfs_super_return_all_delegations(struct super_block *sb)
342 nfs_client_return_marked_delegations(clp); 342 nfs_client_return_marked_delegations(clp);
343} 343}
344 344
345static void nfs_client_return_all_delegations(struct nfs_client *clp) 345static void nfs_client_mark_return_all_delegations(struct nfs_client *clp)
346{ 346{
347 struct nfs_delegation *delegation; 347 struct nfs_delegation *delegation;
348 348
349 rcu_read_lock(); 349 rcu_read_lock();
350 list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) 350 list_for_each_entry_rcu(delegation, &clp->cl_delegations, super_list) {
351 set_bit(NFS_DELEGATION_RETURN, &delegation->flags); 351 set_bit(NFS_DELEGATION_RETURN, &delegation->flags);
352 set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state);
353 }
352 rcu_read_unlock(); 354 rcu_read_unlock();
353 nfs_client_return_marked_delegations(clp);
354} 355}
355 356
356static int nfs_do_expire_all_delegations(void *ptr) 357static int nfs_do_expire_all_delegations(void *ptr)
@@ -363,7 +364,8 @@ static int nfs_do_expire_all_delegations(void *ptr)
363 goto out; 364 goto out;
364 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) 365 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0)
365 goto out; 366 goto out;
366 nfs_client_return_all_delegations(clp); 367 nfs_client_mark_return_all_delegations(clp);
368 nfs_client_return_marked_delegations(clp);
367out: 369out:
368 nfs_put_client(clp); 370 nfs_put_client(clp);
369 module_put_and_exit(0); 371 module_put_and_exit(0);
@@ -392,7 +394,7 @@ void nfs_handle_cb_pathdown(struct nfs_client *clp)
392{ 394{
393 if (clp == NULL) 395 if (clp == NULL)
394 return; 396 return;
395 nfs_client_return_all_delegations(clp); 397 nfs_client_mark_return_all_delegations(clp);
396} 398}
397 399
398struct recall_threadargs { 400struct recall_threadargs {
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index c772bab12eea..56f3eb558ef4 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -40,6 +40,7 @@ struct inode *nfs_delegation_find_inode(struct nfs_client *clp, const struct nfs
40void nfs_super_return_all_delegations(struct super_block *sb); 40void nfs_super_return_all_delegations(struct super_block *sb);
41void nfs_expire_all_delegations(struct nfs_client *clp); 41void nfs_expire_all_delegations(struct nfs_client *clp);
42void nfs_handle_cb_pathdown(struct nfs_client *clp); 42void nfs_handle_cb_pathdown(struct nfs_client *clp);
43void nfs_client_return_marked_delegations(struct nfs_client *clp);
43 44
44void nfs_delegation_mark_reclaim(struct nfs_client *clp); 45void nfs_delegation_mark_reclaim(struct nfs_client *clp);
45void nfs_delegation_reap_unclaimed(struct nfs_client *clp); 46void nfs_delegation_reap_unclaimed(struct nfs_client *clp);
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 46cbc0cdf885..84a4f5223f61 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -43,7 +43,7 @@ enum nfs4_client_state {
43 NFS4CLNT_LEASE_EXPIRED, 43 NFS4CLNT_LEASE_EXPIRED,
44 NFS4CLNT_RECLAIM_REBOOT, 44 NFS4CLNT_RECLAIM_REBOOT,
45 NFS4CLNT_RECLAIM_NOGRACE, 45 NFS4CLNT_RECLAIM_NOGRACE,
46 NFS4CLNT_CB_PATH_DOWN, 46 NFS4CLNT_DELEGRETURN,
47}; 47};
48 48
49/* 49/*
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 3d78706b3efb..2894502b94dc 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1027,7 +1027,7 @@ static void nfs4_recovery_handle_error(struct nfs_client *clp, int error)
1027{ 1027{
1028 switch (error) { 1028 switch (error) {
1029 case -NFS4ERR_CB_PATH_DOWN: 1029 case -NFS4ERR_CB_PATH_DOWN:
1030 set_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state); 1030 nfs_handle_cb_pathdown(clp);
1031 break; 1031 break;
1032 case -NFS4ERR_STALE_CLIENTID: 1032 case -NFS4ERR_STALE_CLIENTID:
1033 case -NFS4ERR_LEASE_MOVED: 1033 case -NFS4ERR_LEASE_MOVED:
@@ -1156,11 +1156,14 @@ static int reclaimer(void *ptr)
1156 nfs4_state_end_reclaim_nograce(clp); 1156 nfs4_state_end_reclaim_nograce(clp);
1157 continue; 1157 continue;
1158 } 1158 }
1159
1160 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
1161 nfs_client_return_marked_delegations(clp);
1162 continue;
1163 }
1159 break; 1164 break;
1160 } 1165 }
1161out: 1166out:
1162 if (test_and_clear_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state))
1163 nfs_handle_cb_pathdown(clp);
1164 nfs4_clear_recover_bit(clp); 1167 nfs4_clear_recover_bit(clp);
1165 nfs_put_client(clp); 1168 nfs_put_client(clp);
1166 module_put_and_exit(0); 1169 module_put_and_exit(0);