Skip to content

Commit

Permalink
cifs: revalidate mapping when doing direct writes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ronnie Sahlberg authored and Steve French committed Sep 12, 2022
1 parent 80e78fc commit 7500a99
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7500a99

Please sign in to comment.