From patchwork Wed Dec 31 22:29:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1147 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220272; bh=c/WrpaXLreMKnRmZNxgVL9YjTUNrmMEKVvhjcOUy5gA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ovKuKU0PLDOKvxvRcJDzY9lI4ab4GLuW3w3AC4EdK/sHr8FJJi8pWy92fLcDCKnAX HkhbNb+Lv0/BXyLtcAWv6dWkm6MoWDFAkey3szc8jyvvybp5fMFWRQQ3CgCggNJbNk 7TVWkMQakWgCgxQs5Cvnn3ktU1IkqLtLjN9N62ZKtKdhzbjEJ8e5Y89XxzrMjQ5E6t kY/q2JvZ0dOdTtfYWUMaIptn5dvW5ptVBMkDYukK3BkdGgI7Kr1MAcd3MGorM88AGQ SD/Ljc4UPfKG9SkkZsQ8EIa4goR0+fb6bhrOSbIsFtphE4lyMRYpBZZor1L4YzZQIl 9nNM6GBJ1ltoA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4F0B268F61 for ; Wed, 31 Dec 2025 15:31:12 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qY1dyamwA6FN for ; Wed, 31 Dec 2025 15:31:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220272; bh=c/WrpaXLreMKnRmZNxgVL9YjTUNrmMEKVvhjcOUy5gA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ovKuKU0PLDOKvxvRcJDzY9lI4ab4GLuW3w3AC4EdK/sHr8FJJi8pWy92fLcDCKnAX HkhbNb+Lv0/BXyLtcAWv6dWkm6MoWDFAkey3szc8jyvvybp5fMFWRQQ3CgCggNJbNk 7TVWkMQakWgCgxQs5Cvnn3ktU1IkqLtLjN9N62ZKtKdhzbjEJ8e5Y89XxzrMjQ5E6t kY/q2JvZ0dOdTtfYWUMaIptn5dvW5ptVBMkDYukK3BkdGgI7Kr1MAcd3MGorM88AGQ SD/Ljc4UPfKG9SkkZsQ8EIa4goR0+fb6bhrOSbIsFtphE4lyMRYpBZZor1L4YzZQIl 9nNM6GBJ1ltoA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 364AD68F65 for ; Wed, 31 Dec 2025 15:31:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220269; bh=aSdn5Rt/FbKlc4/FBOuHe8DHZun4kh5BWIFzL9WFvbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0vUrJwu374wh9HLnYEvvkZ7GmxYWPC8bM2LZZQHDRDL/MFyVdCppxjNZqijr+uZn 9xM8MzkqAJDC3ZkfLfhAf9x2Nc8Kuya9O5f05pRvzBT3MBn7+2E9TmBiyI6wkifU85 v4uvY0spT4No9Suosr9NtGG0eiVxGQPY6W65lFgaPRmoax4IIv1K9tSV+R64GiHnww hEdmzuadlzQVQ2lnXfui/xs4y1oqNOJnPNOQ1fiUBc2H2Kcdh0vboAQ522XvCinIPB FoN80QmgpoU4HpFD+m39g+NyEDy2rkaRsItJIR001MMfnOD0xjSFvldHezSFNj4p0j aTOlEVtHSbu6Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C726268F65; Wed, 31 Dec 2025 15:31:09 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id K1qA85rjMrOx; Wed, 31 Dec 2025 15:31:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220265; bh=raPzOAhQoayBlIcrgTyx4FYWmunATYXK8Zp6AWjQ7eQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQR16y3ifMUQU4zs2I4joKzWcVno6Sth6ogLWVFbUOYHtQEviOIIIP7hnOd5GT4Td jSR/L/tokdoLPmhUt1UqsAmO8EA5EhR8RWKLxOeRJ/ylzAOx/QctwfR+YTyzue3Y/I lYOS5eETUr1InQ+tHD5dPnNUmOwazYzEkDP+z1X9j5iGiF3UQaPRRrR5vtSlYDIWoa Tucz83gI7qwabucMlXsiz5pAmb+sTUEok67vvY1EtI8BxiMwKI1u1vJlfqWF9YzEp7 Sg9v29F+a08wjEkYNGfSDTB/3MYvy8s/2cApjgo0qRPhzniiq2dSq8ywcuKv+tjISK R/3wcvwKnSIgg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 52BA068C5D; Wed, 31 Dec 2025 15:31:05 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 31 Dec 2025 15:29:42 -0700 Message-ID: <20251231223008.3251711-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251231223008.3251711-1-sjg@u-boot.org> References: <20251231223008.3251711-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CLNV24MDDKMCROHKLE7QGEND3UWLWUVJ X-Message-ID-Hash: CLNV24MDDKMCROHKLE7QGEND3UWLWUVJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/26] ext4l: Add inode-tracking lists List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass U-Boot does not track allocated inodes, causing memory leaks when remounting filesystems. Add s_inodes list to super_block and i_sb_list to inode structures to track all allocated inodes, allowing proper eviction on unmount. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 6 ++++++ fs/ext4l/support.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 37a4abb537f..78d44faa0db 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -682,6 +682,9 @@ struct super_block { const struct export_operations *s_export_op; const struct xattr_handler * const *s_xattr; struct dentry *d_sb; /* Parent dentry - stub */ + + /* U-Boot: list of all inodes, for freeing on unmount */ + struct list_head s_inodes; }; /* Block device read-only check - stub */ @@ -859,6 +862,9 @@ struct inode { struct rw_semaphore i_rwsem; /* inode lock */ const char *i_link; /* Symlink target for fast symlinks */ unsigned short i_write_hint; /* Write life time hint */ + + /* U-Boot: linkage into super_block s_inodes list */ + struct list_head i_sb_list; }; /* Inode time accessors */ diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c index 1fc0bc0aa21..7f2bea4ca06 100644 --- a/fs/ext4l/support.c +++ b/fs/ext4l/support.c @@ -126,6 +126,10 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino) inode->i_mapping = &inode->i_data; inode->i_data.host = inode; INIT_LIST_HEAD(&ei->i_es_list); + INIT_LIST_HEAD(&inode->i_sb_list); + + /* Add to superblock's inode list for eviction on unmount */ + list_add(&inode->i_sb_list, &sb->s_inodes); return inode; } @@ -154,6 +158,10 @@ struct inode *new_inode(struct super_block *sb) inode->i_mapping = &inode->i_data; inode->i_data.host = inode; INIT_LIST_HEAD(&ei->i_es_list); + INIT_LIST_HEAD(&inode->i_sb_list); + + /* Add to superblock's inode list for eviction on unmount */ + list_add(&inode->i_sb_list, &sb->s_inodes); return inode; }