From nobody Mon Feb 9 04:28:14 2026 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F89811CA9; Wed, 22 Oct 2025 11:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761131522; cv=none; b=mub4VibXDcSx0iv7/D5ngsEZtYz+t+C8hOeVAj5WiCdqKgyZAR5j2/KXnVj6rP9FWc5DJH2SOJ4fGrx/2308mm00DwRqVDb1aKG9K//OzH+ZyKiWi0buemKsySUtSznf9rWs/ite1hynDYWdrKAwZyhWkPvmAzawXoTm4nTyuto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761131522; c=relaxed/simple; bh=5UpbW5vWG0sKkOVn393oZxy1cQ9r0yyAQQeqLNxH94M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hmoVPhyT1SE57GjG9gDqUr8Q82MMEN3p2qlmRGbX01mSCRrLjvO8hT1ML0b14p8NnesC7TvJboC3eJDMjGdVLeBpdbgL4l9LK0D41NANi9oA8y+raAfP2fuJWUabhDLkP7NA459NjlcyyOUymQk2EWRt+pDapjcxdjzz+rVfWr4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 59MBBceu083811; Wed, 22 Oct 2025 20:11:38 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from [192.168.1.10] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 59MBBc28083808 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Wed, 22 Oct 2025 20:11:38 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <987110fc-5470-457a-a218-d286a09dd82f@I-love.SAKURA.ne.jp> Date: Wed, 22 Oct 2025 20:11:37 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2] jbd2: allocate lock_class_key for jbd2_handle dynamically To: Jan Kara Cc: "Theodore Ts'o" , Andreas Dilger , Jan Kara , "linux-ext4@vger.kernel.org" , LKML References: <93744126-237b-4e36-8a62-a33e1fb52051@I-love.SAKURA.ne.jp> <96c8fca1-7568-46c8-a5ad-af4699b95d5e@I-love.SAKURA.ne.jp> Content-Language: en-US From: Tetsuo Handa In-Reply-To: Content-Transfer-Encoding: quoted-printable X-Virus-Status: clean X-Anti-Virus-Server: fsav203.rs.sakura.ne.jp Content-Type: text/plain; charset="utf-8" syzbot is reporting possibility of deadlock due to sharing lock_class_key for jbd2_handle across ext4 and ocfs2. But this is a false positive, for one disk partition can't have two filesystems at the same time. Reported-by: syzbot+6e493c165d26d6fcbf72@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D6e493c165d26d6fcbf72 Signed-off-by: Tetsuo Handa Tested-by: syzbot+6e493c165d26d6fcbf72@syzkaller.appspotmail.com Reviewed-by: Jan Kara --- fs/jbd2/journal.c | 6 ++++-- include/linux/jbd2.h | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index d480b94117cd..f43474002f50 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1521,7 +1521,6 @@ static journal_t *journal_init_common(struct block_de= vice *bdev, struct block_device *fs_dev, unsigned long long start, int len, int blocksize) { - static struct lock_class_key jbd2_trans_commit_key; journal_t *journal; int err; int n; @@ -1530,6 +1529,7 @@ static journal_t *journal_init_common(struct block_de= vice *bdev, if (!journal) return ERR_PTR(-ENOMEM); =20 + lockdep_register_key(&journal->jbd2_trans_commit_key); journal->j_blocksize =3D blocksize; journal->j_dev =3D bdev; journal->j_fs_dev =3D fs_dev; @@ -1560,7 +1560,7 @@ static journal_t *journal_init_common(struct block_de= vice *bdev, journal->j_max_batch_time =3D 15000; /* 15ms */ atomic_set(&journal->j_reserved_credits, 0); lockdep_init_map(&journal->j_trans_commit_map, "jbd2_handle", - &jbd2_trans_commit_key, 0); + &journal->jbd2_trans_commit_key, 0); =20 /* The journal is marked for error until we succeed with recovery! */ journal->j_flags =3D JBD2_ABORT; @@ -1611,6 +1611,7 @@ static journal_t *journal_init_common(struct block_de= vice *bdev, kfree(journal->j_wbuf); jbd2_journal_destroy_revoke(journal); journal_fail_superblock(journal); + lockdep_unregister_key(&journal->jbd2_trans_commit_key); kfree(journal); return ERR_PTR(err); } @@ -2187,6 +2188,7 @@ int jbd2_journal_destroy(journal_t *journal) jbd2_journal_destroy_revoke(journal); kfree(journal->j_fc_wbuf); kfree(journal->j_wbuf); + lockdep_unregister_key(&journal->jbd2_trans_commit_key); kfree(journal); =20 return err; diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 43b9297fe8a7..f5eaf76198f3 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1253,6 +1253,12 @@ struct journal_s */ struct lockdep_map j_trans_commit_map; #endif + /** + * @jbd2_trans_commit_key: + * + * "struct lock_class_key" for @j_trans_commit_map + */ + struct lock_class_key jbd2_trans_commit_key; =20 /** * @j_fc_cleanup_callback: --=20 2.47.3