diff options
author | Steve French <stfrench@microsoft.com> | 2018-09-22 20:07:06 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2018-10-24 05:16:05 +0300 |
commit | 9b9c5bea0b960616d638711d0ecc270c3a074e7f (patch) | |
tree | ae8b0d2c9121e9a368530f6e8d11c4eb0b3dc68d /fs/cifs/file.c | |
parent | 3d621230b8a0c6616f32b86ec3f0bc3ead9eb5b8 (diff) | |
download | linux-9b9c5bea0b960616d638711d0ecc270c3a074e7f.tar.xz |
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/file.c')
-rw-r--r-- | fs/cifs/file.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8d41ca7bfcf1..fa723e7a08d7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3889,8 +3889,12 @@ static int cifs_readpage_worker(struct file *file, struct page *page, else cifs_dbg(FYI, "Bytes read %d\n", rc); - file_inode(file)->i_atime = - current_time(file_inode(file)); + /* we do not want atime to be less than mtime, it broke some apps */ + file_inode(file)->i_atime = current_time(file_inode(file)); + if (timespec64_compare(&(file_inode(file)->i_atime), &(file_inode(file)->i_mtime))) + file_inode(file)->i_atime = file_inode(file)->i_mtime; + else + file_inode(file)->i_atime = current_time(file_inode(file)); if (PAGE_SIZE > rc) memset(read_data + rc, 0, PAGE_SIZE - rc); |