Re: [f2fs-dev] [PATCH] f2fs: introduce cf_name_slab cache

2021-06-07 Thread Chao Yu
On 2021/6/8 7:47, Eric Biggers wrote: On Tue, Jun 08, 2021 at 07:27:15AM +0800, Chao Yu wrote: From: Chao Yu Add a slab cache: "f2fs_casefold_name_entry" for memory allocation of casefold name. Signed-off-by: Chao Yu --- fs/f2fs/dir.c | 16 ++-- fs/f2fs/recovery.c | 6 ++

[f2fs-dev] [PATCH v2] f2fs: introduce f2fs_casefold_name slab cache

2021-06-07 Thread Chao Yu
From: Chao Yu Add a slab cache: "f2fs_casefold_name" for memory allocation of casefold name. Signed-off-by: Chao Yu --- v2: - change slab cache name to "f2fs_casefolded_name" - add a "f2fs_" prefix for slab cache variable name fs/f2fs/dir.c | 17 +++-- fs/f2fs/recovery.c | 6

Re: [f2fs-dev] [PATCH] f2fs: introduce cf_name_slab cache

2021-06-07 Thread Eric Biggers
On Tue, Jun 08, 2021 at 07:27:15AM +0800, Chao Yu wrote: > From: Chao Yu > > Add a slab cache: "f2fs_casefold_name_entry" for memory allocation > of casefold name. > > Signed-off-by: Chao Yu > --- > fs/f2fs/dir.c | 16 ++-- > fs/f2fs/recovery.c | 6 +- > fs/f2fs/super.c

Re: [f2fs-dev] [PATCH v2 RFC] f2fs: fix to force keeping write barrier for strict fsync mode

2021-06-07 Thread Chao Yu
Still no time to check this? Thanks, On 2021/6/4 0:00, Chao Yu wrote: Jaegeuk, Any comments on this patch? On 2021/6/1 18:10, Chao Yu wrote: [1] https://www.mail-archive.com/linux-f2fs-devel@lists.sourceforge.net/msg15126.html As [1] reported, if lower device doesn't support write barrier,

[f2fs-dev] [PATCH] f2fs: fix to avoid adding tab before doc section

2021-06-07 Thread Chao Yu
From: Chao Yu Otherwise whole section after tab will be invisible in compiled html format document. Cc: Mauro Carvalho Chehab Fixes: 89272ca1102e ("docs: filesystems: convert f2fs.txt to ReST") Signed-off-by: Chao Yu --- Documentation/filesystems/f2fs.rst | 16 1 file changed

[f2fs-dev] [PATCH] f2fs: introduce cf_name_slab cache

2021-06-07 Thread Chao Yu
From: Chao Yu Add a slab cache: "f2fs_casefold_name_entry" for memory allocation of casefold name. Signed-off-by: Chao Yu --- fs/f2fs/dir.c | 16 ++-- fs/f2fs/recovery.c | 6 +- fs/f2fs/super.c| 24 3 files changed, 39 insertions(+), 7 deletio

Re: [f2fs-dev] [PATCH 2/2] f2fs: introduce FI_COMPRESS_RELEASED instead of using IMMUTABLE bit

2021-06-07 Thread Chao Yu
On 2021/6/8 0:56, Jaegeuk Kim wrote: On 06/06, Chao Yu wrote: On 2021/5/26 4:49, Jaegeuk Kim wrote: Once we release compressed blocks, we used to set IMMUTABLE bit. But it turned out it disallows every fs operations which we don't need for compression. Let's just prevent writing data only. Si

Re: [f2fs-dev] [PATCH] sload.f2fs: use F2FS_COMPRESS_RELEASED instead of IMMUTABLE bit

2021-06-07 Thread Chao Yu
On 2021/6/8 0:52, Jaegeuk Kim wrote: On 06/06, Chao Yu wrote: On 2021/5/26 4:51, Jaegeuk Kim wrote: Let's use F2FS_COMPRESS_RELEASED to disallow writes only. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Too late, as I published it in master. Oops, sorry for the delay. So does the p

Re: [f2fs-dev] [PATCH 1/2] f2fs: swap: remove dead codes

2021-06-07 Thread Chao Yu
On 2021/6/8 0:47, Jaegeuk Kim wrote: On 06/07, Chao Yu wrote: On 2021/6/5 7:51, Jaegeuk Kim wrote: On 06/04, Chao Yu wrote: On 2021/5/27 10:12, Chao Yu wrote: On 2021/5/27 9:40, Jaegeuk Kim wrote: On 05/26, Chao Yu wrote: On 2021/5/26 21:30, Jaegeuk Kim wrote: On 05/26, Chao Yu wrote: Aft

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: clean up /sys/fs/f2fs//features

