Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220886/?format=api
{ "id": 2220886, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220886/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260408112020.716706-5-me@linux.beauty/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.1/projects/8/?format=api", "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-5-me@linux.beauty>", "date": "2026-04-08T11:20:15", "name": "[RFC,v6,4/7] ext4: fast commit: avoid self-deadlock in inode snapshotting", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4354f4aadf4134e4f9e3dd2f3ed23d71c5db05c6", "submitter": { "id": 84264, "url": "http://patchwork.ozlabs.org/api/1.1/people/84264/?format=api", "name": "Li Chen", "email": "me@linux.beauty" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260408112020.716706-5-me@linux.beauty/mbox/", "series": [ { "id": 499121, "url": "http://patchwork.ozlabs.org/api/1.1/series/499121/?format=api", "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/2220886/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220886/checks/", "tags": {}, "headers": { "Return-Path": "\n <SRS0=JiFm=CH=vger.kernel.org=linux-ext4+bounces-15673-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=SK1ZOL6r;\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=jifm=ch=vger.kernel.org=linux-ext4+bounces-15673-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=SK1ZOL6r;\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-15673-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=\"SK1ZOL6r\"", "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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frLNt68lWz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 21:26:22 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4frLNt5dyXz4wsm\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 21:26:22 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4frLNt5Yw6z4wsQ; Wed, 08 Apr 2026 21:26:22 +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 4frLNq1sS2z4wsm\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 08 Apr 2026 21:26:19 +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 03F7A307185B\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 8 Apr 2026 11:22:55 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7D530389E1D;\n\tWed, 8 Apr 2026 11:22:54 +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 057E421CC5A;\n\tWed, 8 Apr 2026 11:22:52 +0000 (UTC)", "by mx.zohomail.com with SMTPS id 1775647270387580.785757473374;\n\tWed, 8 Apr 2026 04:21:10 -0700 (PDT)" ], "ARC-Seal": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775647582; cv=pass;\n\tb=bdUsMiRR9N+79shBEEifnXPnCOb9g2G+ZlHNRuZ2gIaA25bYv4pfpWNEAlrZd/yOqjGlSVrl6Piw30RJdQnMVdsogOOs2UhLpNY+fM58vhGsUvOzK22J7hHMyCkW3dCMJIHe5uw2zbVPK9IBl663GqwVeUCu/Sqr0N1TjxvWUHnkjWUPIy56KMOogOLjPX9Ixm9onTxcowCiCOK9HYqDaBvjBP5ZSMxYTXBVfLarfud9aRbsMQvAtG5Wo2z7HdmBNcjWy9u4wKPE9ZcT0Fi+tThkhuLaTSJs1KjnnBwNY+XVfmr9RuqLMngyMw+h1FZO4AMO4aKNei2jnXZnYEk9FA==", "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775647374; cv=pass;\n b=Vbkl19s62xZZqNat3cB2TysODPCubpc7QWGewfKG0bPDADtbc7efvh1SbfFUSsJHjKyQm5xx60OtkBUyGSl32nGzv3nLp09yK93K7kkRXbNFg6SjEpx8gcAPeq0dydXKa4R1D7wS1EVIQPWmrwi5QmmaWiFg81rHVuqL3c7+kmU=", "i=1; a=rsa-sha256; t=1775647272; cv=none;\n\td=zohomail.com; s=zohoarc;\n\tb=Qgs5to2Kqp9eovFAXHseUT7kLJu8eswOwNdQn0bth37CTiuMzaeCsZoDnJQV5WnZS4ApHru9tZnb08y8dCs/Ax/NnE59HiMjLgBLu8mhithQZ9hHhr8POhXkClgD3IYS2v56HtvzL5auy9MwepNDffSoqVUnFSdH/nGpFlitkwQ=" ], "ARC-Message-Signature": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775647582; c=relaxed/relaxed;\n\tbh=HKCxdts6cIZPLinOc8np4ie5tl7nN4i8vAqvBYDOhyQ=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=REJLm0GzRxSOfxp8mpYZFIJzzQoDiuncaL28JssohHs4I7BJLlsbLp5n0OD1En3V/QXOBSaGyE8HLP9ym4jrBnGYJ7TxLBwqVvjmrw8f3fhY1EcGoWYL4AMz9ldXEs4jpCe84eABkwB6BoBT4UopZ5qEo6tXJZwbB8JgayFbMhU2rXZU1d9xO2enbBZFfHt/wmqXiBjFtqaDbeoW8QZ0DR6RJ9fhURH8Ra0FV83Fb6LeSPkh3jOaKYHbzyCn0mtTrq55fJPDqtoKHm5xM/WGLsvEHUUX50QuKXyCgZgkiaLaSs5NqzOVYMBUyXazIJe4LVKyhHZICF4WnJF7NAduaA==", "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775647374; c=relaxed/simple;\n\tbh=cdViAXIRvRTwHbSVIuQGHJ3iK3mlSgOi21LRzhT8Frg=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=d92wjhdtl5doaNR2STt0Rvepp2LRlr0KvnhMYxlluLaKepOdibrnAYnGRZI219vdZiS8AO1Z2u218g5rS6TrtYgrM9voSKio65z6vqaok8hqdu5LZ7R9nvK3pkfMytX0M0iub++XJFYG+Ktnb642CcBdRlgTwDPOQnUDC45qC8Y=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;\n s=zohoarc;\n\tt=1775647272;\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=HKCxdts6cIZPLinOc8np4ie5tl7nN4i8vAqvBYDOhyQ=;\n\tb=LyiebhBLs8LiL6nfWpLpLRj2J4btJlgNhYFdYRNCVnxRHSSuWlAbDKzRp7yn/jrTG0glymFMcz8qqlwAVKNGymP0X3X6SDU88dR1xgUkNADcyFuou83bNZlVHLjlNoVdPmNqaPjC83e17j8R61HMyJSa5wNkWLTym4LTTsW9lAs=" ], "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=SK1ZOL6r; 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-15673-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=SK1ZOL6r; 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=1775647272;\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=HKCxdts6cIZPLinOc8np4ie5tl7nN4i8vAqvBYDOhyQ=;\n\tb=SK1ZOL6rSI3r+68R2f3pZh9l58rYNr8SNLAzUcQH0sozEvYjNh4/i6Bpw3DGghrL\n\tbjr7fNihC7GeJdETZNr1od+GX/J/Cx4Ea9WciqN8eA8vhiUk/D0okvU73vLIXrQJe0F\n\t1DXyQRCiSFtLUoclogNhCM062NiIqMt0YrMemS2M=", "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 4/7] ext4: fast commit: avoid self-deadlock in inode\n snapshotting", "Date": "Wed, 8 Apr 2026 19:20:15 +0800", "Message-ID": "<20260408112020.716706-5-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": "ext4_fc_snapshot_inodes() used igrab()/iput() to pin inodes while building\ncommit-time snapshots. With ext4_fc_del() waiting for\nEXT4_STATE_FC_COMMITTING, iput() can trigger\next4_clear_inode()->ext4_fc_del() in the commit thread and deadlock waiting\nfor the fast commit to finish.\n\nAvoid taking extra references. Collect inode pointers under s_fc_lock and\nrely on EXT4_STATE_FC_COMMITTING to pin inodes until ext4_fc_cleanup()\nclears the bit.\n\nAlso set EXT4_STATE_FC_COMMITTING for create-only inodes referenced\nfrom the dentry update queue, and wake up waiters when ext4_fc_cleanup()\nclears the bit.\n\nSigned-off-by: Li Chen <me@linux.beauty>\n---\n fs/ext4/fast_commit.c | 47 ++++++++++++++++++++++++++++++++-----------\n 1 file changed, 35 insertions(+), 12 deletions(-)", "diff": "diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c\nindex 5ed884cc4b5c..f28e732e9be7 100644\n--- a/fs/ext4/fast_commit.c\n+++ b/fs/ext4/fast_commit.c\n@@ -1211,13 +1211,12 @@ static int ext4_fc_snapshot_inodes(journal_t *journal)\n \n \talloc_ctx = ext4_fc_lock(sb);\n \tlist_for_each_entry(iter, &sbi->s_fc_q[FC_Q_MAIN], i_fc_list) {\n-\t\tinodes[i] = igrab(&iter->vfs_inode);\n-\t\tif (inodes[i])\n-\t\t\ti++;\n+\t\tinodes[i++] = &iter->vfs_inode;\n \t}\n \n \tlist_for_each_entry(fc_dentry, &sbi->s_fc_dentry_q[FC_Q_MAIN], fcd_list) {\n \t\tstruct ext4_inode_info *ei;\n+\t\tstruct inode *inode;\n \n \t\tif (fc_dentry->fcd_op != EXT4_FC_TAG_CREAT)\n \t\t\tcontinue;\n@@ -1227,12 +1226,20 @@ static int ext4_fc_snapshot_inodes(journal_t *journal)\n \t\t/* See the comment in ext4_fc_commit_dentry_updates(). */\n \t\tei = list_first_entry(&fc_dentry->fcd_dilist,\n \t\t\t\t struct ext4_inode_info, i_fc_dilist);\n+\t\tinode = &ei->vfs_inode;\n \t\tif (!list_empty(&ei->i_fc_list))\n \t\t\tcontinue;\n \n-\t\tinodes[i] = igrab(&ei->vfs_inode);\n-\t\tif (inodes[i])\n-\t\t\ti++;\n+\t\t/*\n+\t\t * Create-only inodes may only be referenced via fcd_dilist and\n+\t\t * not appear on s_fc_q[MAIN]. They may hit the last iput while\n+\t\t * we are snapshotting, but inode eviction calls ext4_fc_del(),\n+\t\t * which waits for FC_COMMITTING to clear. Mark them FC_COMMITTING\n+\t\t * so the inode stays pinned and the snapshot stays valid until\n+\t\t * ext4_fc_cleanup().\n+\t\t */\n+\t\text4_set_inode_state(inode, EXT4_STATE_FC_COMMITTING);\n+\t\tinodes[i++] = inode;\n \t}\n \text4_fc_unlock(sb, alloc_ctx);\n \n@@ -1242,10 +1249,6 @@ static int ext4_fc_snapshot_inodes(journal_t *journal)\n \t\t\tbreak;\n \t}\n \n-\tfor (nr_inodes = 0; nr_inodes < i; nr_inodes++) {\n-\t\tif (inodes[nr_inodes])\n-\t\t\tiput(inodes[nr_inodes]);\n-\t}\n \tkvfree(inodes);\n \treturn ret;\n }\n@@ -1313,8 +1316,9 @@ static int ext4_fc_perform_commit(journal_t *journal)\n \tjbd2_journal_lock_updates(journal);\n \t/*\n \t * The journal is now locked. No more handles can start and all the\n-\t * previous handles are now drained. We now mark the inodes on the\n-\t * commit queue as being committed.\n+\t * previous handles are now drained. Snapshotting happens in this\n+\t * window so log writing can consume only stable snapshots without\n+\t * doing logical-to-physical mapping.\n \t */\n \talloc_ctx = ext4_fc_lock(sb);\n \tlist_for_each_entry(iter, &sbi->s_fc_q[FC_Q_MAIN], i_fc_list) {\n@@ -1566,6 +1570,25 @@ static void ext4_fc_cleanup(journal_t *journal, int full, tid_t tid)\n \t\t\t\t\t struct ext4_inode_info,\n \t\t\t\t\t i_fc_dilist);\n \t\t\text4_fc_free_inode_snap(&ei->vfs_inode);\n+\t\t\tspin_lock(&ei->i_fc_lock);\n+\t\t\text4_clear_inode_state(&ei->vfs_inode,\n+\t\t\t\t\t EXT4_STATE_FC_REQUEUE);\n+\t\t\text4_clear_inode_state(&ei->vfs_inode,\n+\t\t\t\t\t EXT4_STATE_FC_COMMITTING);\n+\t\t\tspin_unlock(&ei->i_fc_lock);\n+\t\t\t/*\n+\t\t\t * Make sure clearing of EXT4_STATE_FC_COMMITTING is\n+\t\t\t * visible before we send the wakeup. Pairs with implicit\n+\t\t\t * barrier in prepare_to_wait() in ext4_fc_del().\n+\t\t\t */\n+\t\t\tsmp_mb();\n+#if (BITS_PER_LONG < 64)\n+\t\t\twake_up_bit(&ei->i_state_flags,\n+\t\t\t\t EXT4_STATE_FC_COMMITTING);\n+#else\n+\t\t\twake_up_bit(&ei->i_flags,\n+\t\t\t\t EXT4_STATE_FC_COMMITTING);\n+#endif\n \t\t}\n \t\tlist_del_init(&fc_dentry->fcd_dilist);\n \n", "prefixes": [ "RFC", "v6", "4/7" ] }