diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-20 01:25:45 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-20 01:39:42 -0400 |
commit | 92b40e93849e29f9ca661de6442bb66282738bf7 (patch) | |
tree | 3809ff1f036c1ecbdf7fd265046e49fdefe8eb68 /fs/nfs/nfs4state.c | |
parent | 042ad0b398ea4e937e38324dd096bdf9d2c495f7 (diff) |
NFSv4: Use the open stateid if the delegation has the wrong mode
Fix nfs4_select_rw_stateid() so that it chooses the open stateid
(or an all-zero stateid) if the delegation does not match the selected
read/write mode.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 1eb17285c99a..b7796950eceb 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1024,12 +1024,16 @@ out: | |||
1024 | 1024 | ||
1025 | static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) | 1025 | static int nfs4_copy_open_stateid(nfs4_stateid *dst, struct nfs4_state *state) |
1026 | { | 1026 | { |
1027 | const nfs4_stateid *src; | ||
1027 | int ret; | 1028 | int ret; |
1028 | int seq; | 1029 | int seq; |
1029 | 1030 | ||
1030 | do { | 1031 | do { |
1032 | src = &zero_stateid; | ||
1031 | seq = read_seqbegin(&state->seqlock); | 1033 | seq = read_seqbegin(&state->seqlock); |
1032 | nfs4_stateid_copy(dst, &state->stateid); | 1034 | if (test_bit(NFS_OPEN_STATE, &state->flags)) |
1035 | src = &state->open_stateid; | ||
1036 | nfs4_stateid_copy(dst, src); | ||
1033 | ret = 0; | 1037 | ret = 0; |
1034 | smp_rmb(); | 1038 | smp_rmb(); |
1035 | if (!list_empty(&state->owner->so_seqid.list)) | 1039 | if (!list_empty(&state->owner->so_seqid.list)) |