From patchwork Fri Jan 2 00:50:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1177 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=1767315134; bh=P+jKATRgEQJg6gClbeeWMYD4DCDAJIhQ9F2NVsxA0CM=; 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=dtnFfNvSQRd9+9gPS/F8UBZ2h9hY9KE3uA6WiiR4lVHyh3fC+Ob0PPoDCg6KxUfmM Ih/Jq+t87GKm7wxmY2kjWfJa2xBQKAVl4zrKP7LaDB3EppwNAcJTKfny8iMSoTK9MR 3fJiAVVtSjeeh9LxQ5XXgvpF3ieWIsF2/VqmfKIFhLHYn2//1I6nRPlYv3BifT47l1 bvnxKyFOwFLITrZFoyWzpUigGfRHozYqB2Bzm1gwBbjfcolkn62pNwSn2+vveol+zR W0tH17hxnGpKaR4jZzJhHoeY124Ih5XmUDL+NwLcpkfQ9KJAdzessmUMFD9MyMtExv BzfPzyMoVjYiA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6E28669007 for ; Thu, 1 Jan 2026 17:52:14 -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 R3Y6dI7sZ_bM for ; Thu, 1 Jan 2026 17:52:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315132; bh=P+jKATRgEQJg6gClbeeWMYD4DCDAJIhQ9F2NVsxA0CM=; 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=G68TQ/V3MxgGPTiwyc6PSS37hmUxtdbua+X8d5M3Lb7SGSJ3M5ylzJcScsvkRUU4E lQwhNXBC0k3EiMuQ6wq2s0BgpGx6sp/CZ5ApP80EaX7RSwm9ZW0yKtrrxluhooVZrD Hwn1OUWwSf4u/+mUuO3GRzWqKkSwK4OO1lxa4qCxQiXZFe1r4POVCPLJk1UcgqHo8V V0vJUN0G4SoDR0xQchftYqXodI5ixndLWpsSslLiLT/eJQR/KeyCYTfB0RHCWsTPsu pOlXMu1YItceUAe94QdAu0wjhH5zzulSBugSf9535XahezL/fz4rBvD4wo05XLpgXs mt/CKX3CzJh/A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 20DEE6901F for ; Thu, 1 Jan 2026 17:52:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315129; bh=X6YiCqOqXiz67XDDuIk8hYcK6I/MFsaWGH4kcX/fuO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FkyR8AmAdk7I9lP3A2RD7Hco7q1ffQBB1D8fudVgNoEQxxA2EdYEyPdw5Ck6SxpCt qSzXQ/erhZwc77mzsqefcPYvw9IDqOHbtSADu46+MQLZuxz7mYx0w14x99YM87JymV tjVfrJEJLJMvNyzepQkdVzbckHzuSOfMNrbE4K9DlRYsEfcwOzivZk7wIq0Plva0bn DmyWMLorc7LjiBrc2zP0WfyP/LJCN4pI+u4f7J5weCUekVqkRQJfd0HteGSF8qoo28 +ZI6/dC6a6T/UwHfFJmexCIq8FZfk8DB4mG2hrgFWE0BNSosnb7q3hyMpZMHtCoGkB OqFL83p9Ju2bQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 495ED69004; Thu, 1 Jan 2026 17:52: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 4WYviqXD2HLA; Thu, 1 Jan 2026 17:52:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315125; bh=6ZiUoCI+j/L6XQ7m01+mAF5QbPZ4eiVT+zUCKHmdfkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bj12UMaoCNXhzUX1O7oMWnvcxPX3OmBt6NZX5QgBwUWHwHbO6n7JTfqS1ODfU2jBn iMgR/6S748KmD+SOz/FyMFtPZtjO9utR79vsJra4GGOcTaRrR6fcTyUftCaOO9a3vt iIxuawkg2t5/7aW7E6SlXC6jogy+jm+LhrYfVtLR5eUg7Sjsslf3HmTXZZxh6NOhn+ PwbYFkh7GukjxtFO/jMUmGdIbi+LJ0AVM4PCvHDf2+luX2VUS6la42Tn1QXz7Tef4t kf5KOOiYLE6IgzOUd6D8ycpxO70oGo5W/MR/JqV8FFIrQE38iO2dE54UFcuFS6eLM7 3MmPdCPxf7Ucw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1E5DA68313; Thu, 1 Jan 2026 17:52:05 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 1 Jan 2026 17:50:43 -0700 Message-ID: <20260102005112.552256-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260102005112.552256-1-sjg@u-boot.org> References: <20260102005112.552256-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2BYZB25364PD4I2XL6EYJZVGCJHYWKTB X-Message-ID-Hash: 2BYZB25364PD4I2XL6EYJZVGCJHYWKTB 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 v2 13/30] 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 --- (no changes since v1) 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; }