From nobody Sun Dec 28 04:40:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0935BC4332F for ; Tue, 12 Dec 2023 14:17:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376553AbjLLORN (ORCPT ); Tue, 12 Dec 2023 09:17:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbjLLORM (ORCPT ); Tue, 12 Dec 2023 09:17:12 -0500 X-Greylist: delayed 1025 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 12 Dec 2023 06:17:16 PST Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F3BAC; Tue, 12 Dec 2023 06:17:16 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4SqKxc45G4z1vnkB; Tue, 12 Dec 2023 22:00:04 +0800 (CST) Received: from dggpemm500020.china.huawei.com (unknown [7.185.36.49]) by mail.maildlp.com (Postfix) with ESMTPS id 274F91A0190; Tue, 12 Dec 2023 22:00:08 +0800 (CST) Received: from localhost.localdomain (10.175.104.67) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 12 Dec 2023 22:00:07 +0800 From: Zizhi Wo To: , CC: , , , , Subject: [PATCH -next] fs: cifs: Fix atime update check Date: Tue, 12 Dec 2023 21:58:40 +0800 Message-ID: <20231212135840.1462711-1-wozizhi@huawei.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.104.67] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500020.china.huawei.com (7.185.36.49) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Commit 9b9c5bea0b96 ("cifs: do not return atime less than mtime") indicates that in cifs, if atime is less than mtime, some apps will break. Therefore, it introduce a function to compare this two variables in two places where atime is updated. If atime is less than mtime, update it to mtime. However, the patch was handled incorrectly, resulting in atime and mtime being exactly equal. A previous commit 69738cfdfa70 ("fs: cifs: Fix atime update check vs mtime") fixed one place and forgot to fix another. Fix it. Fixes: 9b9c5bea0b96 ("cifs: do not return atime less than mtime") Signed-off-by: Zizhi Wo --- fs/smb/client/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c index cf17e3dd703e..32a8525415d9 100644 --- a/fs/smb/client/file.c +++ b/fs/smb/client/file.c @@ -4671,7 +4671,7 @@ static int cifs_readpage_worker(struct file *file, st= ruct page *page, /* we do not want atime to be less than mtime, it broke some apps */ atime =3D inode_set_atime_to_ts(inode, current_time(inode)); mtime =3D inode_get_mtime(inode); - if (timespec64_compare(&atime, &mtime)) + if (timespec64_compare(&atime, &mtime) < 0) inode_set_atime_to_ts(inode, inode_get_mtime(inode)); =20 if (PAGE_SIZE > rc) --=20 2.39.2