summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2019-11-30 08:30:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-09 12:20:05 +0300
commit52788b4af1b6379541b8d2b3a4e3d20c275cc42a (patch)
tree1a462b23ea5dd932622a5661dea1b3874261bf7a
parent42692a61ab19151159b62887136039840b53f923 (diff)
downloadlinux-52788b4af1b6379541b8d2b3a4e3d20c275cc42a.tar.xz
fs: cifs: Fix atime update check vs mtime
commit 69738cfdfa7032f45d9e7462d24490e61cf163dd upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/cifs/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index df9377828e2f..ed59e4a8db59 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -163,7 +163,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
spin_lock(&inode->i_lock);
/* we do not want atime to be less than mtime, it broke some apps */
- if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime))
+ if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime) < 0)
inode->i_atime = fattr->cf_mtime;
else
inode->i_atime = fattr->cf_atime;