Re: [f2fs-dev] A null-ptr-deref bug in f2fs_write_end_io

2023-05-19 Thread Chao Yu
Hi, Thanks for the report, it will be helpful if you can provide a reproducer. On 2023/5/19 15:13, butt3rflyh4ck wrote: Hi, there is a null-ptr-deref bug in f2fs_write_end_io in fs/f2fs/data.c, I reproduce it in the latest kernel too. #Quick description When a thread always calls

Re: [f2fs-dev] [PATCH 16/17] block: use iomap for writes to block devices

2023-05-19 Thread Hannes Reinecke
On 4/24/23 07:49, Christoph Hellwig wrote: Use iomap in buffer_head compat mode to write to block devices. Signed-off-by: Christoph Hellwig --- block/Kconfig | 1 + block/fops.c | 33 + 2 files changed, 30 insertions(+), 4 deletions(-) diff --git

Re: [f2fs-dev] [PATCH 01/17] fs: unexport buffer_check_dirty_writeback

2023-05-19 Thread Hannes Reinecke
On 4/24/23 07:49, Christoph Hellwig wrote: buffer_check_dirty_writeback is only used by the block device aops, remove the export. Signed-off-by: Christoph Hellwig --- fs/buffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index

[f2fs-dev] [PATCH 12/13] fuse: drop redundant arguments to fuse_perform_write

2023-05-19 Thread Christoph Hellwig
pos is always equal to iocb->ki_pos, and mapping is always equal to iocb->ki_filp->f_mapping. Signed-off-by: Christoph Hellwig --- fs/fuse/file.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index fd2f27f2144750..5f7b58798f99fc

[f2fs-dev] [PATCH 13/13] fuse: use direct_write_fallback

2023-05-19 Thread Christoph Hellwig
Use the generic direct_write_fallback helper instead of duplicating the logic. Signed-off-by: Christoph Hellwig --- fs/fuse/file.c | 27 +++ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index

[f2fs-dev] [PATCH 10/13] fs: factor out a direct_write_fallback helper

2023-05-19 Thread Christoph Hellwig
Add a helper dealing with handling the syncing of a buffered write fallback for direct I/O. Signed-off-by: Christoph Hellwig --- fs/libfs.c | 36 include/linux/fs.h | 2 ++ mm/filemap.c | 59 ++ 3 files

[f2fs-dev] [PATCH 11/13] fuse: update ki_pos in fuse_perform_write

2023-05-19 Thread Christoph Hellwig
Both callers of fuse_perform_write need to updated ki_pos, move it into common code. Signed-off-by: Christoph Hellwig --- fs/fuse/file.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index

[f2fs-dev] [PATCH 06/13] filemap: add a kiocb_invalidate_post_write helper

2023-05-19 Thread Christoph Hellwig
Add a helper to invalidate page cache after a dio write. Signed-off-by: Christoph Hellwig --- fs/direct-io.c | 10 ++ fs/iomap/direct-io.c| 12 ++-- include/linux/fs.h | 5 - include/linux/pagemap.h | 1 + mm/filemap.c| 37

[f2fs-dev] [PATCH 09/13] iomap: use kiocb_write_and_wait and kiocb_invalidate_pages

2023-05-19 Thread Christoph Hellwig
Use the common helpers for direct I/O page invalidation instead of open coding the logic. This leads to a slight reordering of checks in __iomap_dio_rw to keep the logic straight. Signed-off-by: Christoph Hellwig --- fs/iomap/direct-io.c | 55 1

[f2fs-dev] [PATCH 08/13] iomap: assign current->backing_dev_info in iomap_file_buffered_write

2023-05-19 Thread Christoph Hellwig
Move the assignment to current->backing_dev_info from the callers into iomap_file_buffered_write to reduce boiler plate code and reduce the scope to just around the page dirtying loop. Note that zonefs was missing this assignment before. Signed-off-by: Christoph Hellwig --- fs/gfs2/file.c

