aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:43 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:43 -0500
commit7eff03aec917e17f733471d7e12c262c0c96409f (patch)
tree6f0e7b53cbf55689cd37cfe3b1b087b8c61ac4cd /fs/nfs/nfs4state.c
parent0f605b56008c4b6b075217480c36ba395ca4eaa4 (diff)
NFSv4: Add a recovery marking scheme for state owners
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index a780518c5c3f..7dcca23167dd 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -832,6 +832,7 @@ static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_st
832 clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); 832 clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
833 return 0; 833 return 0;
834 } 834 }
835 set_bit(NFS_OWNER_RECLAIM_REBOOT, &state->owner->so_flags);
835 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); 836 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
836 return 1; 837 return 1;
837} 838}
@@ -840,6 +841,7 @@ static int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_s
840{ 841{
841 set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags); 842 set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags);
842 clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); 843 clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
844 set_bit(NFS_OWNER_RECLAIM_NOGRACE, &state->owner->so_flags);
843 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); 845 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
844 return 1; 846 return 1;
845} 847}
@@ -1043,14 +1045,25 @@ static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recov
1043 struct rb_node *pos; 1045 struct rb_node *pos;
1044 int status = 0; 1046 int status = 0;
1045 1047
1046 /* Note: list is protected by exclusive lock on cl->cl_sem */ 1048restart:
1049 spin_lock(&clp->cl_lock);
1047 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { 1050 for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) {
1048 struct nfs4_state_owner *sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); 1051 struct nfs4_state_owner *sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
1052 if (!test_and_clear_bit(ops->owner_flag_bit, &sp->so_flags))
1053 continue;
1054 atomic_inc(&sp->so_count);
1055 spin_unlock(&clp->cl_lock);
1049 status = nfs4_reclaim_open_state(sp, ops); 1056 status = nfs4_reclaim_open_state(sp, ops);
1050 if (status < 0) 1057 if (status < 0) {
1051 break; 1058 set_bit(ops->owner_flag_bit, &sp->so_flags);
1059 nfs4_put_state_owner(sp);
1060 nfs4_recovery_handle_error(clp, status);
1061 return status;
1062 }
1063 nfs4_put_state_owner(sp);
1064 goto restart;
1052 } 1065 }
1053 nfs4_recovery_handle_error(clp, status); 1066 spin_unlock(&clp->cl_lock);
1054 return status; 1067 return status;
1055} 1068}
1056 1069