Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: cifs: Fix atime update check vs mtime

According to the comment in the code and commit log, some apps
expect atime >= mtime; but the introduced code results in
atime==mtime. Fix the comparison to guard against atime<mtime.

Fixes: 9b9c5bea0b96 ("cifs: do not return atime less than mtime")
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: stfrench@microsoft.com
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Deepa Dinamani and committed by
Steve French
69738cfd 6f582b27

+1 -1
+1 -1
fs/cifs/inode.c
··· 163 163 164 164 spin_lock(&inode->i_lock); 165 165 /* we do not want atime to be less than mtime, it broke some apps */ 166 - if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime)) 166 + if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime) < 0) 167 167 inode->i_atime = fattr->cf_mtime; 168 168 else 169 169 inode->i_atime = fattr->cf_atime;