[PATCH] cifs: invalidate and destage pages before re-reading them for cache=none

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is the opposite case of kernel bugzilla 216301.
If we mmap a file using cache=none and then proceed to update the mmapped
area these updates are not reflected in a later pread() of that part of the
file.
To fix this we must invalidate the mapping, forcing the changed pages to be
destaged to the server before we allow the pread() to proceed.

Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
---
 fs/cifs/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 6f38b134a346..31ceef22ffe4 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4314,6 +4314,9 @@ static ssize_t __cifs_readv(
 
 ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to)
 {
+	struct file *file = iocb->ki_filp;
+
+	cifs_revalidate_mapping(file->f_inode);
 	return __cifs_readv(iocb, to, true);
 }
 
-- 
2.35.3




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux