Skip to contentSkip to conversation

FAILED: patch "[PATCH] fs: cifs: Fix atime update check" failed to apply to 6.6-stable tree

PATCH [email protected] 1 participant 1 message Dec 28, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 01fe654f78fd1ea4df046ef76b07ba92a35f8dbe
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023122818-brute-scored-e2c7@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..

Possible dependencies:

01fe654f78fd ("fs: cifs: Fix atime update check") 8f22ce708883 ("client: convert to new timestamp accessors")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 01fe654f78fd1ea4df046ef76b07ba92a35f8dbe Mon Sep 17 00:00:00 2001
From: Zizhi Wo <[email protected]>
Date: Wed, 13 Dec 2023 10:23:53 +0800
Subject: [PATCH] fs: cifs: Fix atime update check

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")
fs/smb/client/file.c +1 -1
index cf17e3dd703e..32a8525415d9 100644
@@ -4671,7 +4671,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
 	/* we do not want atime to be less than mtime, it broke some apps */
 	atime = inode_set_atime_to_ts(inode, current_time(inode));
 	mtime = 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));
 
 	if (PAGE_SIZE > rc)