2021-06-07 Thread Jaegeuk Kim
On 06/07, Chao Yu wrote: > On 2021/6/6 13:36, Jaegeuk Kim wrote: > > Let's create /sys/fs/f2fs//feature_list/ to meet sysfs rule. > > > > Note that there are three feature list entries: > > 1) /sys/fs/f2fs/features > >: shows runtime features supported by in-kernel f2fs along with Kconfig. > >

Re: [f2fs-dev] [PATCH 2/2] f2fs: introduce FI_COMPRESS_RELEASED instead of using IMMUTABLE bit

2021-06-07 Thread Jaegeuk Kim
On 06/06, Chao Yu wrote: > On 2021/5/26 4:49, Jaegeuk Kim wrote: > > Once we release compressed blocks, we used to set IMMUTABLE bit. But it > > turned > > out it disallows every fs operations which we don't need for compression. > > > > Let's just prevent writing data only. > > > > Signed-off-b

Re: [f2fs-dev] [PATCH] sload.f2fs: use F2FS_COMPRESS_RELEASED instead of IMMUTABLE bit

2021-06-07 Thread Jaegeuk Kim
On 06/06, Chao Yu wrote: > On 2021/5/26 4:51, Jaegeuk Kim wrote: > > Let's use F2FS_COMPRESS_RELEASED to disallow writes only. > > > > Signed-off-by: Jaegeuk Kim > > Reviewed-by: Chao Yu Too late, as I published it in master. > > Thanks, ___ Linu

Re: [f2fs-dev] [PATCH 1/2] f2fs: swap: remove dead codes

2021-06-07 Thread Jaegeuk Kim
On 06/07, Chao Yu wrote: > On 2021/6/5 7:51, Jaegeuk Kim wrote: > > On 06/04, Chao Yu wrote: > > > On 2021/5/27 10:12, Chao Yu wrote: > > > > On 2021/5/27 9:40, Jaegeuk Kim wrote: > > > > > On 05/26, Chao Yu wrote: > > > > > > On 2021/5/26 21:30, Jaegeuk Kim wrote: > > > > > > > On 05/26, Chao Yu w

Re: [f2fs-dev] [PATCH 03/14] mm: Protect operations adding pages to page cache with invalidate_lock

2021-06-07 Thread Darrick J. Wong
On Mon, Jun 07, 2021 at 04:52:13PM +0200, Jan Kara wrote: > 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 / .. > truncat

Re: [f2fs-dev] [PATCH 09/14] xfs: Convert double locking of MMAPLOCK to use VFS helpers

2021-06-07 Thread Darrick J. Wong
On Mon, Jun 07, 2021 at 04:52:19PM +0200, Jan Kara wrote: > 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 orde

Re: [f2fs-dev] [PATCH 08/14] xfs: Convert to use invalidate_lock

2021-06-07 Thread Darrick J. Wong
On Mon, Jun 07, 2021 at 04:52:18PM +0200, Jan Kara wrote: > 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. >

Re: [f2fs-dev] [PATCH 07/14] xfs: Refactor xfs_isilocked()

2021-06-07 Thread Darrick J. Wong
On Mon, Jun 07, 2021 at 04:52:17PM +0200, Jan Kara wrote: > From: Pavel Reichl > > Refactor xfs_isilocked() to use newly introduced __xfs_rwsem_islocked(). > __xfs_rwsem_islocked() is a helper function which encapsulates checking > state of rw_semaphores hold by inode. > > Signed-off-by: Pavel R

Re: [f2fs-dev] [PATCH 04/14] mm: Add functions to lock invalidate_lock for two mappings

2021-06-07 Thread Darrick J. Wong
On Mon, Jun 07, 2021 at 04:52:14PM +0200, Jan Kara wrote: > Some operations such as reflinking blocks among files will need to lock > invalidate_lock for two mappings. Add helper functions to do that. > > Signed-off-by: Jan Kara Straightforward lift from xfs, though now with vfs lock ordering ru

Re: [f2fs-dev] [PATCH 01/14] mm: Fix comments mentioning i_mutex

2021-06-07 Thread Darrick J. Wong
On Mon, Jun 07, 2021 at 04:52:11PM +0200, Jan Kara wrote: > inode->i_mutex has been replaced with inode->i_rwsem long ago. Fix > comments still mentioning i_mutex. > > Reviewed-by: Christoph Hellwig > Acked-by: Hugh Dickins > Signed-off-by: Jan Kara Looks good to me, Reviewed-by: Darrick J. Wo

Re: [f2fs-dev] [PATCH 1/2] f2fs: swap: remove dead codes

