Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2186663/?format=api
{ "id": 2186663, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2186663/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260120112538.132774-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": "<20260120112538.132774-5-me@linux.beauty>", "list_archive_url": null, "date": "2026-01-20T11:25:33", "name": "[RFC,v4,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/20260120112538.132774-5-me@linux.beauty/mbox/", "series": [ { "id": 489032, "url": "http://patchwork.ozlabs.org/api/1.2/series/489032/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=489032", "date": "2026-01-20T11:25:32", "name": "ext4: fast commit: snapshot inode state for FC log", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/489032/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2186663/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2186663/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=JiOz=7Z=vger.kernel.org=linux-ext4+bounces-13102-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=ENOfEjcl;\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=jioz=7z=vger.kernel.org=linux-ext4+bounces-13102-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=142.0.200.124\n arc.chain=\"subspace.kernel.org:zohomail.com\"", "gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux.beauty", "gandalf.ozlabs.org;\n spf=fail smtp.mailfrom=vger.kernel.org", "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=ENOfEjcl;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=softfail (domain owner discourages use of this host)\n smtp.mailfrom=vger.kernel.org (client-ip=142.0.200.124;\n helo=dfw.mirrors.kernel.org;\n envelope-from=linux-ext4+bounces-13102-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=\"ENOfEjcl\"", "smtp.subspace.kernel.org;\n arc=pass smtp.client-ip=136.143.188.112", "smtp.subspace.kernel.org;\n dmarc=none (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 4dwQs35zffz1xsg\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 20 Jan 2026 23:01:11 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4dwQs32j0xz4w2R\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 20 Jan 2026 23:01:11 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4dwQs32bVYz4w26; Tue, 20 Jan 2026 23:01:11 +1100 (AEDT)", "from dfw.mirrors.kernel.org (dfw.mirrors.kernel.org [142.0.200.124])\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 4dwQrz6k4Sz4w2R\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 20 Jan 2026 23:01:07 +1100 (AEDT)", "from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby dfw.mirrors.kernel.org (Postfix) with ESMTPS id 29080580970\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 20 Jan 2026 11:27:46 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B337942189C;\n\tTue, 20 Jan 2026 11:26:52 +0000 (UTC)", "from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n [136.143.188.112])\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 C2442421F18;\n\tTue, 20 Jan 2026 11:26:50 +0000 (UTC)", "by mx.zohomail.com with SMTPS id 17689083688141.5664256632151137;\n\tTue, 20 Jan 2026 03:26:08 -0800 (PST)" ], "ARC-Seal": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707; t=1768910471; cv=pass;\n\tb=QavTlFWetsorVkpnd3oFsSJ5s7jmEvZGR4M6VH0quK2GuRpspHsKxJsrJAF2cbX8k68f+fR/HYFQ8fCrjzAnrTfCxwZBnT4fkTTg6zKuLkfFvU8WTlCi787akPU5bFNSEA5Xa6mW1dJ+M+DmnzOa+5QxBPltTeOVp0us/Ou34xeA6p9NIms8zJIHeD8aKlhQRAnEfFtvnhyksQ5oggUVZB6UVqQGyz4i46CFSivMPI/eU2ZnI5oNE4FhTaeimy9OAhAY2BT1lOqAFvC1hhRU6FvATmplDNgJJevA2s7vbxUOBt6qkSimTtbfPbM/8B2mpqgJd6PG/4O+mA+sbmVy1g==", "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1768908412; cv=pass;\n b=KdlGffrwc6n8EEQjGYKq+q14d1yqkbvoXe+myof7DdCswoBIPas3d0OU6ko84OKVTajDVjnLReJTLgKvX9PEazqZpFRfANC0ADGauLSgaj3yNaWlbTQxWIAqQsBjNxEyoi2IEs/4xra9TWOid/IeWrydek4hXOZYYi2nQp7T/ZY=", "i=1; a=rsa-sha256; t=1768908371; cv=none;\n\td=zohomail.com; s=zohoarc;\n\tb=YoTH07+J5AJP5rp2Kzi+/XSxUazsuzvEYo8wbmfql7hON4aEQOxsobb86HcsVWIDQKovsGsg0MIuFwltejX/p/mVDGHfwgkL3VCKrODQOcWFjL07ZmzpTnh7hcisPL3m/m9QjzoWnfx4EIevMUBowWC+4J9Mh0w4INoDnCpBG9o=" ], "ARC-Message-Signature": [ "i=3; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1768910471; c=relaxed/relaxed;\n\tbh=U3QmliIwtd6Bek9mVkljEH4RMQXds+yszAsJswSwJ1Q=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=kwydhpxiJoIl8QEpNYLPYYPRU1aHo5jQMunViTlAIFVBg9o7A467cKF07RNBiLqH7mztqRvffsH5SunymKgioYct4j9mz85fVXbjM+WEN1U3W9M3rfEmV6mTiUGiEDeaaiQMxA7XSKHxF7G5rGMV/z2fqGthNr/fkBQfaLYzlhDGJZ7pVr+GpbMlamIkSfdzU/hTTuAB6IQHc8ENBLAcp05eZM4L7A2e0nyiDS95hjBx9JB7hD5uOaQTrjAhsyIAB3dzSbfMXuMBf99LDTNOwm+8jDiHly6JRBy6qfdXo/7Ns6t7vODPmRuF+OOAnJW/oDTg2Do9fVxgnKwnbBcenw==", "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1768908412; c=relaxed/simple;\n\tbh=j+xbzsW8E7HKnOl7TmDog3wuym8ZnFUzBnD8axE+DEE=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=gpnVdqFBBO9+L7Um0bCMMM5iu3OC1CMZK9g5ZMWLw0OBx8QJP0uJEBVh/En+X4B0HTpdjyVo0l32Qpr68xT0nVjFJUmwGDDlAy/Mdxyj8UxuZa+CWEwMeyQ0RDcyuXzAxDQhupCXZnsyAIWEaJuXzuPaYFaeQdpKRebS9h4wlXQ=", "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;\n s=zohoarc;\n\tt=1768908371;\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=U3QmliIwtd6Bek9mVkljEH4RMQXds+yszAsJswSwJ1Q=;\n\tb=Oi/ISsuwAnwb7ggG45he03Jc0BDnU6XOGlT3sKuh4jBsi6ahi4Hu9f89gV7sWLdN9IF3INuae5D2R2l0a72WK/rG0Xns7xGn2avvcO3ONww8lMRKFZno7pMd32uPh3pIKFZSxa9pgNKQeaCe6UsdviK4TmgGmrnQiYpZ79nCLPU=" ], "ARC-Authentication-Results": [ "i=3; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=linux.beauty;\n spf=fail smtp.mailfrom=vger.kernel.org; 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=ENOfEjcl; dkim-atps=neutral;\n spf=softfail (client-ip=142.0.200.124; helo=dfw.mirrors.kernel.org;\n envelope-from=linux-ext4+bounces-13102-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=2; smtp.subspace.kernel.org;\n dmarc=none (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=ENOfEjcl; arc=pass smtp.client-ip=136.143.188.112", "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=1768908371;\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=U3QmliIwtd6Bek9mVkljEH4RMQXds+yszAsJswSwJ1Q=;\n\tb=ENOfEjcl/MoWCqF+mJNKEMFUti1UUWpED2sFBPnYjI/rhQsrlAiwfOwckl3JaTo1\n\t1HtLShwt4E/oHAW/R6B2SkAgPIc/nP1bdi+XqyKs1FUrLEBMyVbsGem/XAYzPr2SRC7\n\tiw5xtS26KwtEJkUQywtiWCDKIlkTmIwCuCXYQ2EA=", "From": "Li Chen <me@linux.beauty>", "To": "Zhang Yi <yi.zhang@huaweicloud.com>,\n\t\"Theodore 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": "Li Chen <me@linux.beauty>", "Subject": "[RFC v4 4/7] ext4: fast commit: avoid self-deadlock in inode\n snapshotting", "Date": "Tue, 20 Jan 2026 19:25:33 +0800", "Message-ID": "<20260120112538.132774-5-me@linux.beauty>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260120112538.132774-1-me@linux.beauty>", "References": "<20260120112538.132774-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=-0.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_MISSING,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_SOFTFAIL 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 809170d46167..966211a3342a 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", "v4", "4/7" ] }