Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oTDlU-0007s1-VZ for mharc-grub-devel@gnu.org; Tue, 30 Aug 2022 22:47:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTDlT-0007rp-RM for grub-devel@gnu.org; Tue, 30 Aug 2022 22:47:40 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:59489 helo=outgoing.mit.edu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTDlP-0004pW-UP for grub-devel@gnu.org; Tue, 30 Aug 2022 22:47:39 -0400 Received: from cwcc.thunk.org (pool-173-48-120-46.bstnma.fios.verizon.net [173.48.120.46]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 27V2g64i019335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Aug 2022 22:42:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1661913727; bh=ZIkyufetK5cZ3KNAip4Xp/heLy0EzABPFtu/avlS5g4=; h=From:To:Cc:Subject:Date; b=jbPDQKhToTZy16tt1tuHsRobId3JJdkhKMlyY3hj2ZfG+0iR3Lb3Vrv2CeAP2ukYc eOsV7ooz1sW1HUWUquo1NRy7yZaX72I3PBeibe615Wpjl197pYCB2HDKFyZVcD88U/ XK5Zv08pVOIwyhHpjZWcl2GI5TSmnUZpIwv1KsC50kkXmoJFwKipuesDs7+rkz8jjb b5BlZKgE89s9V+cXDU5iRQB6tem2BgX5mOc6NC2KTvbJRJmj1JDjcdSh1HpHRhh32a mkt9nL8vsnD/lKa8WDqFi3+peTB8KZRjj5wfhHxCCuL3DKofYlHk8CQLSvV7zWx+lL IwfOY7gOhTpiA== Received: by cwcc.thunk.org (Postfix, from userid 15806) id E10D815C524F; Tue, 30 Aug 2022 22:42:05 -0400 (EDT) From: "Theodore Ts'o" To: grub-devel@gnu.org Cc: tytso@mit.edu Subject: [PATCH] fs/ext2: ignore the large_dir incompat feature Date: Tue, 30 Aug 2022 22:41:59 -0400 Message-Id: <20220831024159.1219231-1-tytso@mit.edu> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=18.9.28.11; envelope-from=tytso@mit.edu; helo=outgoing.mit.edu X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2022 02:47:40 -0000 Recently, ext4 added the a large_dRecently, ext4 added the a large_dir feature, which adds support for a 3 level htree directory support. Grub supports existing file systems with htree directories by ignoring their existence, and since the index nodes for the hash tree look like deleted directory entries (by design), grub can simply do a brute force O(n) linear search of directories. The same is true for 3 level deep htrees indicated by large_dir feature flag. Hence, it is safe for gub to ignore the large_dir incompat feature. Fixes: https://savannah.gnu.org/bugs/?61606 Signed-off-by: Theodore Ts'o --- I submitted this patch back in December 2021, not realizing that apparently no one is actually scanning the bug tracking system on savannah.gnu.org even though it is listed as the official bug tracking system for GRUB. So I'm trying to submit this via grub-devel. grub-core/fs/ext2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c index 0989e26e1..654580e9d 100644 --- a/grub-core/fs/ext2.c +++ b/grub-core/fs/ext2.c @@ -104,6 +104,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 #define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 +#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */ #define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 /* The set of back-incompatible features this driver DOES support. Add (OR) @@ -129,10 +130,17 @@ GRUB_MOD_LICENSE ("GPLv3+"); * checksummed filesystem. Safe to ignore for now since the * driver doesn't support checksum verification. However, it * has to be removed from this list if the support is added later. + * large_dir: Not back-incompatible given that the grub ext2 driver does + * not implement EXT2_FEATURE_COMPAT_DIR_INDEX. If grub + * eventually supports the htree feature (aka dir_index) + * it should support 3 level htrees and then move + * EXT4_FEATURE_INCOMPAT_LARGEDIR to + * EXT2_DRIVER_SUPPORTED_INCOMPAT. */ #define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \ | EXT4_FEATURE_INCOMPAT_MMP \ - | EXT4_FEATURE_INCOMPAT_CSUM_SEED) + | EXT4_FEATURE_INCOMPAT_CSUM_SEED \ + | EXT4_FEATURE_INCOMPAT_LARGEDIR) #define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U -- 2.31.0