[f2fs-dev] f2fs_empty_dir() can be extremely slow on malicious disk images

2022-11-02 Thread Eric Biggers
[+f2fs list and maintainers] [changed subject from "INFO: task hung in fscrypt_ioctl_set_policy"] On Mon, Oct 31, 2022 at 10:18:02PM +0800, Wei Chen wrote: > Dear Linux developers, > > Here is the link to the reproducers. > > C reproducer: >

Re: [f2fs-dev] f2fs_empty_dir() can be extremely slow on malicious disk images

2022-11-02 Thread Wei Chen
Dear Eric, Thank you for the email and advice. The bug persists in upstream Linux 6.0 4fe89d07dc. [ 222.604894][ T23] INFO: task a.out:6867 blocked for more than 143 seconds. [ 222.606536][ T23] Not tainted 6.0.0 #35 [ 222.606833][ T23] "echo 0 >

[f2fs-dev] [PATCH v1] f2fs: avoid victim selection from previous victim section

2022-11-02 Thread Yonggil Song
When f2fs chooses GC victim in large section & LFS mode, next_victim_seg[gc_type] is referenced first. After segment is freed, next_victim_seg[gc_type] has the next segment number. However, next_victim_seg[gc_type] still has the last segment number even after the last segment of section is freed.

Re: [f2fs-dev] [PATCH] f2fs: separate IPU policy for fdatasync from F2FS_IPU_FSYNC

2022-11-02 Thread qixiaoyu
Hi Chao, fdatasync do in-place-update to avoid additional node writes, but currently it only do that with F2FS_IPU_FSYNC as: f2fs_do_sync_file: if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks) set_inode_flag(inode, FI_NEED_IPU);

[f2fs-dev] [PATCH v4 10/23] ext4: Convert mpage_prepare_extent_to_map() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted the function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Now supports large folios. This change removes 10 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) --- fs/ext4/inode.c | 55

[f2fs-dev] [PATCH v4 09/23] cifs: Convert wdata_alloc_and_fillpages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
This is in preparation for the removal of find_get_pages_range_tag(). Now also supports the use of large folios. Since tofind might be larger than the max number of folios in a folio_batch (15), we loop through filling in wdata->pages pulling more batches until we either reach tofind pages or run

[f2fs-dev] [PATCH v4 14/23] f2fs: Convert f2fs_write_cache_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted the function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 7 calls to compound_head(). Also modified f2fs_all_cluster_page_ready to take in a folio_batch instead of pagevec. This does NOT support large

[f2fs-dev] [PATCH v4 23/23] filemap: Remove find_get_pages_range_tag()

2022-11-02 Thread Vishal Moola (Oracle)
All callers to find_get_pages_range_tag(), find_get_pages_tag(), pagevec_lookup_range_tag(), and pagevec_lookup_tag() have been removed. Signed-off-by: Vishal Moola (Oracle) --- include/linux/pagemap.h | 10 --- include/linux/pagevec.h | 8 -- mm/filemap.c| 60

[f2fs-dev] [PATCH v4 12/23] f2fs: Convert f2fs_flush_inline_data() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git

[f2fs-dev] [PATCH v4 15/23] f2fs: Convert last_fsync_dnode() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) --- fs/f2fs/node.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c

[f2fs-dev] [PATCH v4 11/23] f2fs: Convert f2fs_fsync_node_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git

[f2fs-dev] [PATCH v4 17/23] gfs2: Convert gfs2_write_cache_jdata() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for the removal of find_get_pgaes_range_tag(). This change removes 8 calls to compound_head(). Also had to modify and rename gfs2_write_jdata_pagevec() to take in and utilize folio_batch rather than pagevec and use folios rather

[f2fs-dev] [PATCH v4 18/23] nilfs2: Convert nilfs_lookup_dirty_data_buffers() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 4 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/segment.c | 29 - 1 file

[f2fs-dev] [PATCH v4 04/23] page-writeback: Convert write_cache_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 8 calls to compound_head(), and the function now supports large folios. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcow (Oracle) ---

[f2fs-dev] [PATCH v4 20/23] nilfs2: Convert nilfs_btree_lookup_dirty_buffers() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 1 call to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/btree.c | 14 +++--- 1 file changed, 7

