summaryrefslogtreecommitdiff
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2018-09-22 12:07:06 -0500
committerSteve French <stfrench@microsoft.com>2018-10-23 21:16:05 -0500
commit9b9c5bea0b960616d638711d0ecc270c3a074e7f (patch)
treeae8b0d2c9121e9a368530f6e8d11c4eb0b3dc68d /fs/cifs/inode.c
parent3d621230b8a0c6616f32b86ec3f0bc3ead9eb5b8 (diff)
downloadlinux-rpi-9b9c5bea0b960616d638711d0ecc270c3a074e7f.tar.gz
linux-rpi-9b9c5bea0b960616d638711d0ecc270c3a074e7f.tar.bz2
linux-rpi-9b9c5bea0b960616d638711d0ecc270c3a074e7f.zip
cifs: do not return atime less than mtime
In network file system it is fairly easy for server and client atime vs. mtime to get confused (and atime updated less frequently) which we noticed broke some apps which expect atime >= mtime Also ignore relatime mount option (rather than error on it) since relatime is basically what some network server fs are doing (relatime). Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 6e8765f44508..0945d40030eb 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -162,7 +162,11 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
cifs_revalidate_cache(inode, fattr);
spin_lock(&inode->i_lock);
- inode->i_atime = fattr->cf_atime;
+ /* we do not want atime to be less than mtime, it broke some apps */
+ if (timespec64_compare(&fattr->cf_atime, &fattr->cf_mtime))
+ inode->i_atime = fattr->cf_mtime;
+ else
+ inode->i_atime = fattr->cf_atime;
inode->i_mtime = fattr->cf_mtime;
inode->i_ctime = fattr->cf_ctime;
inode->i_rdev = fattr->cf_rdev;