Skip to content

Commit 8c3e204

Browse files
Trond Myklebustgregkh
authored andcommitted
NFSv4: Fix a regression in nfs_set_open_stateid_locked()
[ Upstream commit 01d29f8 ] If we already hold open state on the client, yet the server gives us a completely different stateid to the one we already hold, then we currently treat it as if it were an out-of-sequence update, and wait for 5 seconds for other updates to come in. This commit fixes the behaviour so that we immediately start processing of the new stateid, and then leave it to the call to nfs4_test_and_free_stateid() to decide what to do with the old stateid. Fixes: b4868b4 ("NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0afb3bc commit 8c3e204

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎fs/nfs/nfs4proc.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,15 +1590,16 @@ static bool nfs_stateid_is_sequential(struct nfs4_state *state,
15901590
{
15911591
if (test_bit(NFS_OPEN_STATE, &state->flags)) {
15921592
/* The common case - we're updating to a new sequence number */
1593-
if (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
1594-
nfs4_stateid_is_next(&state->open_stateid, stateid)) {
1595-
return true;
1593+
if (nfs4_stateid_match_other(stateid, &state->open_stateid)) {
1594+
if (nfs4_stateid_is_next(&state->open_stateid, stateid))
1595+
return true;
1596+
return false;
15961597
}
1597-
} else {
1598-
/* This is the first OPEN in this generation */
1599-
if (stateid->seqid == cpu_to_be32(1))
1600-
return true;
1598+
/* The server returned a new stateid */
16011599
}
1600+
/* This is the first OPEN in this generation */
1601+
if (stateid->seqid == cpu_to_be32(1))
1602+
return true;
16021603
return false;
16031604
}
16041605

0 commit comments

Comments
 (0)