提交 4789cba9 编写于 作者: T Trond Myklebust 提交者: Zheng Zengkai

NFSv4: Fix a regression in nfs_set_open_stateid_locked()

stable inclusion
from stable-5.10.80
commit 8c3e204fb6bc035aa18188eaef069bb0c2480d9a
bugzilla: 185821 https://gitee.com/openeuler/kernel/issues/I4L7CG

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8c3e204fb6bc035aa18188eaef069bb0c2480d9a

--------------------------------

[ Upstream commit 01d29f87 ]

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: b4868b44 ("NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE")
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 0ca68b62
......@@ -1590,15 +1590,16 @@ static bool nfs_stateid_is_sequential(struct nfs4_state *state,
{
if (test_bit(NFS_OPEN_STATE, &state->flags)) {
/* The common case - we're updating to a new sequence number */
if (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
nfs4_stateid_is_next(&state->open_stateid, stateid)) {
return true;
if (nfs4_stateid_match_other(stateid, &state->open_stateid)) {
if (nfs4_stateid_is_next(&state->open_stateid, stateid))
return true;
return false;
}
} else {
/* This is the first OPEN in this generation */
if (stateid->seqid == cpu_to_be32(1))
return true;
/* The server returned a new stateid */
}
/* This is the first OPEN in this generation */
if (stateid->seqid == cpu_to_be32(1))
return true;
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册