Skip to content

Commit 9a49874

Browse files
Zizhi Wogregkh
authored andcommitted
fs: cifs: Fix atime update check
[ Upstream commit 01fe654 ] Commit 9b9c5be ("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 69738cf ("fs: cifs: Fix atime update check vs mtime") fixed one place and forgot to fix another. Fix it. Fixes: 9b9c5be ("cifs: do not return atime less than mtime") Cc: stable@vger.kernel.org Signed-off-by: Zizhi Wo <wozizhi@huawei.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 23171df commit 9a49874

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/smb/client/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4671,7 +4671,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
46714671
/* we do not want atime to be less than mtime, it broke some apps */
46724672
atime = inode_set_atime_to_ts(inode, current_time(inode));
46734673
mtime = inode_get_mtime(inode);
4674-
if (timespec64_compare(&atime, &mtime))
4674+
if (timespec64_compare(&atime, &mtime) < 0)
46754675
inode_set_atime_to_ts(inode, inode_get_mtime(inode));
46764676

46774677
if (PAGE_SIZE > rc)

0 commit comments

Comments
 (0)