diff options
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index e5be72518bd7..0deb32105ccf 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -974,9 +974,6 @@ static int nfs4_copy_lock_stateid(nfs4_stateid *dst, | |||
974 | else if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) { | 974 | else if (lsp != NULL && test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags) != 0) { |
975 | nfs4_stateid_copy(dst, &lsp->ls_stateid); | 975 | nfs4_stateid_copy(dst, &lsp->ls_stateid); |
976 | ret = 0; | 976 | ret = 0; |
977 | smp_rmb(); | ||
978 | if (!list_empty(&lsp->ls_seqid.list)) | ||
979 | ret = -EWOULDBLOCK; | ||
980 | } | 977 | } |
981 | spin_unlock(&state->state_lock); | 978 | spin_unlock(&state->state_lock); |
982 | nfs4_put_lock_state(lsp); | 979 | nfs4_put_lock_state(lsp); |
@@ -984,10 +981,9 @@ out: | |||
984 | return ret; | 981 | return ret; |
985 | } | 982 | } |
986 | 983 | ||
987 | static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | 984 | static void nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) |
988 | { | 985 | { |
989 | const nfs4_stateid *src; | 986 | const nfs4_stateid *src; |
990 | int ret; | ||
991 | int seq; | 987 | int seq; |
992 | 988 | ||
993 | do { | 989 | do { |
@@ -996,12 +992,7 @@ static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | |||
996 | if (test_bit(NFS_OPEN_STATE, &state->flags)) | 992 | if (test_bit(NFS_OPEN_STATE, &state->flags)) |
997 | src = &state->open_stateid; | 993 | src = &state->open_stateid; |
998 | nfs4_stateid_copy(dst, src); | 994 | nfs4_stateid_copy(dst, src); |
999 | ret = 0; | ||
1000 | smp_rmb(); | ||
1001 | if (!list_empty(&state->owner->so_seqid.list)) | ||
1002 | ret = -EWOULDBLOCK; | ||
1003 | } while (read_seqretry(&state->seqlock, seq)); | 995 | } while (read_seqretry(&state->seqlock, seq)); |
1004 | return ret; | ||
1005 | } | 996 | } |
1006 | 997 | ||
1007 | /* | 998 | /* |
@@ -1015,15 +1006,19 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state, | |||
1015 | if (ret == -EIO) | 1006 | if (ret == -EIO) |
1016 | /* A lost lock - don't even consider delegations */ | 1007 | /* A lost lock - don't even consider delegations */ |
1017 | goto out; | 1008 | goto out; |
1018 | if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) | 1009 | /* returns true if delegation stateid found and copied */ |
1010 | if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) { | ||
1011 | ret = 0; | ||
1019 | goto out; | 1012 | goto out; |
1013 | } | ||
1020 | if (ret != -ENOENT) | 1014 | if (ret != -ENOENT) |
1021 | /* nfs4_copy_delegation_stateid() didn't over-write | 1015 | /* nfs4_copy_delegation_stateid() didn't over-write |
1022 | * dst, so it still has the lock stateid which we now | 1016 | * dst, so it still has the lock stateid which we now |
1023 | * choose to use. | 1017 | * choose to use. |
1024 | */ | 1018 | */ |
1025 | goto out; | 1019 | goto out; |
1026 | ret = nfs4_copy_open_stateid(dst, state); | 1020 | nfs4_copy_open_stateid(dst, state); |
1021 | ret = 0; | ||
1027 | out: | 1022 | out: |
1028 | if (nfs_server_capable(state->inode, NFS_CAP_STATEID_NFSV41)) | 1023 | if (nfs_server_capable(state->inode, NFS_CAP_STATEID_NFSV41)) |
1029 | dst->seqid = 0; | 1024 | dst->seqid = 0; |