Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2211750/?format=api
{ "id": 2211750, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2211750/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260317084624.457185-5-me@linux.beauty/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.2/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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260317084624.457185-5-me@linux.beauty>", "list_archive_url": null, "date": "2026-03-17T08:46:19", "name": "[RFC,v5,4/7] ext4: fast commit: avoid self-deadlock in inode snapshotting", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "4354f4aadf4134e4f9e3dd2f3ed23d71c5db05c6", "submitter": { "id": 84264, "url": "http://patchwork.ozlabs.org/api/1.2/people/84264/?format=api", "name": "Li Chen", "email": "me@linux.beauty" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260317084624.457185-5-me@linux.beauty/mbox/", "series": [ { "id": 496215, "url": "http://patchwork.ozlabs.org/api/1.2/series/496215/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=496215", "date": "2026-03-17T08:46:15", "name": "ext4: fast commit: snapshot inode state for FC log", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/496215/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2211750/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2211750/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=mFs9=BR=vger.kernel.org=linux-ext4+bounces-15101-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=XLcLjTlm;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=mfs9=br=vger.kernel.org=linux-ext4+bounces-15101-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c15:e001:75::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=XLcLjTlm;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15101-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=\"XLcLjTlm\"", "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 (gandalf.ozlabs.org [150.107.74.76])\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 4fZm1F4zWdz1y1P\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Mar 2026 19:52:17 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fZm1F4W9Gz4wDm\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Mar 2026 19:52:17 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fZm1F4SHwz4w9k; Tue, 17 Mar 2026 19:52:17 +1100 (AEDT)", "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::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 4fZm186L7nz4wDm\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 17 Mar 2026 19:52:12 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id BA862300E1BC\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 17 Mar 2026 08:52:11 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 255E339E166;\n\tTue, 17 Mar 2026 08:52:10 +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 822C628A1E6;\n\tTue, 17 Mar 2026 08:52:08 +0000 (UTC)", "by mx.zohomail.com with SMTPS id 1773737211427721.5850976716408;\n\tTue, 17 Mar 2026 01:46:51 -0700 (PDT)" ], "ARC-Seal": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707; t=1773737537; cv=pass;\n\tb=m0HjAfFCW3+wP420Y27HPk49+7OZGSsELeZZ34bx+4Clhps0rifWby16KeWVxhks1NuZVwyRU5x5QKfHxNZ9gngoFGZBvJgSdzwhH5TvLnkLWK46b/S2ATHjPrxFa+w5juAb5+w5xIrPxkHnM81rPC+9EI8ts3rS2zJCU5NnEZJentwZ5nOMiAU8DjlcLHMsZnnFzUtNGlhTtNOM31ZyLHjKo6KGFjuHTHZtduT62q37N+tl4DLWV9i3Pv+08+xnT5HlcZ+4tBK5dtdX15Nn/Fgui5K5UBUN89xvnQCDqT5HI7Xia2eNiDjyiAQVqP0m9juI6CAIdxd5Y7a9H+vTOg==", "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1773737529; cv=pass;\n b=Remjwo/i6Q/xqvnQ4xYd+GlZ8TjPxDPrG4zyJbJ9ytY/g7iiCqOKM6ei04y5dvQthO9cmKVypSoJ1hTKPtKlPa2VAsFxeCHy23dsR+mQhiD0IvuvOJ2mq/MH8k1RMCBzM+u9+wY9n8XzfOMcaqbZk25Oo2HRmV7WfItTpu7MHIc=", "i=1; a=rsa-sha256; t=1773737213; cv=none;\n\td=zohomail.com; s=zohoarc;\n\tb=JezJaqyFIfS9G8rZszV2Aak172v0p/+7Plqvi2s7uZAN88kyEY5XBDU+dUIIc7QoDt1cT/CiQ6rofwV5pad8o4ymC7YJnj4M5bhok5uFkmFYs+Kbwn4fWJSDKOP5aKmPe4PkAU2VVcWdsfXDfZ5NI8ZdjDnIDemDwZ3S4uob2Qc=" ], "ARC-Message-Signature": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1773737537; c=relaxed/relaxed;\n\tbh=mdUkB7ZoMlS0Nm7V75WGCv98FsNNiW9rTV9vSFiRbYU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=EZNksWDQ2reGK9X5nR3EsS4K3no1IWpJ4e5M9mHJrMvBSP6Z3SOVlPD7Fnt1vwNW1Mr7zLxkmKwa5CrcxbY2ytJufnHi+SXmJjZtJXpWotKxVPhpxnj1HzKYtkhUEF8JCFGTiDOlC4vGx2zQnXsrFHVJXxzwI7ewetTVsyc4/moVSOtqthk/3U7IoaMMZYpm4iIxgw2dbEbkmjGoRu6mhxEU41R3Lnixsej6CNwdekjicbFA96G6IpLJy3Ytb40x7Tjl2uFItA34dL0+kekYKtft0BmTBd4uwIONx1wIzU3qi1IMQff+UGwTuGTK87VBh4Jr6PgUfB71HTTUaO3V1g==", "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1773737529; c=relaxed/simple;\n\tbh=pPVgC7XALicaXqiFRqn5ENOKIdE0tV8l4YECfF86Yio=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=SOHib/PeyZwWS26RV1D95A55jOOdWpQyBZrKutZO6XaeP1t4sJXB8Y83IruWUer53mYRcJh3DB4KJde3iqA5ZlVP2YKG/EJRxYzZT/+4rijZS0JBT3hMBABuZ3TMya0BV7z0gypgdfbZXGMgCG4LJqD3UgDBeDe1SJI/jIojVqU=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;\n s=zohoarc;\n\tt=1773737213;\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=mdUkB7ZoMlS0Nm7V75WGCv98FsNNiW9rTV9vSFiRbYU=;\n\tb=enGpw7Jtb6QPSiNRzfmWkcVU+A8kTZdlumKt9GHZRAboMj+CMMN1vqeyKzA7zHloH7EaLI/WGxFeTrXO8TbF0uPhjp3IQMCt0lkeZG//zGP60R3BanhLIhFvTUbNmYrxjQdjzWkkBqv4CWOCpYHP1jM3XfRBiCVgsNwbYZb+VBI=" ], "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=XLcLjTlm; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15101-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=XLcLjTlm; 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=1773737213;\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=mdUkB7ZoMlS0Nm7V75WGCv98FsNNiW9rTV9vSFiRbYU=;\n\tb=XLcLjTlmPs/Ff0n7zhgEoLatOJOoRp7gEWDjdGbz0Oa7y0BNcvZohlR2M5xEzLYp\n\tSnjId5PIUltYlimLLTtkHj9yMwMZfINXikbEb2+H3Z0cI1IwlnrEDhRqNO+q9Rhy69b\n\tRnIpUSCJcUAmJ5edV3Y1UEG8hR6AMK2lmGozA0Xo=", "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\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 v5 4/7] ext4: fast commit: avoid self-deadlock in inode\n snapshotting", "Date": "Tue, 17 Mar 2026 16:46:19 +0800", "Message-ID": "<20260317084624.457185-5-me@linux.beauty>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260317084624.457185-1-me@linux.beauty>", "References": "<20260317084624.457185-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 809170d46167b..966211a3342a0 100644\n--- a/fs/ext4/fast_commit.c\n+++ b/fs/ext4/fast_commit.c\n@@ -1210,13 +1210,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@@ -1226,12 +1225,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@@ -1241,10 +1248,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@@ -1312,8 +1315,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@@ -1565,6 +1569,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", "v5", "4/7" ] }