On Thu, Jul 15, 2021 at 03:40:10PM +0200, Jan Kara wrote:
> Hello,
>
> here is another version of my patches to address races between hole punching
> and page cache filling functions for ext4 and other filesystems. The only
> change since the last time is a small cleanup applied to changes of
> fi
Convert places in XFS that take MMAPLOCK for two inodes to use helper
VFS provides for it (filemap_invalidate_down_write_two()). Note that
this changes lock ordering for MMAPLOCK from inode number based ordering
to pointer based ordering VFS generally uses.
CC: "Darrick J. Wong"
Reviewed-by: Darr
Ext2 has its private dax_sem used for synchronizing page faults and
truncation. Use mapping->invalidate_lock instead as it is meant for this
purpose.
CC:
Reviewed-by: Christoph Hellwig
Signed-off-by: Jan Kara
---
fs/ext2/ext2.h | 11 ---
fs/ext2/file.c | 7 +++
fs/ext2/inode.c |
Convert ext4 to use mapping->invalidate_lock instead of its private
EXT4_I(inode)->i_mmap_sem. This is mostly search-and-replace. By this
conversion we fix a long standing race between hole punching and read(2)
/ readahead(2) paths that can lead to stale page cache contents.
CC:
CC: Ted Tso
Acke
Use invalidate_lock instead of f2fs' private i_mmap_sem. The intended
purpose is exactly the same. By this conversion we fix a long standing
race between hole punching and read(2) / readahead(2) paths that can
lead to stale page cache contents.
CC: Jaegeuk Kim
CC: Chao Yu
CC: linux-f2fs-devel@li
Use invalidate_lock instead of zonefs' private i_mmap_sem. The intended
purpose is exactly the same.
CC: Damien Le Moal
CC: Johannes Thumshirn
CC:
Acked-by: Damien Le Moal
Reviewed-by: Christoph Hellwig
Signed-off-by: Jan Kara
---
fs/zonefs/super.c | 23 +--
fs/zonefs/z
Some operations such as reflinking blocks among files will need to lock
invalidate_lock for two mappings. Add helper functions to do that.
Reviewed-by: Darrick J. Wong
Reviewed-by: Christoph Hellwig
Signed-off-by: Jan Kara
---
include/linux/fs.h | 6 ++
mm/filemap.c | 38 +++
Currently, serializing operations such as page fault, read, or readahead
against hole punching is rather difficult. The basic race scheme is
like:
fallocate(FALLOC_FL_PUNCH_HOLE) read / fault / ..
truncate_inode_pages_range()
From: Pavel Reichl
Introduce a new __xfs_rwsem_islocked predicate to encapsulate checking
the state of a rw_semaphore, then refactor xfs_isilocked to use it.
Signed-off-by: Pavel Reichl
Suggested-by: Dave Chinner
Suggested-by: Eric Sandeen
Suggested-by: Darrick J. Wong
Reviewed-by: Christoph
Use invalidate_lock instead of XFS internal i_mmap_lock. The intended
purpose of invalidate_lock is exactly the same. Note that the locking in
__xfs_filemap_fault() slightly changes as filemap_fault() already takes
invalidate_lock.
Reviewed-by: Christoph Hellwig
Reviewed-by: Darrick J. Wong
CC:
Hello,
here is another version of my patches to address races between hole punching
and page cache filling functions for ext4 and other filesystems. The only
change since the last time is a small cleanup applied to changes of
filemap_fault() in patch 3/14 based on Christoph's & Darrick's feedback
Ceph has a following race between hole punching and page fault:
CPU1 CPU2
ceph_fallocate()
...
ceph_zero_pagecache_range()
ceph_filemap_fault()
faults in page in the range being
Use invalidate_lock instead of fuse's private i_mmap_sem. The intended
purpose is exactly the same. By this conversion we fix a long standing
race between hole punching and read(2) / readahead(2) paths that can
lead to stale page cache contents.
CC: Miklos Szeredi
Reviewed-by: Miklos Szeredi
Sig
inode->i_mutex has been replaced with inode->i_rwsem long ago. Fix
comments still mentioning i_mutex.
Reviewed-by: Christoph Hellwig
Reviewed-by: Darrick J. Wong
Acked-by: Hugh Dickins
Signed-off-by: Jan Kara
---
mm/filemap.c| 10 +-
mm/madvise.c| 2 +-
mm/memory-fail
Cifs has a following race between hole punching and page fault:
CPU1CPU2
smb3_fallocate()
smb3_punch_hole()
truncate_pagecache_range()
filemap_fault()
Sync listing of struct file_operations members with the real one in
fs.h.
Reviewed-by: Darrick J. Wong
Reviewed-by: Christoph Hellwig
Signed-off-by: Jan Kara
---
Documentation/filesystems/locking.rst | 15 +--
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/Documentat
16 matches
Mail list logo