[f2fs-dev] [PATCH 02/13] filemap: update ki_pos in generic_perform_write

2023-05-19 Thread Christoph Hellwig
All callers of generic_perform_write need to updated ki_pos, move it into common code. Signed-off-by: Christoph Hellwig --- fs/ceph/file.c | 2 -- fs/ext4/file.c | 9 +++-- fs/f2fs/file.c | 1 - fs/nfs/file.c | 1 - mm/filemap.c | 8 5 files changed, 7 insertions(+), 14

[f2fs-dev] [PATCH 03/13] filemap: assign current->backing_dev_info in generic_perform_write

2023-05-19 Thread Christoph Hellwig
Move the assignment to current->backing_dev_info from the callers into generic_perform_write to reduce boiler plate code and reduce the scope to just around the page dirtying loop. Signed-off-by: Christoph Hellwig --- fs/ceph/file.c | 4 fs/ext4/file.c | 3 --- fs/f2fs/file.c | 2 --

[f2fs-dev] [PATCH 04/13] filemap: add a kiocb_write_and_wait helper

2023-05-19 Thread Christoph Hellwig
Factor out a helper that does filemap_write_and_wait_range for a the range covered by a read kiocb, or returns -EAGAIN if the kiocb is marked as nowait and there would be pages to write. Signed-off-by: Christoph Hellwig --- block/fops.c| 18 +++---

[f2fs-dev] [PATCH 07/13] iomap: update ki_pos in iomap_file_buffered_write

2023-05-19 Thread Christoph Hellwig
All callers of iomap_file_buffered_write need to updated ki_pos, move it into common code. Signed-off-by: Christoph Hellwig --- fs/gfs2/file.c | 4 +--- fs/iomap/buffered-io.c | 9 ++--- fs/xfs/xfs_file.c | 2 -- fs/zonefs/file.c | 4 +--- 4 files changed, 8

[f2fs-dev] [PATCH 01/13] iomap: update ki_pos a little later in iomap_dio_complete

2023-05-19 Thread Christoph Hellwig
Move the ki_pos update down a bit to prepare for a better common helper that invalidates pages based of an iocb. Signed-off-by: Christoph Hellwig --- fs/iomap/direct-io.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/iomap/direct-io.c

[f2fs-dev] [PATCH 05/13] filemap: add a kiocb_invalidate_pages helper

2023-05-19 Thread Christoph Hellwig
Factor out a helper that calls filemap_write_and_wait_range and invalidate_inode_pages2_rangefor a the range covered by a write kiocb or returns -EAGAIN if the kiocb is marked as nowait and there would be pages to write or invalidate. Signed-off-by: Christoph Hellwig --- include/linux/pagemap.h

[f2fs-dev] cleanup the filemap / direct I/O interaction

2023-05-19 Thread Christoph Hellwig
Hi all, this series cleans up some of the generic write helper calling conventions and the page cache writeback / invalidation for direct I/O. This is a spinoff from the no-bufferhead kernel project, for while we'll want to an use iomap based buffered write path in the block layer. diffstat:

[f2fs-dev] [PATCH v20 16/32] f2fs: Provide a splice-read stub

2023-05-19 Thread David Howells
Provide a splice_read stub for f2fs. This does some checks and tracing before proceeding and will switch from direct-I/O to buffered I/O if forced or if misaligned. It also updates the iostats after doing a buffered I/O. [Note: I wonder if I should only do the tracing if I call

[f2fs-dev] A null-ptr-deref bug in f2fs_write_end_io

2023-05-19 Thread butt3rflyh4ck
Hi, there is a null-ptr-deref bug in f2fs_write_end_io in fs/f2fs/data.c, I reproduce it in the latest kernel too. #Quick description When a thread always calls F2FS_IOC_RESIZE_FS to resize fs, if resize fs is failed, f2fs kernel thread would invoke callback function to update f2fs io info, it