From nobody Sun Oct 5 16:16:35 2025 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93DFE14F70; Fri, 1 Aug 2025 09:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754039252; cv=none; b=RZ9LBwbpWnnTJZsKsI1j2TrCVfQHS1MGYvjvIrHhGNxjQPlqllJzjD58Z9XkXtWwHn3LCdw9qYmFnO3AySnBXkKENJnuj/Mal0QJgkYZPQxCQRW3CMYmx23oZVCNhhKAJUneJLH5NH8e5N7ksZ76PqV5YSst6zGZt+B14ZtoaR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754039252; c=relaxed/simple; bh=6kH5hpBK3BqudgNK5gLKix3xcuwxXKQ8NOriPF9uX+I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LlzGHv+Vb63bu+Fv5mwJpujJLIECBDGhmkSdffSGJPubcd+mcADP4rL8EGnlQJYEelDpBKfSnKSQgDEnSQrE1box8qVGI2V2dbvJJIwsOmsqYM4q+TpV1kVYHfTTWVWX+4F/4xDDXOtqTe9R1Q4ZPqjsJV28GvKjd8qtV6/6jBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4btg7z659HzKHLv3; Fri, 1 Aug 2025 17:07:27 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id C1D431A0EC1; Fri, 1 Aug 2025 17:07:26 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.170]) by APP4 (Coremail) with SMTP id gCh0CgDXUxTMg4xoAyvJCA--.63351S4; Fri, 01 Aug 2025 17:07:26 +0800 (CST) From: Wang Zhaolong To: sfrench@samba.org, wangzhaolong@huaweicloud.com Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, chengzhihao1@huawei.com Subject: [PATCH -next] smb: client: remove redundant lstrp update in negotiate protocol Date: Fri, 1 Aug 2025 17:07:24 +0800 Message-Id: <20250801090724.2903515-1-wangzhaolong@huaweicloud.com> X-Mailer: git-send-email 2.34.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: gCh0CgDXUxTMg4xoAyvJCA--.63351S4 X-Coremail-Antispam: 1UD129KBjvJXoW7WF17Xw1UJrW8ZF48ZFWrZrb_yoW8urWDpF W2k34fKFs5t345CanrJa4kua4UZ34DCw1UGrn7Jr12q3s8tFyjkFsFk3ykWF48CFykX345 tr4qv3yYva4UAaUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkC14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7CjxVAaw2AFwI0_ Jw0_GFyl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67 AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIY rxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14 v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8 JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUonmRUU UUU X-CM-SenderInfo: pzdqw6xkdrz0tqj6x35dzhxuhorxvhhfrp/ Content-Type: text/plain; charset="utf-8" Commit 34331d7beed7 ("smb: client: fix first command failure during re-negotiation") addressed a race condition by updating lstrp before entering negotiate state. However, this approach may have some unintended side effects. The lstrp field is documented as "when we got last response from this server", and updating it before actually receiving a server response could potentially affect other mechanisms that rely on this timestamp. For example, the SMB echo detection logic also uses lstrp as a reference point. In scenarios with frequent user operations during reconnect states, the repeated calls to cifs_negotiate_protocol() might continuously update lstrp, which could interfere with the echo detection timing. Additionally, commit 266b5d02e14f ("smb: client: fix race condition in negotiate timeout by using more precise timing") introduced a dedicated neg_start field specifically for tracking negotiate start time. This provides a more precise solution for the original race condition while preserving the intended semantics of lstrp. Since the race condition is now properly handled by the neg_start mechanism, the lstrp update in cifs_negotiate_protocol() is no longer necessary and can be safely removed. Fixes: 266b5d02e14f ("smb: client: fix race condition in negotiate timeout = by using more precise timing") Cc: stable@vger.kernel.org Signed-off-by: Wang Zhaolong --- fs/smb/client/connect.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 205f547ca49e..a2c49683be66 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -4205,11 +4205,10 @@ cifs_negotiate_protocol(const unsigned int xid, str= uct cifs_ses *ses, server->tcpStatus =3D=3D CifsGood) { spin_unlock(&server->srv_lock); return 0; } =20 - server->lstrp =3D jiffies; server->tcpStatus =3D CifsInNegotiate; server->neg_start =3D jiffies; spin_unlock(&server->srv_lock); =20 rc =3D server->ops->negotiate(xid, ses, server); --=20 2.34.3