]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: flush before set-info if we have writeable handles
authorRonnie Sahlberg <lsahlber@redhat.com>
Thu, 18 Jul 2019 22:12:11 +0000 (08:12 +1000)
committerSteve French <stfrench@microsoft.com>
Thu, 18 Jul 2019 22:46:23 +0000 (17:46 -0500)
commita51397eb7cad015398c56750f68061a92b9a69fe
treef4cf08099df1b5d188d012dad9c9f61f590e8fcb
parent4837290bc3c5c46d3377c2ae98c09594829c5eb7
cifs: flush before set-info if we have writeable handles

Servers can defer destaging any data and updating the mtime until close().
This means that if we do a setinfo to modify the mtime while other handles
are open for write the server may overwrite our setinfo timestamps when
if flushes the file on close() of the writeable handle.

To solve this we add an explicit flush when the mtime is about to
be updated.

This fixes "cp -p" to preserve mtime when copying a file onto an SMB2 share.

CC: Stable <stable@vger.kernel.org>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/inode.c