{"id":2220883,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220883/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260408112020.716706-3-me@linux.beauty/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.1/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260408112020.716706-3-me@linux.beauty>","date":"2026-04-08T11:20:13","name":"[RFC,v6,2/7] ext4: lockdep: handle i_data_sem subclassing for special inodes","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"99a39abdc9a53517bef77e98b7935b692fd9b014","submitter":{"id":84264,"url":"http://patchwork.ozlabs.org/api/1.1/people/84264/?format=json","name":"Li Chen","email":"me@linux.beauty"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260408112020.716706-3-me@linux.beauty/mbox/","series":[{"id":499121,"url":"http://patchwork.ozlabs.org/api/1.1/series/499121/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=499121","date":"2026-04-08T11:20:11","name":"ext4: fast commit: snapshot inode state for FC log","version":6,"mbox":"http://patchwork.ozlabs.org/series/499121/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220883/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220883/checks/","tags":{},"headers":{"Return-Path":"\n <SRS0=4uP7=CH=vger.kernel.org=linux-ext4+bounces-15671-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.beauty header.i=me@linux.beauty\n header.a=rsa-sha256 header.s=zmail header.b=qlYwjWHf;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=4up7=ch=vger.kernel.org=linux-ext4+bounces-15671-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=\"subspace.kernel.org:zohomail.com\"","gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty","gandalf.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.beauty header.i=me@linux.beauty\n header.a=rsa-sha256 header.s=zmail header.b=qlYwjWHf;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15671-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty\n header.b=\"qlYwjWHf\"","smtp.subspace.kernel.org;\n arc=pass smtp.client-ip=136.143.188.15","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.beauty"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frLM11MGVz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 21:24:45 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4frLM116Cnz4wTL\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 21:24:45 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4frLM111FSz4wpy; Wed, 08 Apr 2026 21:24:45 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4frLLx44D7z4wTL\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 08 Apr 2026 21:24:41 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 07801301BC02\n\tfor <patchwork-incoming@ozlabs.org>; Wed,  8 Apr 2026 11:22:01 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5A3B038839B;\n\tWed,  8 Apr 2026 11:21:59 +0000 (UTC)","from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com\n [136.143.188.15])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id F0AE2387344;\n\tWed,  8 Apr 2026 11:21:57 +0000 (UTC)","by mx.zohomail.com with SMTPS id 1775647257949387.91951926297907;\n\tWed, 8 Apr 2026 04:20:57 -0700 (PDT)"],"ARC-Seal":["i=3; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775647485; cv=pass;\n\tb=OY0vVKNBx6lSw4KJudyNgvWOPjK7M2qh2gdRiFLB+dV0odW4PaNgWd/oa0VF13GntBfh8SjmmlMLOwkMIUTHf9uP94mkys6vArqNdoTpwXPeBV9WwR0H4VuoAP+lTxW/X5JeEhV0ldJ471RbSGTaFy+FiANAiYA7nsDUel9oSwd59kZQiMDdIvo78XlDMlbPO+3wX3TKFDUhaxgiSKT/0gTKwox28ZrILPX62yWrds33A4dO6w/YmsmS25KFhg4fIJ56TqIc+NE9JTAHLL8jD0wSbcTpQpPA4nNKbS5Uz4pcGtCemgjK+G3qxWYWsCLFIQQC5Kfrp+adRSL4BUGc0Q==","i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775647319; cv=pass;\n b=X6ZWLj2CZE0xhJ5vyTob9zidTruqr9WuSp3d0ygFQo4K+MleGtRA/SeF3qTZNsvT+dnqpE0oTkZld8Fwe2kEUhKyWe7a7ZhULmtiBWdVZCPAK69StsAqeJ6VbDa9rwdkNyEBJOVVoQQI0/PiaMT56U0+caSthElYr85YGG0MU8o=","i=1; a=rsa-sha256; t=1775647260; cv=none;\n\td=zohomail.com; s=zohoarc;\n\tb=mziqE4wg/C9GBLJS71Zn/o6TAWIp7Oj+fInmxOTf9Nt42aapgACmOQZ0EpdrUiHxiv0ByKgGn47a1pWJkk5i/Ray+XYGVP6/1VxAMOhsovltR20nMiZGQNtX6Iz5T24jghw1IFymHRIYbkphmsWDUfY5/w7m4HmbnSoJpg6r2nw="],"ARC-Message-Signature":["i=3; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775647485; c=relaxed/relaxed;\n\tbh=YnM0+++sh+xA2p+4r3PPfquGYLX2NEmrLyqDB3uwNlg=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Bp48dMRl+lU+g7Dfh2DivfFMNbjxOvNnOt6Dae5GdXQ/7gmj9r3HCLe2Tr7GPxmZpTPim32T4Sw1wPvdhx3hvbM1H/9r/XBsxrA06500JrBfoWuM1VhMHL0HMLTQPH4Zcld2JZMaqmKaxN0BOv229a/xF4pa6FmO6hKNeDzqqz671fnVIPmP3gqpkYttJiJePd2354v9W/9stb1KnZ7lLw3bBJUZLn9uaIOq8IPevPtXiDiFwcroCI1EAZExHsc0T8IKIqSWBe0PdXSQWVDopQy47N8BMgHP5meJaWVEURqmh9oGAYIyAiop+lB/aueTgO5SSfKUKGwTjyj0ry3sRQ==","i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775647319; c=relaxed/simple;\n\tbh=AKr5Ne+SOqQ2MaUdKMWOqeKOBdL1X/iPI5Ry+IZPdr8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=XuaJyIyvpkP+QkLPOfCn8wkcgtp6hBIFmLD0k1mRO6Llk2cSF2Kx7ZQw2nGXG/Gfg2y0SFCDxCP0/vpVVcxy8qevQej3YeQDl2/9QZHR4W8i6rE/Ofc+Knkk5oxtmmGI9Ni1xIkro8vOkJ8OrvowQKbvw5ouVaog+eoesv50MeU=","i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;\n s=zohoarc;\n\tt=1775647260;\n h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=YnM0+++sh+xA2p+4r3PPfquGYLX2NEmrLyqDB3uwNlg=;\n\tb=lacuzT+xOkwtOAMp9FGn/119Vqx5cNgvERdgMndWiazFWZecpMtzXK2XrrTesQsrk0PhFu8nxvvC1mAVB47ehNQunMw/agmHINeaFx7K9QtgvMzR8XVNfBdonX59ZOP4lTylCzRAGJ71EgoOE+Y72eOrn3BTMnVMk9ofUWxNYM4="],"ARC-Authentication-Results":["i=3; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty;\n dkim=pass (1024-bit key;\n unprotected) header.d=linux.beauty header.i=me@linux.beauty\n header.a=rsa-sha256 header.s=zmail header.b=qlYwjWHf; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15671-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.beauty;\n spf=pass smtp.mailfrom=linux.beauty;\n dkim=pass (1024-bit key) header.d=linux.beauty header.i=me@linux.beauty\n header.b=qlYwjWHf; arc=pass smtp.client-ip=136.143.188.15","i=1; mx.zohomail.com;\n\tdkim=pass  header.i=linux.beauty;\n\tspf=pass  smtp.mailfrom=me@linux.beauty;\n\tdmarc=pass header.from=<me@linux.beauty>"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1775647260;\n\ts=zmail; d=linux.beauty; i=me@linux.beauty;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=YnM0+++sh+xA2p+4r3PPfquGYLX2NEmrLyqDB3uwNlg=;\n\tb=qlYwjWHfHlB1bX8HEH/Xh/8uTq69KF5S9dcSePfkvrZCpZqe9OBXD3euI0eY+Vrg\n\tTR47cmoTTcWX6JzebaKeKunJSu5dG67ps2UFZz14IKFeGwbtp+vTPfJzKkuUlfagjUE\n\t6VouT+k1tHjs/ST9tc5WRlpV4xF6NuV1wEDg42Yw=","From":"Li Chen <me@linux.beauty>","To":"Zhang Yi <yi.zhang@huaweicloud.com>,\n\tTheodore Ts'o <tytso@mit.edu>,\n\tAndreas Dilger <adilger.kernel@dilger.ca>,\n\tBaokun Li <libaokun@linux.alibaba.com>,\n\tJan Kara <jack@suse.cz>,\n\tOjaswin Mujoo <ojaswin@linux.ibm.com>,\n\t\"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>,\n\tZhang Yi <yi.zhang@huawei.com>,\n\tlinux-ext4@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org","Cc":"Steven Rostedt <rostedt@goodmis.org>,\n\tMasami Hiramatsu <mhiramat@kernel.org>,\n\tMathieu Desnoyers <mathieu.desnoyers@efficios.com>,\n\tlinux-trace-kernel@vger.kernel.org,\n\tLi Chen <me@linux.beauty>","Subject":"[RFC v6 2/7] ext4: lockdep: handle i_data_sem subclassing for special\n inodes","Date":"Wed,  8 Apr 2026 19:20:13 +0800","Message-ID":"<20260408112020.716706-3-me@linux.beauty>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260408112020.716706-1-me@linux.beauty>","References":"<20260408112020.716706-1-me@linux.beauty>","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-ZohoMailClient":"External","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"Fast commit can hold s_fc_lock while writing journal blocks. Mapping the\njournal inode can take its i_data_sem. Normal inode update paths can take a\ndata inode i_data_sem and then s_fc_lock, which makes lockdep report a\ncircular dependency.\n\nlockdep treats all i_data_sem instances as one lock class and cannot\ndistinguish the journal inode i_data_sem from a regular inode i_data_sem.\nThe journal inode is not tracked by fast commit and no FC waiters ever\ndepend on it, so this is not a real ABBA deadlock. Assign the journal inode\na dedicated i_data_sem lockdep subclass to avoid the false positive.\n\nInode cache objects can be recycled, so also reset i_data_sem to\nI_DATA_SEM_NORMAL when allocating an ext4 inode. Otherwise a new inode may\ninherit an old subclass (journal/quota/ea) and trigger lockdep warnings.\n\nSigned-off-by: Li Chen <me@linux.beauty>\n---\nChanges in v6:\n- Rebase onto linux-next master as of 2026-04-08.\n- Refresh the patch context around upstream ext4_alloc_inode() changes,\n  without changing the subclassing logic.\n\n fs/ext4/ext4.h  | 4 +++-\n fs/ext4/super.c | 8 ++++++++\n 2 files changed, 11 insertions(+), 1 deletion(-)","diff":"diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 98857292c707..66de888ae411 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -1016,12 +1016,14 @@ do {\t\t\t\t\t\t\t\t\t\t\\\n  *\t\t\t  than the first\n  *  I_DATA_SEM_QUOTA  - Used for quota inodes only\n  *  I_DATA_SEM_EA     - Used for ea_inodes only\n+ *  I_DATA_SEM_JOURNAL - Used for journal inode only\n  */\n enum {\n \tI_DATA_SEM_NORMAL = 0,\n \tI_DATA_SEM_OTHER,\n \tI_DATA_SEM_QUOTA,\n-\tI_DATA_SEM_EA\n+\tI_DATA_SEM_EA,\n+\tI_DATA_SEM_JOURNAL\n };\n \n struct ext4_fc_inode_snap;\ndiff --git a/fs/ext4/super.c b/fs/ext4/super.c\nindex 578508eb4f1a..286f05834900 100644\n--- a/fs/ext4/super.c\n+++ b/fs/ext4/super.c\n@@ -1425,6 +1425,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)\n \text4_fc_init_inode(&ei->vfs_inode);\n \tspin_lock_init(&ei->i_fc_lock);\n \tmmb_init(&ei->i_metadata_bhs, &ei->vfs_inode.i_data);\n+#ifdef CONFIG_LOCKDEP\n+\tlockdep_set_subclass(&ei->i_data_sem, I_DATA_SEM_NORMAL);\n+#endif\n \treturn &ei->vfs_inode;\n }\n \n@@ -5904,6 +5907,11 @@ static struct inode *ext4_get_journal_inode(struct super_block *sb,\n \t\treturn ERR_PTR(-EFSCORRUPTED);\n \t}\n \n+#ifdef CONFIG_LOCKDEP\n+\tlockdep_set_subclass(&EXT4_I(journal_inode)->i_data_sem,\n+\t\t\t     I_DATA_SEM_JOURNAL);\n+#endif\n+\n \text4_debug(\"Journal inode found at %p: %lld bytes\\n\",\n \t\t  journal_inode, journal_inode->i_size);\n \treturn journal_inode;\n","prefixes":["RFC","v6","2/7"]}