109 Star 72 Fork 297

src-openEuler/kernel

 / 详情

ubifs: Check @c->dirty_[n|p]n_cnt and @c->nroot state under @c->lp_mutex 补丁分析

已完成
任务
创建于  
2024-06-06 15:32

对于如下时序,UBIFS可能在commit时触发断言失败

       P1        P2        P3
run_gc
 ubifs_garbage_collect
              do_commit
 ubifs_return_leb
  ubifs_lpt_lookup_dirty
   dirty_cow_nnode
                       do_commit
			nothing_to_commit
			 if (test_bit(DIRTY_CNODE, &c->nroot->flags)
			 // false
   test_and_set_bit(DIRTY_CNODE, &nnode->flags)
   c->dirty_nn_cnt += 1
                         ubifs_assert(c, c->dirty_nn_cnt == 0)
			 // false !

复现用例见https://bugzilla.kernel.org/show_bug.cgi?id=218162

合入补丁前

[   51.573662] COMMIT
[   51.671867] COMMIT
[   51.778638] Wait sync commit1 twice
[   51.830773] COMMIT
[   51.854184] COMMIT
[   51.888462] wait done
[   51.893241] wait sync commit2
[   51.904395] COMMIT
[   51.904819] sync dirty
[   52.093823] wait2 done
[   52.094280] Add dirty A
[   52.102687] Add dirty A
[   52.111500] sync done
[   52.112023] UBIFS error (ubi0:0 pid 6641): ubifs_assert_failed [ubifs]: UBIFS assert failed: c->dirty_pn_cnt == 0, in fs/ubifs/commit.c:97
[   52.114861] UBIFS warning (ubi0:0 pid 6641): ubifs_ro_mode [ubifs]: switched to read-only mode, error -22
[   52.116767] CPU: 3 PID: 6641 Comm: sync Not tainted 5.10.0-00050-g844b9b09b393-dirty #197
[   52.118150] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
[   52.120349] Call Trace:
[   52.120818]  dump_stack+0xa6/0xd5
[   52.121390]  ubifs_ro_mode+0x54/0x60 [ubifs]
[   52.122131]  ubifs_assert_failed+0x4b/0x80 [ubifs]
[   52.122950]  do_commit.cold+0x2af/0x7e3 [ubifs]
[   52.123747]  ? sync_inodes_sb+0x27c/0x420
[   52.124409]  ? hrtimer_try_to_cancel+0x20/0x170
[   52.125239]  ubifs_run_commit+0xd5/0x1d0 [ubifs]
[   52.126059]  ubifs_sync_fs+0xca/0x110 [ubifs]
[   52.126808]  sync_filesystem+0xb2/0x130
[   52.127491]  __se_sys_syncfs+0x56/0xf0
[   52.128114]  __x64_sys_syncfs+0x16/0x20
[   52.128761]  do_syscall_64+0x57/0xc0
[   52.129359]  entry_SYSCALL_64_after_hwframe+0x61/0xc6
[   52.130326] RIP: 0033:0x7fa068faef27

合入后不复现

评论 (1)

chengzhihao 创建了任务 11个月前

Hi czh549642238, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers.

openeuler-ci-bot 添加了
 
sig/Kernel
标签
11个月前
chengzhihao 修改了描述 11个月前
ci-robot 通过合并 Pull Request !8749: ubifs: Check @c->dirty_[n|p任务状态待办的 修改为已完成 11个月前

登录 后才可以发表评论

状态
负责人
项目
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
5329419 openeuler ci bot 1632792936 chengzhihao-czh549642238
1
https://gitee.com/src-openeuler/kernel.git
git@gitee.com:src-openeuler/kernel.git
src-openeuler
kernel
kernel

搜索帮助