[f2fs-dev] [PATCH] f2fs: Fix the race condition of resize flag between resizefs

2022-10-17 Thread Zhang Qilong via Linux-f2fs-devel
Because the set/clear SBI_IS_RESIZEFS flag not between any locks, In the following case: thread1 thread2 ->ioctl(resizefs) ->set RESIZEFS flag ->ioctl(resizefs) ... ->set RESIZEFS flag ->clear RESIZEFS flag

[f2fs-dev] [PATCH] f2fs: Fix data consistency in f2fs_move_file_range()

2022-10-17 Thread Zhang Qilong via Linux-f2fs-devel
In the following case: process 1 process 2 ->open A ->mmap ->read # the first time ->ioctl w/h F2FS_IOC_MOVE_RANGE # (range A->B) ->read # the second time We will read old data at the se

[f2fs-dev] [PATCH] f2fs: let's avoid to get cp_rwsem twice by f2fs_evict_inode by d_invalidate

2022-10-17 Thread Jaegeuk Kim
f2fs_unlink -> f2fs_lock_op -> d_invalidate -> shrink_dentry_list -> iput_final -> f2fs_evict_inode -> f2fs_lock_op Signed-off-by: Jaegeuk Kim --- fs/f2fs/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index a3897

[f2fs-dev] [PATCH AUTOSEL 5.15 17/21] f2fs: fix to detect corrupted meta ino

2022-10-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit fcc2d8cc96b2f6141bbbe5b1e8953db990794b44 ] It is possible that ino of dirent or orphan inode is corrupted in a fuzzed image, occasionally, if corrupted ino is equal to meta ino: meta_ino, node_ino or compress_ino, caller of f2fs_iget() from below call paths will g

[f2fs-dev] [PATCH AUTOSEL 5.19 24/29] f2fs: fix to detect corrupted meta ino

2022-10-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit fcc2d8cc96b2f6141bbbe5b1e8953db990794b44 ] It is possible that ino of dirent or orphan inode is corrupted in a fuzzed image, occasionally, if corrupted ino is equal to meta ino: meta_ino, node_ino or compress_ino, caller of f2fs_iget() from below call paths will g

[f2fs-dev] [PATCH AUTOSEL 5.19 22/29] f2fs: fix wrong dirty page count when race between mmap and fallocate.

2022-10-17 Thread Sasha Levin
From: Shuqi Zhang [ Upstream commit 9b7eadd9bd3a0cc24533a23d83c46430a0ea60ff ] This is a BUG_ON issue as follows when running xfstest-generic-503: WARNING: CPU: 21 PID: 1385 at fs/f2fs/inode.c:762 f2fs_evict_inode+0x847/0xaa0 Modules linked in: CPU: 21 PID: 1385 Comm: umount Not tainted 5.19.0-r

[f2fs-dev] [PATCH AUTOSEL 5.19 23/29] f2fs: code clean and fix a type error

2022-10-17 Thread Sasha Levin
From: Zhang Qilong [ Upstream commit 544b53dadc208278fd0796f2c22ea24a3fe16564 ] ERROR: code indent should use tabs where possible ERROR: spaces required around that ':' ERROR: incorrect tab Found serveral code type errors when review the code and fix it. There is no function change. Signed-off

[f2fs-dev] [PATCH AUTOSEL 6.0 25/32] f2fs: code clean and fix a type error

2022-10-17 Thread Sasha Levin
From: Zhang Qilong [ Upstream commit 544b53dadc208278fd0796f2c22ea24a3fe16564 ] ERROR: code indent should use tabs where possible ERROR: spaces required around that ':' ERROR: incorrect tab Found serveral code type errors when review the code and fix it. There is no function change. Signed-off

[f2fs-dev] [PATCH AUTOSEL 6.0 26/32] f2fs: fix to detect corrupted meta ino

2022-10-17 Thread Sasha Levin
From: Chao Yu [ Upstream commit fcc2d8cc96b2f6141bbbe5b1e8953db990794b44 ] It is possible that ino of dirent or orphan inode is corrupted in a fuzzed image, occasionally, if corrupted ino is equal to meta ino: meta_ino, node_ino or compress_ino, caller of f2fs_iget() from below call paths will g

[f2fs-dev] [PATCH AUTOSEL 6.0 24/32] f2fs: fix wrong dirty page count when race between mmap and fallocate.

