{"id":2223444,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2223444/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260415105505.342358-2-yebin@huaweicloud.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.2/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260415105505.342358-2-yebin@huaweicloud.com>","list_archive_url":null,"date":"2026-04-15T10:55:02","name":"[v2,1/4] ext4: register 'orphan_list' procfs","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"24b2480259f1d2fdbfee6458ec5148715ec46e4c","submitter":{"id":85089,"url":"http://patchwork.ozlabs.org/api/1.2/people/85089/?format=json","name":"Ye Bin","email":"yebin@huaweicloud.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20260415105505.342358-2-yebin@huaweicloud.com/mbox/","series":[{"id":499966,"url":"http://patchwork.ozlabs.org/api/1.2/series/499966/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=499966","date":"2026-04-15T10:55:03","name":"show orphan file inode detail info","version":2,"mbox":"http://patchwork.ozlabs.org/series/499966/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223444/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223444/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <SRS0=k4o9=CO=vger.kernel.org=linux-ext4+bounces-15843-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 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=k4o9=co=vger.kernel.org=linux-ext4+bounces-15843-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15843-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.56","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huaweicloud.com"],"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 4fwdS12v05z1yHd\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 20:58:56 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fwdS039hlz4x4X\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 20:58:56 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4fwdS032TLz4x4h; Wed, 15 Apr 2026 20:58:56 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\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 4fwdRw6lbRz4x4X\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 15 Apr 2026 20:58:52 +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 B0AB8308D25D\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 15 Apr 2026 10:57:44 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 3103434AB17;\n\tWed, 15 Apr 2026 10:57:44 +0000 (UTC)","from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com\n [45.249.212.56])\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 63E823491D6\n\tfor <linux-ext4@vger.kernel.org>; Wed, 15 Apr 2026 10:57:40 +0000 (UTC)","from mail.maildlp.com (unknown [172.19.163.177])\n\tby dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4fwdQJ0hXCzKHMXS\n\tfor <linux-ext4@vger.kernel.org>; Wed, 15 Apr 2026 18:57:28 +0800 (CST)","from mail02.huawei.com (unknown [10.116.40.252])\n\tby mail.maildlp.com (Postfix) with ESMTP id A63324058F\n\tfor <linux-ext4@vger.kernel.org>; Wed, 15 Apr 2026 18:57:37 +0800 (CST)","from huaweicloud.com (unknown [10.50.87.132])\n\tby APP3 (Coremail) with SMTP id _Ch0CgAHtL0fb99pbf70AQ--.45727S5;\n\tWed, 15 Apr 2026 18:57:37 +0800 (CST)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1776250736; cv=pass;\n\tb=wSRWcX3v3x3LhIcyHkyhGwftCTZlAKl6ddeRIu3kNxrNFbMoVI9Yka4O6XxGJyOp8ZiPQjpK5knE4ZYFNv//UKzRgQx0jLuLiZLEuwZ5mh7ETcOj8ptHwzmUGH2es8BOyk6DNHyzgsee98a6+PjynFc5iSFGbpuke1wHiSIhcPpvIrvlAbel4zZakHFQAgDJjki/yLo46I2S6wCm9JYD5a10UDShgt3e/tBIjpomHJsi2WQCULVzg8oOwHBjH0kNAcQX4NgDfTHZ7zGHXohirdJ0ZMBNaVQC/vlG+G9Hs3nEwRapaAdNEREhcF8CursLg+cxExp4+k8jE6ChQMkVsw==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776250664; cv=none;\n b=SMvDPxpeo51peYDKZunjX9RLYAYPqT5qY0U4fdqem6T4tP83cdFy4Z6Jg/C8OA8LKkTS5HujXBisNwuMeqDL7RPt37hPsRpxXSIYPIrr4CRW3A/qi7ADikp6dTjErft6pPo2kpI0aG3qxY4ZqKqmvPwvbaJh+VAWvbyFDM6g8Iw="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1776250736; c=relaxed/relaxed;\n\tbh=UrY3k6ASybEGfqlMhlgrg3bfa/PgmcU/Em/zfsOf6wM=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=KPhzs6hvlswnmZ9hau2m9rZ9YfXuedz8RS6RXse/HZTUWe7c08aCzLhOfLA/G1G1HXlxw/vGs1JP5k3TNziL76gGgB8ypHvmJ2poEmI/0HdTYtRI7OTqwGNzkQSV+4TryD0iouLQFjJ/oFjfvaQdZ6SjCVQSl12Pury9nsXszhBkRd4sPjMsPdnmr+lxiphxu/GGr4zXQY9nLYWICh3gY54Ve8nwUZt8xNuXfeAUfvYAK8LGH4nppQJcBZIq36l6vQ0jA8ion7xrmZm0ZpOuTub+fBU+pE0Mz6SSJmloPpQKf7wjnIsdFK319hig+HLa9thopEZ/oivH1GqWTlH8Sw==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776250664; c=relaxed/simple;\n\tbh=lBkIMdW9M4ScslU9Ve3XMZFYsU6IbZnPvAoADtH87Bc=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=SsIWruYxjnMqORyFapo05CYBXPQ7y/NjSK5R8x4cLsoflWFSXgX8+6Uu6Kx+YW1wPhEV+gHAofROkjG8aCcwmdSlcZmW95ACBw//NKa7dIyA9gNMFvTzhVK8pcmMDsbK2pbA024Qr9Y24SLa+NTvrKI29Zd4K76oieOeqTFrMyg="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15843-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56"],"From":"Ye Bin <yebin@huaweicloud.com>","To":"tytso@mit.edu,\n\tadilger.kernel@dilger.ca,\n\tlinux-ext4@vger.kernel.org","Cc":"jack@suse.cz","Subject":"[PATCH v2 1/4] ext4: register 'orphan_list' procfs","Date":"Wed, 15 Apr 2026 18:55:02 +0800","Message-Id":"<20260415105505.342358-2-yebin@huaweicloud.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260415105505.342358-1-yebin@huaweicloud.com>","References":"<20260415105505.342358-1-yebin@huaweicloud.com>","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-CM-TRANSID":"_Ch0CgAHtL0fb99pbf70AQ--.45727S5","X-Coremail-Antispam":"1U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U\n\tUI43ZEXa7IU14CJJUUUUU==","X-CM-SenderInfo":"p1hex046kxt4xhlfz01xgou0bp/","X-Spam-Status":"No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDMARC_MISSING,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"},"content":"From: Ye Bin <yebin10@huawei.com>\n\nThis patch register '/proc/fs/ext4/XXX/orphan_list' procfs for show inode\norphan list about EXT4 file system.\nIn actual production environments, there may be inconsistencies in df/du,\nsometimes due to kernel occupation, making it difficult to find such files,\nand it is also difficult to operate in the current network environment. So\nadd \"orphan_list\" procfs to quickly query files that have been deleted but\nare occupied.\n\nSigned-off-by: Ye Bin <yebin10@huawei.com>\n---\n fs/ext4/ext4.h   |  1 +\n fs/ext4/orphan.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++\n fs/ext4/sysfs.c  |  2 ++\n 3 files changed, 80 insertions(+)","diff":"diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h\nindex 0cf68f85dfd1..ccb0fd1e63e7 100644\n--- a/fs/ext4/ext4.h\n+++ b/fs/ext4/ext4.h\n@@ -3875,6 +3875,7 @@ extern void ext4_stop_mmpd(struct ext4_sb_info *sbi);\n extern const struct fsverity_operations ext4_verityops;\n \n /* orphan.c */\n+extern const struct proc_ops ext4_orphan_proc_ops;\n extern int ext4_orphan_add(handle_t *, struct inode *);\n extern int ext4_orphan_del(handle_t *, struct inode *);\n extern void ext4_orphan_cleanup(struct super_block *sb,\ndiff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c\nindex 64ea47624233..f7e7f77e021e 100644\n--- a/fs/ext4/orphan.c\n+++ b/fs/ext4/orphan.c\n@@ -4,6 +4,8 @@\n #include <linux/fs.h>\n #include <linux/quotaops.h>\n #include <linux/buffer_head.h>\n+#include <linux/proc_fs.h>\n+#include <linux/seq_file.h>\n \n #include \"ext4.h\"\n #include \"ext4_jbd2.h\"\n@@ -657,3 +659,78 @@ int ext4_orphan_file_empty(struct super_block *sb)\n \t\t\treturn 0;\n \treturn 1;\n }\n+\n+struct ext4_proc_orphan {\n+\tstruct ext4_inode_info cursor;\n+};\n+\n+static void *ext4_orphan_seq_start(struct seq_file *seq, loff_t *pos)\n+{\n+\treturn NULL;\n+}\n+\n+static void *ext4_orphan_seq_next(struct seq_file *seq, void *v, loff_t *pos)\n+{\n+\treturn NULL;\n+}\n+\n+static int ext4_orphan_seq_show(struct seq_file *seq, void *v)\n+{\n+\treturn 0;\n+}\n+\n+static void ext4_orphan_seq_stop(struct seq_file *seq, void *v)\n+{\n+}\n+\n+const struct seq_operations ext4_orphan_seq_ops = {\n+\t.start  = ext4_orphan_seq_start,\n+\t.next   = ext4_orphan_seq_next,\n+\t.stop   = ext4_orphan_seq_stop,\n+\t.show   = ext4_orphan_seq_show,\n+};\n+\n+static int ext4_seq_orphan_open(struct inode *inode, struct file *file)\n+{\n+\tint rc;\n+\tstruct seq_file *m;\n+\tstruct ext4_proc_orphan *private;\n+\n+\trc = seq_open_private(file, &ext4_orphan_seq_ops,\n+\t\t\t      sizeof(struct ext4_proc_orphan));\n+\tif (!rc) {\n+\t\tm = file->private_data;\n+\t\tprivate = m->private;\n+\t\tINIT_LIST_HEAD(&private->cursor.i_orphan);\n+\t\tprivate->cursor.vfs_inode.i_ino = 0;\n+\t}\n+\n+\treturn rc;\n+}\n+\n+static int ext4_seq_orphan_release(struct inode *inode, struct file *file)\n+{\n+\tstruct seq_file *seq = file->private_data;\n+\tstruct ext4_proc_orphan *s = seq->private;\n+\tstruct ext4_sb_info *sbi = EXT4_SB(pde_data(inode));\n+\n+\t/*\n+\t * The function close_pdeo() is called when deleting the procfs\n+\t * in ext4_unregister_sysfs(), and this function is used to remove\n+\t * the entry from the 'pde->pde_openers' list. Therefore, when the\n+\t * file is closed, proc_reg_release() will not call close_pdeo()\n+\t * again because it cannot find the node on the 'pde->pde_openers'\n+\t * list. This prevents the UAF issue from occurring.\n+\t */\n+\tmutex_lock(&sbi->s_orphan_lock);\n+\tlist_del(&s->cursor.i_orphan);\n+\tmutex_unlock(&sbi->s_orphan_lock);\n+\n+\treturn seq_release_private(inode, file);\n+}\n+\n+const struct proc_ops ext4_orphan_proc_ops = {\n+\t.proc_open      = ext4_seq_orphan_open,\n+\t.proc_read      = seq_read,\n+\t.proc_release   = ext4_seq_orphan_release,\n+};\ndiff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c\nindex 923b375e017f..b40a934e30c9 100644\n--- a/fs/ext4/sysfs.c\n+++ b/fs/ext4/sysfs.c\n@@ -639,6 +639,8 @@ int ext4_register_sysfs(struct super_block *sb)\n \t\t\t\text4_seq_mb_stats_show, sb);\n \t\tproc_create_seq_data(\"mb_structs_summary\", 0444, sbi->s_proc,\n \t\t\t\t&ext4_mb_seq_structs_summary_ops, sb);\n+\t\tproc_create_data(\"orphan_list\", 0400, sbi->s_proc,\n+\t\t\t\t &ext4_orphan_proc_ops, sb);\n \t}\n \treturn 0;\n }\n","prefixes":["v2","1/4"]}