Skip to content

Commit

Permalink
NFSv4: We must set NFS_OPEN_STATE flag in nfs_resync_open_stateid_locked
Browse files Browse the repository at this point in the history
Otherwise, nfs4_select_rw_stateid() will always return the zero stateid
instead of the correct open stateid.

Fixes: f95549c ("NFSv4: More CLOSE/OPEN races")
Cc: stable@vger.kernel.org # 4.0+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Trond Myklebust committed Jul 22, 2015
1 parent 1980bd4 commit 3c38cbe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1200,12 +1200,15 @@ static bool nfs_need_update_open_stateid(struct nfs4_state *state,

static void nfs_resync_open_stateid_locked(struct nfs4_state *state)
{
if (!(state->n_wronly || state->n_rdonly || state->n_rdwr))
return;
if (state->n_wronly)
set_bit(NFS_O_WRONLY_STATE, &state->flags);
if (state->n_rdonly)
set_bit(NFS_O_RDONLY_STATE, &state->flags);
if (state->n_rdwr)
set_bit(NFS_O_RDWR_STATE, &state->flags);
set_bit(NFS_OPEN_STATE, &state->flags);
}

static void nfs_clear_open_stateid_locked(struct nfs4_state *state,
Expand Down

0 comments on commit 3c38cbe

Please sign in to comment.