From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2A99B35A93E; Fri, 9 Jan 2026 12:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767960579; cv=none; b=E8wmN5iJbKnsl6Sfz4p8LTTE6DKBKqYHFm6GSRweDp45DANgLb2Cyq31E+4FDeCZWVjh+SgywLew6b8hH1W+C/kh+FinmUqAXZNIN8mlKg/AYf9InrFMQdB9LK07FN8e25FHVHyf5jdGJwEQRZeU0KI6Tv7l2hNBwGwNY5s4MBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767960579; c=relaxed/simple; bh=nxkqlgKp4mm+zUZ/+UBYOW2Auw7opM10syhuVKhAX6A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g8Rj89kRfgof/Qi9BlcElwKe0Un/o5cHGRZzGs0zJeH6A9a8UOrz4p8TSh0qM62mwN3txUw/3lAxrpKYIZZ0pOdR3fB4pBMr+xlkTrNxmdEEhUdhrF3AxLvK21+tFKVm8O4k+5L0mO+ZIvwVdz5vQaXbS0EjGVLCMuwbgBBM7wE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qJs/ELvX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qJs/ELvX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A345C4CEF1; Fri, 9 Jan 2026 12:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767960578; bh=nxkqlgKp4mm+zUZ/+UBYOW2Auw7opM10syhuVKhAX6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJs/ELvXn6aJxzeiZZCrIKvlgBnhbmrLyvnOpdcVxgDtkohuGKodo+nD9AZ02SbMv lZoVqKQ7nraXMOxYxRmNX8qB3RMuTQdFflVzLu0oe5q+3jMnjZZTHPfN4SDi9P87yT QSk4jNPC0C1Alur0QyhwYqBifHyQDlfY2CkKavH8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+6e493c165d26d6fcbf72@syzkaller.appspotmail.com, Tetsuo Handa , Jan Kara , Theodore Tso , stable@kernel.org Subject: [PATCH 6.6 426/737] jbd2: use a per-journal lock_class_key for jbd2_trans_commit_key Date: Fri, 9 Jan 2026 12:39:25 +0100 Message-ID: <20260109112150.022039632@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112133.973195406@linuxfoundation.org> References: <20260109112133.973195406@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tetsuo Handa commit 524c3853831cf4f7e1db579e487c757c3065165c upstream. 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=6e493c165d26d6fcbf72 Signed-off-by: Tetsuo Handa Tested-by: syzbot+6e493c165d26d6fcbf72@syzkaller.appspotmail.com Reviewed-by: Jan Kara Message-ID: <987110fc-5470-457a-a218-d286a09dd82f@I-love.SAKURA.ne.jp> Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 6 ++++-- include/linux/jbd2.h | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1563,7 +1563,6 @@ static journal_t *journal_init_common(st 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; @@ -1572,6 +1571,7 @@ static journal_t *journal_init_common(st if (!journal) return ERR_PTR(-ENOMEM); + lockdep_register_key(&journal->jbd2_trans_commit_key); journal->j_blocksize = blocksize; journal->j_dev = bdev; journal->j_fs_dev = fs_dev; @@ -1601,7 +1601,7 @@ static journal_t *journal_init_common(st journal->j_max_batch_time = 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); /* The journal is marked for error until we succeed with recovery! */ journal->j_flags = JBD2_ABORT; @@ -1648,6 +1648,7 @@ err_cleanup: 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); } @@ -2229,6 +2230,7 @@ int jbd2_journal_destroy(journal_t *jour crypto_free_shash(journal->j_chksum_driver); kfree(journal->j_fc_wbuf); kfree(journal->j_wbuf); + lockdep_unregister_key(&journal->jbd2_trans_commit_key); kfree(journal); return err; --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1266,6 +1266,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; /** * @j_fc_cleanup_callback: