diff options
| author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-07-22 13:46:13 -0400 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-07-22 17:10:51 -0400 |
| commit | 3c38cbe2ade88240fabb585b408f779ad3b9a31b (patch) | |
| tree | 8d7c93a04f8d888ecd37913f9806e61367594efe | |
| parent | 1980bd4d829a87ccd21b949f8a11ff1b426f5b0b (diff) | |
NFSv4: We must set NFS_OPEN_STATE flag in nfs_resync_open_stateid_locked
Otherwise, nfs4_select_rw_stateid() will always return the zero stateid
instead of the correct open stateid.
Fixes: f95549cf24660 ("NFSv4: More CLOSE/OPEN races")
Cc: stable@vger.kernel.org # 4.0+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
| -rw-r--r-- | fs/nfs/nfs4proc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c5c9e0d070f8..9264994ec9d3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -1200,12 +1200,15 @@ static bool nfs_need_update_open_stateid(struct nfs4_state *state, | |||
| 1200 | 1200 | ||
| 1201 | static void nfs_resync_open_stateid_locked(struct nfs4_state *state) | 1201 | static void nfs_resync_open_stateid_locked(struct nfs4_state *state) |
| 1202 | { | 1202 | { |
| 1203 | if (!(state->n_wronly || state->n_rdonly || state->n_rdwr)) | ||
| 1204 | return; | ||
| 1203 | if (state->n_wronly) | 1205 | if (state->n_wronly) |
| 1204 | set_bit(NFS_O_WRONLY_STATE, &state->flags); | 1206 | set_bit(NFS_O_WRONLY_STATE, &state->flags); |
| 1205 | if (state->n_rdonly) | 1207 | if (state->n_rdonly) |
| 1206 | set_bit(NFS_O_RDONLY_STATE, &state->flags); | 1208 | set_bit(NFS_O_RDONLY_STATE, &state->flags); |
| 1207 | if (state->n_rdwr) | 1209 | if (state->n_rdwr) |
| 1208 | set_bit(NFS_O_RDWR_STATE, &state->flags); | 1210 | set_bit(NFS_O_RDWR_STATE, &state->flags); |
| 1211 | set_bit(NFS_OPEN_STATE, &state->flags); | ||
| 1209 | } | 1212 | } |
| 1210 | 1213 | ||
| 1211 | static void nfs_clear_open_stateid_locked(struct nfs4_state *state, | 1214 | static void nfs_clear_open_stateid_locked(struct nfs4_state *state, |
