From: Shinichiro Kawasaki via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Chao Yu <chao@kernel.org>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
Damien Le Moal <dlemoal@kernel.org>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] [PATCH v2 1/1] f2fs: fix lockdep WARN of sbi->cp_global_sem and q->q_usage_counter
Date: Thu, 5 Mar 2026 08:49:59 +0000 [thread overview]
Message-ID: <aalBX7IlREU-Yc4R@shinmob> (raw)
In-Reply-To: <4e22d920-37dc-4414-b512-87343625f1e5@kernel.org>
On Mar 05, 2026 / 10:03, Chao Yu wrote:
[...]
> Updated link as below which includes compile error fix.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/commit/?h=bugfix/syzbot&id=ef20840493da6cb26bb910a73c46413a17ea58e7
>
I applied the patch above and ran my test workload, then I observed the
BUG below.
Mar 05 14:27:51 redsun40 kernel: BUG: key ff1100011a6b5ea0 has not been registered!
Mar 05 14:27:51 redsun40 kernel: ------------[ cut here ]------------
Mar 05 14:27:51 redsun40 kernel: DEBUG_LOCKS_WARN_ON(1)
Mar 05 14:27:51 redsun40 kernel: WARNING: kernel/locking/lockdep.c:4976 at lockdep_init_map_type+0x122/0x220, CPU#11: mount/1829
4969 /* |
4970 * Sanity check, the lock-class key must either have been allocated |
4971 * statically or must have been registered as a dynamic key. |
4972 */ |
4973 if (!static_obj(key) && !is_dynamic_key(key)) { |
4974 if (debug_locks) |
4975 printk(KERN_ERR "BUG: key %px has not been registered!\n", key);
4976 DEBUG_LOCKS_WARN_ON(1); |
4977 return; |
4978 } |
From the comment, I learned that cp_global_sem_key should be registered. I made
the additional patch below. With this, I observed no lockdep splat, no WARN :)
Great.
Chao, thank you again for the solution idea. I would like to ask you to take the
next step to upstream the fix. If it helps, I can post the patch on behalf of
you, but your action might be faster.
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 23ef8816c04..1d97dded4ee 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4949,6 +4949,7 @@ static int f2fs_fill_super(struct super_block *sb, struct fs_context *fc)
mutex_init(&sbi->writepages);
init_f2fs_rwsem_trace(&sbi->cp_global_sem, sbi, LOCK_NAME_CP_GLOBAL);
#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ lockdep_register_key(&sbi->cp_global_sem_key);
lockdep_set_class(&sbi->cp_global_sem.internal_rwsem,
&sbi->cp_global_sem_key);
#endif
@@ -5423,6 +5424,9 @@ static int f2fs_fill_super(struct super_block *sb, struct fs_context *fc)
free_sb_buf:
kfree(raw_super);
free_sbi:
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ lockdep_unregister_key(&sbi->cp_global_sem_key);
+#endif
kfree(sbi);
sb->s_fs_info = NULL;
@@ -5504,6 +5508,9 @@ static void kill_f2fs_super(struct super_block *sb)
/* Release block devices last, after fscrypt_destroy_keyring(). */
if (sbi) {
destroy_device_list(sbi);
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ lockdep_unregister_key(&sbi->cp_global_sem_key);
+#endif
kfree(sbi);
sb->s_fs_info = NULL;
}
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-03-05 9:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 12:52 [f2fs-dev] [PATCH v2 0/1] f2fs: fix lockdep WARN of sbi->cp_global_sem and q->q_usage_counter Shin'ichiro Kawasaki via Linux-f2fs-devel
2026-02-18 12:52 ` [f2fs-dev] [PATCH v2 1/1] " Shin'ichiro Kawasaki via Linux-f2fs-devel
2026-02-24 3:26 ` Jaegeuk Kim via Linux-f2fs-devel
2026-02-24 6:28 ` Shinichiro Kawasaki via Linux-f2fs-devel
2026-02-27 20:32 ` Jaegeuk Kim via Linux-f2fs-devel
2026-03-04 4:57 ` Shinichiro Kawasaki via Linux-f2fs-devel
2026-03-04 8:55 ` Chao Yu via Linux-f2fs-devel
2026-03-05 1:38 ` Chao Yu via Linux-f2fs-devel
2026-03-05 1:52 ` Shinichiro Kawasaki via Linux-f2fs-devel
2026-03-05 2:03 ` Chao Yu via Linux-f2fs-devel
2026-03-05 8:49 ` Shinichiro Kawasaki via Linux-f2fs-devel [this message]
2026-03-06 12:18 ` Chao Yu via Linux-f2fs-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aalBX7IlREU-Yc4R@shinmob \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=dlemoal@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.