* [PATCH 1/2] f2fs: don't allow any writes on readonly mount @ 2020-12-03 20:55 Jaegeuk Kim 2020-12-03 20:55 ` [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size Jaegeuk Kim 2020-12-07 7:51 ` [f2fs-dev] [PATCH 1/2] f2fs: don't allow any writes on readonly mount Chao Yu 0 siblings, 2 replies; 4+ messages in thread From: Jaegeuk Kim @ 2020-12-03 20:55 UTC (permalink / raw) To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Jaegeuk Kim generic_make_request: Trying to write to read-only block-device dm-5 (partno 0) WARNING: CPU: 7 PID: 546 at block/blk-core.c:2190 generic_make_request_checks+0x664/0x690 pc : generic_make_request_checks+0x664/0x690 lr : generic_make_request_checks+0x664/0x690 Call trace: generic_make_request_checks+0x664/0x690 generic_make_request+0xf0/0x3a4 submit_bio+0x80/0x250 __submit_merged_bio+0x368/0x4e0 __submit_merged_write_cond.llvm.12294350193007536502+0xe0/0x3e8 f2fs_wait_on_page_writeback+0x84/0x128 f2fs_convert_inline_page+0x35c/0x6f8 f2fs_convert_inline_inode+0xe0/0x2e0 f2fs_file_mmap+0x48/0x9c mmap_region+0x41c/0x74c do_mmap+0x40c/0x4fc vm_mmap_pgoff+0xb8/0x114 vm_mmap+0x34/0x48 elf_map+0x68/0x108 load_elf_binary+0x538/0xb70 search_binary_handler+0xac/0x1dc exec_binprm+0x50/0x15c __do_execve_file+0x620/0x740 __arm64_sys_execve+0x54/0x68 el0_svc_common+0x9c/0x168 el0_svc_handler+0x60/0x6c el0_svc+0x8/0xc Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 92e9852d316a..d09a0bdc0197 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -188,7 +188,8 @@ int f2fs_convert_inline_inode(struct inode *inode) struct page *ipage, *page; int err = 0; - if (!f2fs_has_inline_data(inode)) + if (!f2fs_has_inline_data(inode) || + f2fs_hw_is_readonly(sbi) || f2fs_readonly(sbi->sb)) return 0; page = f2fs_grab_cache_page(inode->i_mapping, 0, false); -- 2.29.2.576.ga3fc446d84-goog ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size 2020-12-03 20:55 [PATCH 1/2] f2fs: don't allow any writes on readonly mount Jaegeuk Kim @ 2020-12-03 20:55 ` Jaegeuk Kim 2020-12-07 7:55 ` [f2fs-dev] " Chao Yu 2020-12-07 7:51 ` [f2fs-dev] [PATCH 1/2] f2fs: don't allow any writes on readonly mount Chao Yu 1 sibling, 1 reply; 4+ messages in thread From: Jaegeuk Kim @ 2020-12-03 20:55 UTC (permalink / raw) To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Jaegeuk Kim This patch adds max_io_bytes to limit bio size when f2fs tries to merge consecutive IOs. This can give a testing point to split out bios and check end_io handles those bios correctly. This is used to capture a recent bug on the decompression and fsverity flow. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- Documentation/ABI/testing/sysfs-fs-f2fs | 7 +++++++ fs/f2fs/data.c | 3 +++ fs/f2fs/f2fs.h | 1 + fs/f2fs/sysfs.c | 2 ++ 4 files changed, 13 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 67b3ed8e8c2f..3dfee94e0618 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -370,3 +370,10 @@ Date: April 2020 Contact: "Daeho Jeong" <daehojeong@google.com> Description: Give a way to change iostat_period time. 3secs by default. The new iostat trace gives stats gap given the period. +What: /sys/fs/f2fs/<disk>/max_io_bytes +Date: December 2020 +Contact: "Jaegeuk Kim" <jaegeuk@kernel.org> +Description: This gives a control to limit the bio size in f2fs. + Default is zero, which will follow underlying block layer limit, + whereas, if it has a certain bytes value, f2fs won't submit a + bio larger than that size. diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e85fd8f77f3f..cb28089e1eff 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -736,6 +736,9 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) static bool page_is_mergeable(struct f2fs_sb_info *sbi, struct bio *bio, block_t last_blkaddr, block_t cur_blkaddr) { + if (unlikely(sbi->max_io_bytes && + bio->bi_iter.bi_size >= sbi->max_io_bytes)) + return false; if (last_blkaddr + 1 != cur_blkaddr) return false; return __same_bdev(sbi, cur_blkaddr, bio); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 36090cd09011..594df6391390 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1446,6 +1446,7 @@ struct f2fs_sb_info { loff_t max_file_blocks; /* max block index of file */ int dir_level; /* directory level */ int readdir_ra; /* readahead inode in readdir */ + u64 max_io_bytes; /* max io bytes to merge IOs */ block_t user_block_count; /* # of user blocks */ block_t total_valid_block_count; /* # of valid blocks */ diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index fce2997382af..989a649cfa8b 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -567,6 +567,7 @@ F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_period_ms, iostat_period_ms); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra); +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, max_io_bytes, max_io_bytes); F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold); F2FS_RW_ATTR(F2FS_SBI, f2fs_super_block, extension_list, extension_list); #ifdef CONFIG_F2FS_FAULT_INJECTION @@ -651,6 +652,7 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(iostat_enable), ATTR_LIST(iostat_period_ms), ATTR_LIST(readdir_ra), + ATTR_LIST(max_io_bytes), ATTR_LIST(gc_pin_file_thresh), ATTR_LIST(extension_list), #ifdef CONFIG_F2FS_FAULT_INJECTION -- 2.29.2.576.ga3fc446d84-goog ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size 2020-12-03 20:55 ` [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size Jaegeuk Kim @ 2020-12-07 7:55 ` Chao Yu 0 siblings, 0 replies; 4+ messages in thread From: Chao Yu @ 2020-12-07 7:55 UTC (permalink / raw) To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel, kernel-team On 2020/12/4 4:55, Jaegeuk Kim wrote: > This patch adds max_io_bytes to limit bio size when f2fs tries to merge > consecutive IOs. This can give a testing point to split out bios and check > end_io handles those bios correctly. This is used to capture a recent bug > on the decompression and fsverity flow. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Reviewed-by: Chao Yu <yuchao0@huawei.com> Thanks, ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH 1/2] f2fs: don't allow any writes on readonly mount 2020-12-03 20:55 [PATCH 1/2] f2fs: don't allow any writes on readonly mount Jaegeuk Kim 2020-12-03 20:55 ` [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size Jaegeuk Kim @ 2020-12-07 7:51 ` Chao Yu 1 sibling, 0 replies; 4+ messages in thread From: Chao Yu @ 2020-12-07 7:51 UTC (permalink / raw) To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel, kernel-team On 2020/12/4 4:55, Jaegeuk Kim wrote: > generic_make_request: Trying to write to read-only block-device dm-5 (partno 0) > WARNING: CPU: 7 PID: 546 at block/blk-core.c:2190 generic_make_request_checks+0x664/0x690 > pc : generic_make_request_checks+0x664/0x690 > lr : generic_make_request_checks+0x664/0x690 > Call trace: > generic_make_request_checks+0x664/0x690 > generic_make_request+0xf0/0x3a4 > submit_bio+0x80/0x250 > __submit_merged_bio+0x368/0x4e0 > __submit_merged_write_cond.llvm.12294350193007536502+0xe0/0x3e8 > f2fs_wait_on_page_writeback+0x84/0x128 > f2fs_convert_inline_page+0x35c/0x6f8 > f2fs_convert_inline_inode+0xe0/0x2e0 > f2fs_file_mmap+0x48/0x9c > mmap_region+0x41c/0x74c > do_mmap+0x40c/0x4fc > vm_mmap_pgoff+0xb8/0x114 > vm_mmap+0x34/0x48 > elf_map+0x68/0x108 > load_elf_binary+0x538/0xb70 > search_binary_handler+0xac/0x1dc > exec_binprm+0x50/0x15c > __do_execve_file+0x620/0x740 > __arm64_sys_execve+0x54/0x68 > el0_svc_common+0x9c/0x168 > el0_svc_handler+0x60/0x6c > el0_svc+0x8/0xc > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Reviewed-by: Chao Yu <yuchao0@huawei.com> Thanks, ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-07 7:56 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-03 20:55 [PATCH 1/2] f2fs: don't allow any writes on readonly mount Jaegeuk Kim 2020-12-03 20:55 ` [PATCH 2/2] f2fs: introduce max_io_bytes, a sysfs entry, to limit bio size Jaegeuk Kim 2020-12-07 7:55 ` [f2fs-dev] " Chao Yu 2020-12-07 7:51 ` [f2fs-dev] [PATCH 1/2] f2fs: don't allow any writes on readonly mount Chao Yu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).