2022-10-17 Thread Sasha Levin
From: Shuqi Zhang [ Upstream commit 9b7eadd9bd3a0cc24533a23d83c46430a0ea60ff ] This is a BUG_ON issue as follows when running xfstest-generic-503: WARNING: CPU: 21 PID: 1385 at fs/f2fs/inode.c:762 f2fs_evict_inode+0x847/0xaa0 Modules linked in: CPU: 21 PID: 1385 Comm: umount Not tainted 5.19.0-r

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

2022-10-17 Thread Vishal Moola (Oracle)
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Initially the function was checking if the previous page index is truly the previous page i.e. 1 index behind the current page. To convert to folios and maintain this check we need to m

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

2022-10-17 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 v3 22/23] nilfs2: Convert nilfs_clear_dirty_pages() to use filemap_get_folios_tag()

2022-10-17 Thread Vishal Moola (Oracle)
Convert 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: Ryusuke Konishi --- fs/nilfs2/page.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/nilf

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

2022-10-17 Thread Vishal Moola (Oracle)
Convert 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: Ryusuke Konishi --- fs/nilfs2/btree.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nilfs2/btre

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

2022-10-17 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) --- fs/f2fs/node.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2f

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

2022-10-17 Thread Vishal Moola (Oracle)
Convert 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: Ryusuke Konishi --- fs/nilfs2/page.c | 39 --- 1 file changed, 20 insertions(+), 19 deletions(-) d

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

2022-10-17 Thread Vishal Moola (Oracle)
Convert 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: Ryusuke Konishi --- fs/nilfs2/segment.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/nilfs2/s

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

2022-10-17 Thread Vishal Moola (Oracle)
Convert 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: Ryusuke Konishi --- fs/nilfs2/segment.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --g

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

2022-10-17 Thread Vishal Moola (Oracle)
Converted function to use folios throughout. This is in preparation for the removal of find_get_pgaes_range_tag(). Also had to modify and rename gfs2_write_jdata_pagevec() to take in and utilize folio_batch rather than pagevec and use folios rather than pages. gfs2_write_jdata_batch() now supports

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

2022-10-17 Thread Vishal Moola (Oracle)
Converted function to use folios. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) --- mm/filemap.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index aa6e90ab0

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

2022-10-17 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, 19

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

2022-10-17 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 v3 15/23] f2fs: Convert last_fsync_dnode() to use filemap_get_folios_tag()

2022-10-17 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 v3 08/23] ceph: Convert ceph_writepages_start() to use filemap_get_folios_tag()

2022-10-17 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) --- fs/ceph/addr.c | 58 ++ 1 file chang

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

2022-10-17 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) --- include/linux/pagemap.h | 20 ++

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

2022-10-17 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 --- fs

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

2022-10-17 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 r

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

2022-10-17 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 v3 12/23] f2fs: Convert f2fs_flush_inline_data() to use filemap_get_folios_tag()

2022-10-17 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) --- fs/f2fs/node.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c

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

2022-10-17 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(). Also modified f2fs_all_cluster_page_ready to take in a folio_batch instead of pagevec. This does NOT support large folios. The function currently only utilizes foli

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

2022-10-17 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. Signed-off-by: Vishal Moola (Oracle) --- fs/ext4/inode.c | 55 - 1 file changed, 27 insertions(+), 28

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

2022-10-17 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 a/fs/btr

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

2022-10-17 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) --- fs/f2fs/node.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/n

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

2022-10-17 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) --- mm/page-writeback.c | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/mm/pa

Re: [f2fs-dev] [PATCH v4 2/2] f2fs: introduce F2FS_IOC_START_ATOMIC_REPLACE

2022-10-17 Thread Daeho Jeong
On Thu, Oct 6, 2022 at 9:32 AM Darrick J. Wong wrote: > > On Thu, Oct 06, 2022 at 01:33:34AM -0700, Christoph Hellwig wrote: > > On Tue, Oct 04, 2022 at 10:13:51AM -0700, Daeho Jeong wrote: > > > From: Daeho Jeong > > > > > > introduce a new ioctl to replace the whole content of a file atomically

Re: [f2fs-dev] [PATCH] fs: f2fs: fix kernel discard_thread NULL dereference

