summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2022-09-12 06:04:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-23 15:16:58 +0300
commitf3fbd08e7ca36e4b43a257d55e99258f8b67b156 (patch)
treef84fa1abcd73609f5340dbefb8d8616edba67b22 /fs
parenta9398cb81cdc8464a308e7022d791d99dbf6480a (diff)
downloadlinux-f3fbd08e7ca36e4b43a257d55e99258f8b67b156.tar.xz
cifs: revalidate mapping when doing direct writes
commit 7500a99281dfed2d4a84771c933bcb9e17af279b upstream. Kernel bugzilla: 216301 When doing direct writes we need to also invalidate the mapping in case we have a cached copy of the affected page(s) in memory or else subsequent reads of the data might return the old/stale content before we wrote an update to the server. Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 6c06870f9018..fafb69d338c2 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3244,6 +3244,9 @@ static ssize_t __cifs_writev(
ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from)
{
+ struct file *file = iocb->ki_filp;
+
+ cifs_revalidate_mapping(file->f_inode);
return __cifs_writev(iocb, from, true);
}