diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-12-23 15:21:43 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-12-23 15:21:43 -0500 |
commit | fe1d81952e7f62b9da7dc438caaa07e35ec2b908 (patch) | |
tree | 177ba2a04c9ff9d040f87da7e6099e6009db7cd6 /fs/nfs | |
parent | 7eff03aec917e17f733471d7e12c262c0c96409f (diff) |
NFSv4: Ensure that nfs4_reclaim_open_state() doesn't depend on cl_sem
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4state.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 7dcca23167d..beade5570b5 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -893,11 +893,15 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs | |||
893 | * recovering after a network partition or a reboot from a | 893 | * recovering after a network partition or a reboot from a |
894 | * server that doesn't support a grace period. | 894 | * server that doesn't support a grace period. |
895 | */ | 895 | */ |
896 | restart: | ||
897 | spin_lock(&sp->so_lock); | ||
896 | list_for_each_entry(state, &sp->so_states, open_states) { | 898 | list_for_each_entry(state, &sp->so_states, open_states) { |
897 | if (!test_and_clear_bit(ops->state_flag_bit, &state->flags)) | 899 | if (!test_and_clear_bit(ops->state_flag_bit, &state->flags)) |
898 | continue; | 900 | continue; |
899 | if (state->state == 0) | 901 | if (state->state == 0) |
900 | continue; | 902 | continue; |
903 | atomic_inc(&state->count); | ||
904 | spin_unlock(&sp->so_lock); | ||
901 | status = ops->recover_open(sp, state); | 905 | status = ops->recover_open(sp, state); |
902 | if (status >= 0) { | 906 | if (status >= 0) { |
903 | status = nfs4_reclaim_locks(state, ops); | 907 | status = nfs4_reclaim_locks(state, ops); |
@@ -907,7 +911,8 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs | |||
907 | printk("%s: Lock reclaim failed!\n", | 911 | printk("%s: Lock reclaim failed!\n", |
908 | __func__); | 912 | __func__); |
909 | } | 913 | } |
910 | continue; | 914 | nfs4_put_open_state(state); |
915 | goto restart; | ||
911 | } | 916 | } |
912 | } | 917 | } |
913 | switch (status) { | 918 | switch (status) { |
@@ -935,9 +940,13 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs | |||
935 | case -NFS4ERR_STALE_CLIENTID: | 940 | case -NFS4ERR_STALE_CLIENTID: |
936 | goto out_err; | 941 | goto out_err; |
937 | } | 942 | } |
943 | nfs4_put_open_state(state); | ||
944 | goto restart; | ||
938 | } | 945 | } |
946 | spin_unlock(&sp->so_lock); | ||
939 | return 0; | 947 | return 0; |
940 | out_err: | 948 | out_err: |
949 | nfs4_put_open_state(state); | ||
941 | return status; | 950 | return status; |
942 | } | 951 | } |
943 | 952 | ||