[f2fs-dev] [PATCH v4 05/23] afs: Convert afs_writepages_region() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert to use folios throughout. This function is in preparation to remove find_get_pages_range_tag(). Also modified this function to write the whole batch one at a time, rather than calling for a new set every single write. Signed-off-by: Vishal Moola (Oracle) Tested-by: David Howells ---

[f2fs-dev] [PATCH v4 08/23] ceph: Convert ceph_writepages_start() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Also some minor renaming for consistency. Signed-off-by: Vishal Moola (Oracle) Acked-by: Jeff Layton --- fs/ceph/addr.c | 58

[f2fs-dev] [PATCH v4 22/23] nilfs2: Convert nilfs_clear_dirty_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 2 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/page.c | 20 ++-- 1 file changed, 10

[f2fs-dev] [PATCH v4 13/23] f2fs: Convert f2fs_sync_node_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git

[f2fs-dev] [PATCH v4 00/23] Convert to filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
This patch series replaces find_get_pages_range_tag() with filemap_get_folios_tag(). This also allows the removal of multiple calls to compound_head() throughout. It also makes a good chunk of the straightforward conversions to folios, and takes the opportunity to introduce a function that grabs a

[f2fs-dev] [PATCH v4 03/23] filemap: Convert __filemap_fdatawait_range() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted function to use folios. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 2 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcow (Oracle) --- mm/filemap.c | 24 +--- 1 file changed, 13

[f2fs-dev] [PATCH v4 02/23] filemap: Added filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
This is the equivalent of find_get_pages_range_tag(), except for folios instead of pages. One noteable difference is filemap_get_folios_tag() does not take in a maximum pages argument. It instead tries to fill a folio batch and stops either once full (15 folios) or reaching the end of the search

[f2fs-dev] [PATCH v4 01/23] pagemap: Add filemap_grab_folio()

2022-11-02 Thread Vishal Moola (Oracle)
Add function filemap_grab_folio() to grab a folio from the page cache. This function is meant to serve as a folio replacement for grab_cache_page, and is used to facilitate the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) ---

[f2fs-dev] [PATCH v4 06/23] btrfs: Convert btree_write_cache_pages() to use filemap_get_folio_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: David Sterba --- fs/btrfs/extent_io.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git

[f2fs-dev] [PATCH v4 07/23] btrfs: Convert extent_write_cache_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Now also supports large folios. Signed-off-by: Vishal Moola (Oracle) Acked-by: David Sterba --- fs/btrfs/extent_io.c | 38 +++--- 1 file changed,

Re: [f2fs-dev] f2fs_empty_dir() can be extremely slow on malicious disk images

2022-11-02 Thread Chao Yu
On 2022/11/2 14:17, Eric Biggers wrote: [+f2fs list and maintainers] Thanks for the forwarding. [changed subject from "INFO: task hung in fscrypt_ioctl_set_policy"] On Mon, Oct 31, 2022 at 10:18:02PM +0800, Wei Chen wrote: Dear Linux developers, Here is the link to the reproducers. C

[f2fs-dev] [PATCH v4 21/23] nilfs2: Convert nilfs_copy_dirty_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 8 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/page.c | 39 --- 1

[f2fs-dev] [PATCH v4 16/23] f2fs: Convert f2fs_sync_meta_pages() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 5 calls to compound_head(). Initially the function was checking if the previous page index is truly the previous page i.e. 1 index behind the current page. To

[f2fs-dev] [PATCH v4 19/23] nilfs2: Convert nilfs_lookup_dirty_node_buffers() to use filemap_get_folios_tag()

2022-11-02 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 1 call to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/segment.c | 15 +++ 1 file changed, 7

[f2fs-dev] [Bug 216050] f2fs_gc occupies 100% cpu

2022-11-02 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216050 --- Comment #71 from Guido (guido.iod...@gmail.com) --- Since the problem occurred with the 5.18 kernel, I assume there is something wrong after that version. I think the analysis of the problem should start with the changes that occurred with

Re: [f2fs-dev] f2fs_empty_dir() can be extremely slow on malicious disk images

2022-11-02 Thread Chao Yu
On 2022/11/2 23:12, Chao Yu wrote: On 2022/11/2 14:17, Eric Biggers wrote: [+f2fs list and maintainers] Thanks for the forwarding. [changed subject from "INFO: task hung in fscrypt_ioctl_set_policy"] On Mon, Oct 31, 2022 at 10:18:02PM +0800, Wei Chen wrote: Dear Linux developers, Here is