Matthew, ----- Ursprüngliche Mail ----- > Von: "Matthew Wilcox" <willy@xxxxxxxxxxxxx> > len is folio_size(), which is not 0. > > len = offset_in_folio(folio, i_size); offset_in_folio(folio, i_size) can give 0. Further it will call do_writepage() with len being 0. I can actually trigger this case. By adding the following ubifs_assert() I can catch the write side. If the file length is a multiple of PAGE_SIZE (4k), it will trigger. diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 67cf5138ccc48..dc39ea368ca2b 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1059,6 +1059,8 @@ static int ubifs_writepage(struct folio *folio, struct writeback_control *wbc, folio_zero_segment(folio, offset_in_folio(folio, i_size), len); len = offset_in_folio(folio, i_size); + ubifs_assert(c, len > 0); + if (i_size > synced_i_size) { err = inode->i_sb->s_op->write_inode(inode, NULL); if (err) [ 44.569110] UBIFS error (ubi0:0 pid 59): ubifs_assert_failed: UBIFS assert failed: len > 0, in fs/ubifs/file.c:1062 [ 44.571359] UBIFS warning (ubi0:0 pid 59): ubifs_ro_mode.part.6: switched to read-only mode, error -22 [ 44.572998] CPU: 1 PID: 59 Comm: kworker/u8:2 Not tainted 6.4.0-rc5-00004-gd504b815b71c-dirty #19 [ 44.574139] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014 [ 44.574141] Workqueue: writeback wb_workfn (flush-ubifs_0_0) [ 44.574148] Call Trace: [ 44.574162] <TASK> [ 44.574165] dump_stack_lvl+0x32/0x50 [ 44.574172] ubifs_writepage+0x25a/0x270 [ 44.578096] write_cache_pages+0x132/0x3a0 [ 44.578103] ? __pfx_ubifs_writepage+0x10/0x10 [ 44.578107] ? virtqueue_add_sgs+0x7b/0x90 [ 44.578113] do_writepages+0xd3/0x1a0 [ 44.578116] ? kvm_clock_read+0x14/0x30 [ 44.578121] ? kvm_sched_clock_read+0x5/0x20 [ 44.578125] __writeback_single_inode+0x3c/0x350 [ 44.578128] writeback_sb_inodes+0x1c9/0x460 [ 44.578133] __writeback_inodes_wb+0x5a/0xc0 [ 44.582508] wb_writeback+0x230/0x2c0 [ 44.582513] wb_workfn+0x301/0x430 [ 44.582515] ? kvm_clock_read+0x14/0x30 [ 44.582519] ? kvm_sched_clock_read+0x5/0x20 [ 44.582523] ? sched_clock_cpu+0xd/0x190 [ 44.582527] ? __smp_call_single_queue+0xa1/0x110 [ 44.582532] process_one_work+0x1f3/0x3f0 [ 44.582538] worker_thread+0x25/0x3b0 [ 44.586196] ? __pfx_worker_thread+0x10/0x10 [ 44.586201] kthread+0xde/0x110 [ 44.586204] ? __pfx_kthread+0x10/0x10 [ 44.586207] ret_from_fork+0x2c/0x50 [ 44.586212] </TASK> Thanks, //richard