Bug 214765
Summary: | ubifs: UBIFS error (ubi0:0 pid 124): ubifs_assert_failed [ubifs]: UBIFS assert failed: c->bi.dd_growth >= 0, in fs/ubifs/budget.c:554 | ||
---|---|---|---|
Product: | File System | Reporter: | Zhihao Cheng (chengzhihao1) |
Component: | Other | Assignee: | fs_other |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 5.15-rc5 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
delay.patch
test.sh a.c |
Description
Zhihao Cheng
2021-10-20 02:34:01 UTC
generic/476 can easily trigger this problem. 'ui->dirty' is not protected by ui_mutex in function do_tmpfile() which may race with ubifs_write_inode(wb_workfn) to access/update 'ui->dirty', finally dirty space is released twice. open(O_TMPFILE) wb_workfn do_tmpfile ubifs_budget_space(ino_req = { .dirtied_ino = 1}) d_tmpfile // mark inode(tmpfile) dirty ubifs_jnl_update // without holding tmpfile's ui_mutex mark_inode_clean(ui) if (ui->dirty) ubifs_release_dirty_inode_budget(ui) // release ubifs_write_inode ubifs_release_dirty_inode_budget(ui) ui->dirty = 0 Reproducer: 1. Apply delay.patch and compile kernel (UBIFS/UBI/NANDSIM = m) 2. ./test.sh 3. Compile and run a.c You may get: [14569.338625] release dirty budget 65 [14570.338640] wb release 65 [14570.348279] UBIFS error (ubi0:0 pid 2578): ubifs_assert_failed [ubifs]: UBIFS assert failed: c->bi.dd_growth >= 0, in fs/ubifs/budget.c:554 [14570.351928] UBIFS warning (ubi0:0 pid 2578): ubifs_ro_mode [ubifs]: switched to read-only mode, error -22 [14570.353452] CPU: 2 PID: 2578 Comm: kworker/u8:2 Not tainted 5.15.0-rc5-00259-g1c6a7ce3cb2d-dirty #136 [14570.355243] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014 [14570.357187] Workqueue: writeback wb_workfn (flush-ubifs_0_0) [14570.358024] Call Trace: [14570.358388] ? dump_stack_lvl+0x73/0x9f [14570.358963] ? dump_stack+0x13/0x1b [14570.359477] ? ubifs_ro_mode+0x54/0x60 [ubifs] [14570.360132] ? ubifs_assert_failed+0x4b/0x80 [ubifs] [14570.360865] ? ubifs_release_budget+0x468/0x5a0 [ubifs] [14570.361632] ? ubifs_release_dirty_inode_budget+0x53/0x80 [ubifs] [14570.362522] ? ubifs_write_inode+0x121/0x1f0 [ubifs] [14570.363247] ? __writeback_single_inode+0x43c/0x570 [14570.363953] ? writeback_sb_inodes+0x259/0x740 [14570.364601] ? __writeback_inodes_wb+0x88/0x120 [14570.365266] ? wb_writeback+0x3cf/0x4d0 [14570.365843] ? wb_workfn+0x283/0x7b0 [14570.366362] ? send_call_function_single_ipi+0x9b/0x130 [14570.367148] ? __smp_call_single_queue+0x48/0x60 [14570.367849] ? ttwu_queue_wakelist+0xfa/0x1c0 [14570.368490] ? process_one_work+0x291/0x650 [14570.369114] ? worker_thread+0x2b7/0x700 [14570.369702] ? rescuer_thread+0x580/0x580 [14570.370296] ? kthread+0x18c/0x1e0 [14570.370792] ? set_kthread_struct+0x70/0x70 [14570.371402] ? ret_from_fork+0x1f/0x30 [14574.819182] wb finish? Created attachment 299253 [details]
delay.patch
Created attachment 299255 [details]
test.sh
Created attachment 299257 [details]
a.c
|