Skip to contentSkip to conversation

New: F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

f2fs-dev bugzilla-daemon--- via Linux-f2fs-devel 1 participant 7 messages Jul 7, 2025 – Jul 29, 2025

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=220321

Bug ID: 220321
Summary: F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is
flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn
Product: File System
Version: 2.5
Hardware: ARM
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: f2fs
Assignee: [email protected]
Reporter: [email protected]
Regression: No

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/f2fs/super.c?h=v6.12.36

The panic_on_warn occurred using UFS device test app with high probability.

Occurs when putting the 'quota_release_work' into the workqueue. The 'quota_release_work' uses 'system_unbound_wq', but WQ_MEM_RECLAIM flag is not used when creating.

Therefore, before adding the 'quota_release_work' to the work queue, check the previously operated work queue, which seems to have been created using the WQ_MEM_RECLAIM flag.
Previouse work queue is 'writeback:wb_workfn'.
So occurred below the problem.

When using a work queue, it seems like you should use a work queue with 'WQ_MEM_RECLAIM' instead of system_unbound_wq.

[6: kworker/u40:2: 7357] ------------[ cut here ]------------ [6: kworker/u40:2: 7357] workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn
[6: kworker/u40:2: 7357] WARNING: CPU: 6 PID: 7357 at kernel/workqueue.c:3721 check_flush_dependency+0x160/0x16c

[6: kworker/u40:2: 7357] Workqueue: writeback wb_workfn (flush-8:0) [6: kworker/u40:2: 7357] pstate: 634020c5 (nZCv daIF +PAN -UAO +TCO +DIT -SSBS BTYPE=--)

[6:  kworker/u40:2: 7357] pc : check_flush_dependency+0x160/0x16c
[6:  kworker/u40:2: 7357] lr : check_flush_dependency+0x160/0x16c
[6:  kworker/u40:2: 7357] sp : ffffffc0aa746b40
[6:  kworker/u40:2: 7357] x29: ffffffc0aa746b40 x28: 18ffff882b081000 x27:

0000000000000000
[6: kworker/u40:2: 7357] x26: caffff88280841a0 x25: 3bffff8801860900 x24:
0000000000000000
[6: kworker/u40:2: 7357] x23: b7ffff880185a000 x22: 84ffff8805128400 x21:
ffffffd01051b04c
[6: kworker/u40:2: 7357] x20: 83ffff8064571840 x19: beffff8800033400 x18:
ffffffd012b19dc0
[6: kworker/u40:2: 7357] x17: 454d5f5157212067 x16: 6e696873756c6620 x15:
51572120676e6968
[6: kworker/u40:2: 7357] x14: 73756c6620736920 x13: 65725f61746f7571 x12:
3a646e756f626e75
[6: kworker/u40:2: 7357] x11: 000000000000009c x10: ffffffc0aa746ad0 x9 :
9511e74e66c49200
[6: kworker/u40:2: 7357] x8 : 9511e74e66c49200 x7 : ffffffffffffffff x6 :
ffffffd0117ee30c
[6: kworker/u40:2: 7357] x5 : 0000000000000000 x4 : 0000000000000001 x3 :
0000000000000000
[6: kworker/u40:2: 7357] x2 : 0000000000000002 x1 : 00000000000000ff x0 :
ffffffbc0aa746ab

[6:  kworker/u40:2: 7357] Call trace:
[6:  kworker/u40:2: 7357]  check_flush_dependency+0x160/0x16c
[6:  kworker/u40:2: 7357]  __flush_work+0x168/0x738
[6:  kworker/u40:2: 7357]  flush_delayed_work+0x58/0x70
[6:  kworker/u40:2: 7357]  dquot_writeback_dquots+0x90/0x4bc
[6:  kworker/u40:2: 7357]  f2fs_do_quota_sync+0x120/0x284
[6:  kworker/u40:2: 7357]  f2fs_write_checkpoint+0x58c/0xe18
[6:  kworker/u40:2: 7357]  f2fs_gc+0x3e8/0xd78
[6:  kworker/u40:2: 7357]  f2fs_balance_fs+0x204/0x284
[6:  kworker/u40:2: 7357]  f2fs_write_single_data_page+0x700/0xaf0
[6:  kworker/u40:2: 7357]  f2fs_write_data_pages+0xe94/0x15bc
[6:  kworker/u40:2: 7357]  do_writepages+0x170/0x3f8
[6:  kworker/u40:2: 7357]  __writeback_single_inode+0xa0/0x8c4
[6:  kworker/u40:2: 7357]  writeback_sb_inodes+0x2ac/0x708
[6:  kworker/u40:2: 7357]  __writeback_inodes_wb+0xc0/0x118
[6:  kworker/u40:2: 7357]  wb_writeback+0x1f4/0x664
[6:  kworker/u40:2: 7357]  wb_workfn+0x62c/0x900
[6:  kworker/u40:2: 7357]  process_one_work+0x3f8/0x968
[6:  kworker/u40:2: 7357]  worker_thread+0x610/0x794
[6:  kworker/u40:2: 7357]  kthread+0x1c4/0x1e4
[6:  kworker/u40:2: 7357]  ret_from_fork+0x10/0x20
[6:  kworker/u40:2: 7357] Kernel panic - not syncing: kernel: panic_on_warn set

...

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw

[f2fs-dev] [Bug 220321] F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

https://bugzilla.kernel.org/show_bug.cgi?id=220321

Chao Yu ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #1 from Chao Yu ([email protected]) ---
IIUC, do you mean it needs to create wb_workfn workqueue w/ WQ_MEM_RECLAIM?

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#2 lore raw

[f2fs-dev] [Bug 220321] F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

In reply to bugzilla-daemon--- via Linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=220321

--- Comment #2 from SEO HOYOUNG ([email protected]) ---
Yes.
A problem occurred when quota_release_work used a workqueue without WQ_MEM_RECLAIM flag.
So I think we should use workqueue with WQ_MEM_RECLAIM flag.
The WQ_MEM_RECLAIM flag cannot be added to system_unbound_wq, so how about you to create a new workqueue for dquot?

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#3 lore raw

[f2fs-dev] [Bug 220321] F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

In reply to bugzilla-daemon--- via Linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=220321

--- Comment #3 from SEO HOYOUNG ([email protected]) --- Our development system occurred this problem again. It seems that write data to f2fs using write back option.

The wb_wrokfn function use writeback workqueue.
And the writeback workqueue created using WQ_MEM_RECLAIM option.

static int __init default_bdi_init(void)

 {
         bdi_wq = alloc_workqueue("writeback", WQ_MEM_RECLAIM | WQ_UNBOUND |
                                  WQ_SYSFS, 0);
         if (!bdi_wq)
                 return -ENOMEM;
         return 0;

}

So it occurred kernel panic when insert quota_release_work to system_unbound_wq during wb_workfn working.
But it seems that could not add WQ_MEM_RECLAIM to system_unbound_wq. Therefore, it would be better to remove the WQ_MEM_RECLAIM flag from the bdi_wq workcue.
Is it possible?

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#4 lore raw

[f2fs-dev] [Bug 220321] F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

In reply to bugzilla-daemon--- via Linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=220321

--- Comment #4 from Chao Yu ([email protected]) ---
Sorry for the delay.

The workqueue is not allocated by f2fs, not sure this is a f2fs bug...

Can you please report this issue to fsdevel mailing list:
[email protected]?

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#5 lore raw

[f2fs-dev] [Bug 220321] F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

In reply to bugzilla-daemon--- via Linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=220321

--- Comment #5 from SEO HOYOUNG ([email protected]) --- Hi, I uploaded to mainline fix patch.
But I do not know it is right.
https://lore.kernel.org/linux-scsi/[email protected]/T/#u

I thought of another way, how about below it?

How about it to change "flush_delayed_work" to "cancel_work_sync" or "cancel_delayed_work_sync".
Then it will be wait until writeback workqueue done.
And "quota_release_work" function will queueing to events_unbound. Because if "cancel_work_sync" is called, the second argument of "__flsuh work" is called as true, and "check_flush_dependency" will be return normally, so it is unlikely that there will be a problem.

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#6 lore raw

[f2fs-dev] [Bug 220321] F2FS: workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn

In reply to bugzilla-daemon--- via Linux-f2fs-devel

https://bugzilla.kernel.org/show_bug.cgi?id=220321

SEO HOYOUNG ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
Component|f2fs |devfs

Signature · 9 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel