Skip to contentSkip to conversation

Hole punch vs page cache filling races fixes for 5.15-rc1

GIT PULL Merged Jan Kara 2 participants 2 messages Aug 25, 2021 – Aug 30, 2021

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

Hello Linus,

this is the last early pull request for the coming merge window. Could you
please pull from

git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git hole_punch_for_v5.15-rc1

to get patches that fix races leading to possible data corruption or stale data exposure in multiple filesystems when hole punching races with operations such as readahead. This is the series I was sending for the last merge window but with your objection fixed - now filemap_fault() has been modified to take invalidate_lock only when we need to create new page in the page cache and / or bring it uptodate (see updated commit 730633f0b7f "mm: Protect operations adding pages to page cache with invalidate_lock").

There are some conflicts of this series with changes in f2fs and folio trees. The resolution is mostly obvious but I've pushed out suggested merge (taken from Stephen Rothwell) to:

git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git hole_punch_fixes_merge

Top of the tree is 7882c55ef64a. The full shortlog is:

Jan Kara (13):
mm: Fix comments mentioning i_mutex
documentation: Sync file_operations members with reality
mm: Protect operations adding pages to page cache with invalidate_lock
mm: Add functions to lock invalidate_lock for two mappings
ext4: Convert to use mapping->invalidate_lock
ext2: Convert to using invalidate_lock
xfs: Convert to use invalidate_lock
xfs: Convert double locking of MMAPLOCK to use VFS helpers
zonefs: Convert to using invalidate_lock
f2fs: Convert to using invalidate_lock
fuse: Convert to using invalidate_lock
ceph: Fix race between hole punch and page fault
cifs: Fix race between hole punch and page fault

Pavel Reichl (1):
xfs: Refactor xfs_isilocked()

Randy Dunlap (1):
filesystems/locking: fix Malformed table warning

The diffstat is

 Documentation/filesystems/locking.rst |  79 ++++++++++++------
 fs/ceph/addr.c                        |   9 ++-
 fs/ceph/file.c                        |   2 +
 fs/cifs/smb2ops.c                     |   2 +
 fs/ext2/ext2.h                        |  11 ---
 fs/ext2/file.c                        |   7 +-
 fs/ext2/inode.c                       |  12 +--
 fs/ext2/super.c                       |   3 -
 fs/ext4/ext4.h                        |  10 ---
 fs/ext4/extents.c                     |  25 +++---
 fs/ext4/file.c                        |  13 +--
 fs/ext4/inode.c                       |  47 ++++-------
 fs/ext4/ioctl.c                       |   4 +-
 fs/ext4/super.c                       |  13 ++-
 fs/ext4/truncate.h                    |   8 +-
 fs/f2fs/data.c                        |   8 +-
 fs/f2fs/f2fs.h                        |   1 -
 fs/f2fs/file.c                        |  62 +++++++--------
 fs/f2fs/super.c                       |   1 -
 fs/fuse/dax.c                         |  50 ++++++------
 fs/fuse/dir.c                         |  11 +--
 fs/fuse/file.c                        |  10 +--
 fs/fuse/fuse_i.h                      |   7 --
 fs/fuse/inode.c                       |   1 -
 fs/inode.c                            |   2 +
 fs/xfs/xfs_bmap_util.c                |  15 ++--
 fs/xfs/xfs_file.c                     |  13 +--
 fs/xfs/xfs_inode.c                    | 121 ++++++++++++++--------------
 fs/xfs/xfs_inode.h                    |   3 +-
 fs/xfs/xfs_super.c                    |   2 -
 fs/zonefs/super.c                     |  23 ++----
 fs/zonefs/zonefs.h                    |   7 +-
 include/linux/fs.h                    |  39 +++++++++
 mm/filemap.c                          | 145 ++++++++++++++++++++++++++++------
 mm/madvise.c                          |   2 +-
 mm/memory-failure.c                   |   2 +-
 mm/readahead.c                        |   2 +
 mm/rmap.c                             |  41 +++++-----
 mm/shmem.c                            |  20 ++---
 mm/truncate.c                         |   9 ++-
 40 files changed, 482 insertions(+), 360 deletions(-)

Thanks
Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
merge bot Merged
#1 lore raw
The pull request you sent on Wed, 25 Aug 2021 16:51:18 +0200:

The pull request you sent on Wed, 25 Aug 2021 16:51:18 +0200:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git hole_punch_for_v5.15-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/aa99f3c2b9c797d8fee28c674a2cbb5adb2ce2ef

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html