2021-06-07 Thread Chao Yu
On 2021/6/5 7:51, Jaegeuk Kim wrote: On 06/04, Chao Yu wrote: On 2021/5/27 10:12, Chao Yu wrote: On 2021/5/27 9:40, Jaegeuk Kim wrote: On 05/26, Chao Yu wrote: On 2021/5/26 21:30, Jaegeuk Kim wrote: On 05/26, Chao Yu wrote: After commit af4b6b8edf6a ("f2fs: introduce check_swap_activate_fas

[f2fs-dev] [PATCH 03/14] mm: Protect operations adding pages to page cache with invalidate_lock

2021-06-07 Thread Jan Kara
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()

[f2fs-dev] [PATCH 07/14] xfs: Refactor xfs_isilocked()

2021-06-07 Thread Jan Kara
From: Pavel Reichl Refactor xfs_isilocked() to use newly introduced __xfs_rwsem_islocked(). __xfs_rwsem_islocked() is a helper function which encapsulates checking state of rw_semaphores hold by inode. Signed-off-by: Pavel Reichl Suggested-by: Dave Chinner Suggested-by: Eric Sandeen Suggested

[f2fs-dev] [PATCH 14/14] cifs: Fix race between hole punch and page fault

2021-06-07 Thread Jan Kara
Cifs has a following race between hole punching and page fault: CPU1CPU2 smb3_fallocate() smb3_punch_hole() truncate_pagecache_range() filemap_fault()

[f2fs-dev] [PATCH 12/14] fuse: Convert to using invalidate_lock

2021-06-07 Thread Jan Kara
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 Signed-off-by: Jan Kara --- fs

[f2fs-dev] [PATCH 04/14] mm: Add functions to lock invalidate_lock for two mappings

2021-06-07 Thread Jan Kara
Some operations such as reflinking blocks among files will need to lock invalidate_lock for two mappings. Add helper functions to do that. Signed-off-by: Jan Kara --- include/linux/fs.h | 6 ++ mm/filemap.c | 38 ++ 2 files changed, 44 insertions(+)

[f2fs-dev] [PATCH 0/14 v7] fs: Hole punch vs page cache filling races

2021-06-07 Thread Jan Kara
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 biggest change since the last time is providing function to lock two mappings and using it from XFS. Other changes were pretty minor. Out of all

[f2fs-dev] [PATCH 02/14] documentation: Sync file_operations members with reality

2021-06-07 Thread Jan Kara
Sync listing of struct file_operations members with the real one in fs.h. Acked-by: Darrick J. Wong Signed-off-by: Jan Kara --- Documentation/filesystems/locking.rst | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Documentation/filesystems/locking.rst b/Docu

[f2fs-dev] [PATCH 11/14] f2fs: Convert to using invalidate_lock

2021-06-07 Thread Jan Kara
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

[f2fs-dev] [PATCH 13/14] ceph: Fix race between hole punch and page fault

2021-06-07 Thread Jan Kara
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

[f2fs-dev] [PATCH 09/14] xfs: Convert double locking of MMAPLOCK to use VFS helpers

2021-06-07 Thread Jan Kara
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

[f2fs-dev] [PATCH 08/14] xfs: Convert to use invalidate_lock

2021-06-07 Thread Jan Kara
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 CC: CC: "Darrick J. Wong" Signed

[f2fs-dev] [PATCH 05/14] ext4: Convert to use mapping->invalidate_lock

2021-06-07 Thread Jan Kara
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 Sign

[f2fs-dev] [PATCH 10/14] zonefs: Convert to using invalidate_lock

2021-06-07 Thread Jan Kara
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 Signed-off-by: Jan Kara --- fs/zonefs/super.c | 23 +-- fs/zonefs/zonefs.h | 7 +++ 2 files ch

[f2fs-dev] [PATCH 06/14] ext2: Convert to using invalidate_lock

2021-06-07 Thread Jan Kara
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: Signed-off-by: Jan Kara --- fs/ext2/ext2.h | 11 --- fs/ext2/file.c | 7 +++ fs/ext2/inode.c | 12 ++-- fs/ext2/super.

[f2fs-dev] [PATCH 01/14] mm: Fix comments mentioning i_mutex

2021-06-07 Thread Jan Kara
inode->i_mutex has been replaced with inode->i_rwsem long ago. Fix comments still mentioning i_mutex. Reviewed-by: Christoph Hellwig Acked-by: Hugh Dickins Signed-off-by: Jan Kara --- mm/filemap.c| 10 +- mm/madvise.c| 2 +- mm/memory-failure.c | 2 +- mm/rmap.c

Re: [f2fs-dev] [PATCH 3/3 v2] f2fs: clean up /sys/fs/f2fs//features

2021-06-07 Thread Chao Yu
On 2021/6/6 13:36, Jaegeuk Kim wrote: Let's create /sys/fs/f2fs//feature_list/ to meet sysfs rule. Note that there are three feature list entries: 1) /sys/fs/f2fs/features : shows runtime features supported by in-kernel f2fs along with Kconfig. - ref. F2FS_FEATURE_RO_ATTR() 2) /sys/fs/f

Re: [f2fs-dev] [PATCH 2/3] f2fs: add pin_file in feature list

2021-06-07 Thread Chao Yu
On 2021/6/5 8:32, Jaegeuk Kim wrote: This patch adds missing pin_file feature supported by kernel. Fixes: f5a53edcf01e ("f2fs: support aligned pinned file") Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing lis