Commit 7aebdda
Ronnie Sahlberg
cifs: Fix race between hole punch and page fault
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2218388
commit b092b3e
Cifs has a following race between hole punching and page fault:
CPU1 CPU2
smb3_fallocate()
smb3_punch_hole()
truncate_pagecache_range()
filemap_fault()
- loads old data into the
page cache
SMB2_ioctl(..., FSCTL_SET_ZERO_DATA, ...)
And now we have stale data in the page cache. Fix the problem by locking
out faults (as well as reads) using mapping->invalidate_lock while hole
punch is running.
CC: Steve French <sfrench@samba.org>
CC: linux-cifs@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
(cherry picked from commit b092b3e)
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>1 parent 9df3f49 commit 7aebdda
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3405 | 3405 | | |
3406 | 3406 | | |
3407 | 3407 | | |
| 3408 | + | |
3408 | 3409 | | |
3409 | 3410 | | |
3410 | 3411 | | |
| |||
3422 | 3423 | | |
3423 | 3424 | | |
3424 | 3425 | | |
| 3426 | + | |
3425 | 3427 | | |
3426 | 3428 | | |
3427 | 3429 | | |
| |||
0 commit comments