2022-10-17 Thread Chao Yu
On 2022/10/17 18:04, Hoi Pok Wu wrote: Pointer discard_thread is pointing to nowhere, using IS_ERR prevents the situation. IS_ERR also seen being used throughout the file. I guess below patch can fix this issue from root cause? https://lore.kernel.org/linux-f2fs-devel/20221013155628.434671-1-c

Re: [f2fs-dev] [PATCH RFC 0/7] fs: Debug config option to disable filesystem checksum verification for fuzzing

2022-10-17 Thread David Sterba
On Mon, Oct 17, 2022 at 10:31:03AM +0200, Dmitry Vyukov wrote: > On Fri, 14 Oct 2022 at 11:15, David Sterba wrote: > > On Fri, Oct 14, 2022 at 08:48:30AM +, Hrutvik Kanabar wrote: > > > From: Hrutvik Kanabar > > I think the build-time option inflexible, but I see the point when > > you're tes

[f2fs-dev] [PATCH] fs: f2fs: fix kernel discard_thread NULL dereference

2022-10-17 Thread Hoi Pok Wu
Pointer discard_thread is pointing to nowhere, using IS_ERR prevents the situation. IS_ERR also seen being used throughout the file. Link: https://syzkaller.appspot.com/bug?id=9499bc6574cea5940e48199c2fd0732d9b11e5e1 Reported-by: syzbot+035a381ea1afb63f0...@syzkaller.appspotmail.com Signed-off-by

Re: [f2fs-dev] [PATCH RFC 3/7] fs/btrfs: support `DISABLE_FS_CSUM_VERIFICATION` config option

2022-10-17 Thread Qu Wenruo
On 2022/10/17 16:43, Dmitry Vyukov wrote: On Fri, 14 Oct 2022 at 12:24, 'Qu Wenruo' via kasan-dev wrote: On 2022/10/14 16:48, Hrutvik Kanabar wrote: From: Hrutvik Kanabar When `DISABLE_FS_CSUM_VERIFICATION` is enabled, bypass checksum verification. Signed-off-by: Hrutvik Kanabar I al

Re: [f2fs-dev] [PATCH RFC 3/7] fs/btrfs: support `DISABLE_FS_CSUM_VERIFICATION` config option

2022-10-17 Thread Dmitry Vyukov via Linux-f2fs-devel
On Fri, 14 Oct 2022 at 12:24, 'Qu Wenruo' via kasan-dev wrote: > > On 2022/10/14 16:48, Hrutvik Kanabar wrote: > > From: Hrutvik Kanabar > > > > When `DISABLE_FS_CSUM_VERIFICATION` is enabled, bypass checksum > > verification. > > > > Signed-off-by: Hrutvik Kanabar > > I always want more fuzz fo

Re: [f2fs-dev] [PATCH RFC 5/7] fs/xfs: support `DISABLE_FS_CSUM_VERIFICATION` config option

2022-10-17 Thread Dmitry Vyukov via Linux-f2fs-devel
On Fri, 14 Oct 2022 at 17:44, Darrick J. Wong wrote: > > On Fri, Oct 14, 2022 at 08:48:35AM +, Hrutvik Kanabar wrote: > > From: Hrutvik Kanabar > > > > When `DISABLE_FS_CSUM_VERIFICATION` is enabled, return truthy value for > > `xfs_verify_cksum`, which is the key function implementing checks

Re: [f2fs-dev] [PATCH RFC 0/7] fs: Debug config option to disable filesystem checksum verification for fuzzing

2022-10-17 Thread Dmitry Vyukov via Linux-f2fs-devel
On Fri, 14 Oct 2022 at 11:15, David Sterba wrote: > > On Fri, Oct 14, 2022 at 08:48:30AM +, Hrutvik Kanabar wrote: > > From: Hrutvik Kanabar > > > > Fuzzing is a proven technique to discover exploitable bugs in the Linux > > kernel. But fuzzing filesystems is tricky: highly structured disk im

[f2fs-dev] [syzbot] BUG: unable to handle kernel NULL pointer dereference in get_next_nat_page (2)

2022-10-17 Thread syzbot
Hello, syzbot found the following issue on: HEAD commit:493ffd6605b2 Merge tag 'ucount-rlimits-cleanups-for-v5.19'.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=17cbb31a88 kernel config: https://syzkaller.appspot.com/x/.config?x=d19f5d16783f901 dash