aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2022-09-12 13:04:46 +1000
committerSteve French <stfrench@microsoft.com>2022-09-12 13:24:08 -0500
commit7500a99281dfed2d4a84771c933bcb9e17af279b (patch)
tree5e3b83a20f65689d97e3bf2d2867ab0631767a35 /fs/cifs
parentLinux 6.0-rc5 (diff)
downloadlinux-dev-7500a99281dfed2d4a84771c933bcb9e17af279b.tar.xz
linux-dev-7500a99281dfed2d4a84771c933bcb9e17af279b.zip
cifs: revalidate mapping when doing direct writes
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>
Diffstat (limited to 'fs/cifs')
-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 fa738adc031f..6f38b134a346 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3575,6 +3575,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);
}