[PATCH OLK-6.6] iomap: fix dirty range tracking in iomap_folio_mkwrite_iter
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDCSJV ----------------------------------------- When I test xfs with fsstress, got the following assert message: XFS (sda): ino 1a0b0a data fork has delalloc extent at [0x186:0x1] XFS: Assertion failed: 0, file: fs/xfs/xfs_icache.c, line: 1819 ------------[ cut here ]------------ kernel BUG at fs/xfs/xfs_message.c:102! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 3 PID: 940 Comm: kworker/3:1 Not tainted 6.6.0-g3697dae9bfac #192 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.1-2.fc37 04/01/2014 Workqueue: xfs-inodegc/sda xfs_inodegc_worker RIP: 0010:assfail+0x54/0x60 RSP: 0018:ffffc90003113e08 EFLAGS: 00010202 RAX: 0000000000000000 RBX: ffff8880651dd800 RCX: 000000007fffffff RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff82a12e0c RBP: ffffffffffffff20 R08: 00000000000025c2 R09: 0000000000000000 R10: 000000000000000a R11: 000000000000000a R12: 0000000000000000 R13: ffffffffffffff20 R14: ffff888077948000 R15: 0000000004208060 FS: 0000000000000000(0000) GS:ffff8880bcb80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000561be0e1cf30 CR3: 0000000075fa4000 CR4: 00000000000006e0 Call Trace: <TASK> xfs_inodegc_set_reclaimable+0x1f1/0x220 xfs_inodegc_worker+0x10b/0x2e0 process_scheduled_works+0x1a5/0x5e0 worker_thread+0x1d1/0x4f0 ? apply_workqueue_attrs+0x70/0x70 kthread+0x149/0x1c0 ? kthread_exit+0x50/0x50 ret_from_fork+0x52/0x70 ? kthread_exit+0x50/0x50 ret_from_fork_asm+0x11/0x20 </TASK> Fix the incorrect dirty range tracking in iomap_folio_mkwrite_iter() which could lead to blocks being missed during writeback. Previously, iomap_set_range_dirty() was called with a wrong offset (0), which may cause some modified blocks not being marked as dirty and thus skip writeback. Calculate the correct offset within the folio from the iterator position to ensure all modified blocks are properly marked dirty and written back. Fixes: 0b4d2d8fba90 ("iomap: correct the dirty length in page mkwrite") Signed-off-by: Long Li <leo.lilong@huawei.com> --- fs/iomap/buffered-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 7a417bd8a9f3..33fbb3f8d45f 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1562,10 +1562,12 @@ static loff_t iomap_folio_mkwrite_iter(struct iomap_iter *iter, return ret; block_commit_write(&folio->page, 0, length); } else { + size_t poff = offset_in_folio(folio, iter->pos); + WARN_ON_ONCE(!folio_test_uptodate(folio)); ifs_alloc(iter->inode, folio, 0); - iomap_set_range_dirty(folio, 0, length); + iomap_set_range_dirty(folio, poff, length); } return length; -- 2.39.2
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/19697 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/YI6... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/19697 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/YI6...
participants (2)
-
Long Li -
patchwork bot