aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index da608ee8d5ff..cc14cbb78b73 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -969,7 +969,9 @@ static int nfs4_copy_lock_stateid(nfs4_stateid *dst,
969 fl_pid = lockowner->l_pid; 969 fl_pid = lockowner->l_pid;
970 spin_lock(&state->state_lock); 970 spin_lock(&state->state_lock);
971 lsp = __nfs4_find_lock_state(state, fl_owner, fl_pid, NFS4_ANY_LOCK_TYPE); 971 lsp = __nfs4_find_lock_state(state, fl_owner, fl_pid, NFS4_ANY_LOCK_TYPE);
972 if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) { 972 if (lsp && test_bit(NFS_LOCK_LOST, &lsp->ls_flags))
973 ret = -EIO;
974 else if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) {
973 nfs4_stateid_copy(dst, &lsp->ls_stateid); 975 nfs4_stateid_copy(dst, &lsp->ls_stateid);
974 ret = 0; 976 ret = 0;
975 smp_rmb(); 977 smp_rmb();
@@ -1009,11 +1011,17 @@ static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state)
1009int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, 1011int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,
1010 fmode_t fmode, const struct nfs_lockowner *lockowner) 1012 fmode_t fmode, const struct nfs_lockowner *lockowner)
1011{ 1013{
1012 int ret = 0; 1014 int ret = nfs4_copy_lock_stateid(dst, state, lockowner);
1015 if (ret == -EIO)
1016 /* A lost lock - don't even consider delegations */
1017 goto out;
1013 if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) 1018 if (nfs4_copy_delegation_stateid(dst, state->inode, fmode))
1014 goto out; 1019 goto out;
1015 ret = nfs4_copy_lock_stateid(dst, state, lockowner);
1016 if (ret != -ENOENT) 1020 if (ret != -ENOENT)
1021 /* nfs4_copy_delegation_stateid() didn't over-write
1022 * dst, so it still has the lock stateid which we now
1023 * choose to use.
1024 */
1017 goto out; 1025 goto out;
1018 ret = nfs4_copy_open_stateid(dst, state); 1026 ret = nfs4_copy_open_stateid(dst, state);
1019out: 1027out: