Commit d4f1267
f2fs: fix false alarm of lockdep on cp_global_sem lock
commit 6a5e3de upstream.
lockdep reported a potential deadlock:
a) TCMU device removal context:
- call del_gendisk() to get q->q_usage_counter
- call start_flush_work() to get work_completion of wb->dwork
b) f2fs writeback context:
- in wb_workfn(), which holds work_completion of wb->dwork
- call f2fs_balance_fs() to get sbi->gc_lock
c) f2fs vfs_write context:
- call f2fs_gc() to get sbi->gc_lock
- call f2fs_write_checkpoint() to get sbi->cp_global_sem
d) f2fs mount context:
- call recover_fsync_data() to get sbi->cp_global_sem
- call f2fs_check_and_fix_write_pointer() to call blkdev_report_zones()
that goes down to blk_mq_alloc_request and get q->q_usage_counter
Original callstack is in Closes tag.
However, I think this is a false alarm due to before mount returns
successfully (context d), we can not access file therein via vfs_write
(context c).
Let's introduce per-sb cp_global_sem_key, and assign the key for
cp_global_sem, so that lockdep can recognize cp_global_sem from
different super block correctly.
A lot of work are done by Shin'ichiro Kawasaki, thanks a lot for
the work.
Fixes: c426d99 ("f2fs: Check write pointer consistency of open zones")
Cc: stable@kernel.org
Reported-and-tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Closes: https://lore.kernel.org/linux-f2fs-devel/20260218125237.3340441-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent b2f3c48 commit d4f1267
2 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2042 | 2042 | | |
2043 | 2043 | | |
2044 | 2044 | | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
2045 | 2048 | | |
2046 | 2049 | | |
2047 | 2050 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4953 | 4953 | | |
4954 | 4954 | | |
4955 | 4955 | | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
| 4960 | + | |
4956 | 4961 | | |
4957 | 4962 | | |
4958 | 4963 | | |
| |||
5424 | 5429 | | |
5425 | 5430 | | |
5426 | 5431 | | |
| 5432 | + | |
| 5433 | + | |
| 5434 | + | |
5427 | 5435 | | |
5428 | 5436 | | |
5429 | 5437 | | |
| |||
5505 | 5513 | | |
5506 | 5514 | | |
5507 | 5515 | | |
| 5516 | + | |
| 5517 | + | |
| 5518 | + | |
5508 | 5519 | | |
5509 | 5520 | | |
5510 | 5521 | | |
| |||
0 commit comments