<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:08:56 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-14345] e2fsck of very large directories is broken</title>
                <link>https://jira.whamcloud.com/browse/LU-14345</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;In patch &lt;a href=&quot;http://review.whamcloud.com/22008&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/22008&lt;/a&gt; &quot;&lt;tt&gt;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-1365&quot; title=&quot;Implement ldiskfs LARGEDIR support for e2fsprogs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-1365&quot;&gt;&lt;del&gt;LU-1365&lt;/del&gt;&lt;/a&gt; e2fsprogs: enable large directory support in tools&lt;/tt&gt;&quot; support was added to e2fsprogs for directories with 3-level htree and larger than 2GB in size.  The &lt;tt&gt;large_dir&lt;/tt&gt; feature was enabled by default for all new ldiskfs filesystems in patch &lt;a href=&quot;https://review.whamcloud.com/36555&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/36555&lt;/a&gt; &quot;&lt;tt&gt;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11546&quot; title=&quot;enable large_dir support for MDTs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11546&quot;&gt;&lt;del&gt;LU-11546&lt;/del&gt;&lt;/a&gt; utils: enable large_dir for ldiskfs&lt;/tt&gt;&quot; (commit v2_13_50-13-gcd1faa0124).&lt;/p&gt;


&lt;p&gt;While working on the e2fsck code for an unrelated issue, I saw that there is still some code in e2fsck that limits the size of a directory to be less than 2^32 bytes in size.  Currently, e2fsck will consider a directory file with a large size to be broken and clear the high bytes of the size if there is any problem with the directory size:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (pb.is_dir) {
                :
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (err || sz != inode-&amp;gt;i_size) {
                        bad_size = 7;
                        pctx-&amp;gt;num = sz;
                } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (inode-&amp;gt;i_size &amp;amp; (fs-&amp;gt;blocksize - 1))
                        bad_size = 5;
                &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (nblock &amp;gt; (pb.last_block + 1))
                        bad_size = 1;
                :
                :
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fix_problem(ctx, PR_1_BAD_I_SIZE, pctx)) {
                        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (LINUX_S_ISDIR(inode-&amp;gt;i_mode))
                                pctx-&amp;gt;num &amp;amp;= 0xFFFFFFFFULL;
                        ext2fs_inode_size_set(fs, inode, pctx-&amp;gt;num);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and in libext2fs this will also report an error and truncate the size if it is set for directories:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode,
                                ext2_off64_t size)
{
        &lt;span class=&quot;code-comment&quot;&gt;/* Only regular files get to be larger than 4GB */&lt;/span&gt;
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!LINUX_S_ISREG(inode-&amp;gt;i_mode) &amp;amp;&amp;amp; (size &amp;gt;&amp;gt; 32))
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; EXT2_ET_FILE_TOO_BIG;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A 4GB directory can have about 80M 32-byte filename entries (11M 256-byte entries) in it before the 32-bit size is exceeded.  While we previously reported a limit of approximately 10M entries in a single directory in the past, it is not completely unlikely that we may see large-OST systems with directories over 4GB in size in the near future.&lt;/p&gt;

&lt;p&gt;It is not totally clear, but it may be that in addition to changing the above code to allow large directories, e2fsck may also need to track large directories (a new &lt;tt&gt;ctx-&amp;gt;large_dirs&lt;/tt&gt; counter) and set the &lt;tt&gt;LARGEDIR&lt;/tt&gt; feature flag in the superblock, like it does for &lt;tt&gt;LARGE_FILE&lt;/tt&gt; (with the existing &lt;tt&gt;ctx-&amp;gt;large_files&lt;/tt&gt; counter).&lt;/p&gt;

&lt;p&gt;On the one hand, unlike the &lt;tt&gt;LARGE_FILE&lt;/tt&gt; feature (which is set by the kernel at runtime), the &lt;tt&gt;LARGEDIR&lt;/tt&gt; feature should always be set &lt;b&gt;before&lt;/b&gt; a large directory is allowed, so it should also be set in all of the superblock backups.  This would prevent garbage/corrupt directory inodes from getting a &quot;large size&quot; when in fact they are just sparse files.  On the other hand, we don&apos;t want to truncate &lt;em&gt;real&lt;/em&gt; large directories because a flag is missing in the superblock for some reason.  It may be that there is enough logic in the directory leaf block handling that a large size should never be set unless the directory legitimately has enough blocks for that size, but I haven&apos;t looked into the details of this yet.&lt;/p&gt;</description>
                <environment></environment>
        <key id="62419">LU-14345</key>
            <summary>e2fsck of very large directories is broken</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.whamcloud.com/images/icons/priorities/critical.svg">Critical</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="adilger">Andreas Dilger</assignee>
                                    <reporter username="adilger">Andreas Dilger</reporter>
                        <labels>
                            <label>e2fsck</label>
                    </labels>
                <created>Wed, 20 Jan 2021 22:11:32 +0000</created>
                <updated>Fri, 19 Feb 2021 19:42:46 +0000</updated>
                            <resolved>Fri, 19 Feb 2021 19:42:46 +0000</resolved>
                                    <version>Lustre 2.13.0</version>
                    <version>Lustre 2.14.0</version>
                                    <fixVersion>Lustre 2.14.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>8</watches>
                                                                            <comments>
                            <comment id="289982" author="adilger" created="Wed, 20 Jan 2021 22:24:47 +0000"  >&lt;p&gt;Artem, would you have time to look into this?  It would be good to get a fix into e2fsprogs before the 2.14 release is made that enables &lt;tt&gt;large_dir&lt;/tt&gt; by default for all MDT/OST filesystems.&lt;/p&gt;

&lt;p&gt;I think currently that e2fsck will mostly &quot;ignore&quot; a large directory until it has some error in pass1 that sets &lt;tt&gt;bad_size&lt;/tt&gt;, then it would truncate the size to a 32-bit value.  If &lt;tt&gt;ext2fs_inode_size_set()&lt;/tt&gt; is called somewhere else, like &lt;tt&gt;e2fsck_rehash_dir()-&amp;gt;write_directory()&lt;/tt&gt; called with &quot;&lt;tt&gt;e2fsck -fD&lt;/tt&gt;&quot;, then it looks like &lt;tt&gt;ext2fs_inode_size_set()&lt;/tt&gt; will return an error when trying to set the size, but that may cause other problems.&lt;/p&gt;

&lt;p&gt;I think the minimum fix is to check for &lt;tt&gt;ext2fs_has_feature_largedir()&lt;/tt&gt; in &lt;tt&gt;ext2fs_inode_size_set()&lt;/tt&gt; and allow a 64-bit size in that case, and similarly clean up the above code in pass1 that is truncating the size for &lt;tt&gt;LINUX_S_ISDIR()&lt;/tt&gt; inodes.&lt;/p&gt;</comment>
                            <comment id="289983" author="adilger" created="Wed, 20 Jan 2021 22:43:31 +0000"  >&lt;p&gt;If we got &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11912&quot; title=&quot;reduce number of OST objects created per MDS Sequence&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11912&quot;&gt;&lt;del&gt;LU-11912&lt;/del&gt;&lt;/a&gt; implemented, we would never see such large directories on an OST.  It looks like 32 dirs x 80M objects/dir would need over 2.5B objects from the same MDT at one time, which is pretty unlikely even for a huge OST, just because there is still a 4B inode limit on each MDT, but it is possible.&lt;/p&gt;

&lt;p&gt;It seems more likely that this would be hit with a single 80M-entry directory (11-20M entries with very long filenames) on the MDT.  Due to &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12406&quot; title=&quot;conf-sanity test 111 fails with &#8216;add mds1 failed with new params&#8217;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12406&quot;&gt;&lt;del&gt;LU-12406&lt;/del&gt;&lt;/a&gt; we are currently &lt;b&gt;not&lt;/b&gt; testing &lt;tt&gt;large_dir&lt;/tt&gt; support on master.  &lt;/p&gt;

&lt;p&gt;The existing &lt;tt&gt;conf_sanity test_111&lt;/tt&gt; did not trigger the problem reported here, likely because it limits itself to a 2GB directory size instead of exceeding 4GB, and because e2fsck doesn&apos;t find any errors with the large directory inode that would trigger this problem.  It may be possible to trigger it with a &amp;gt; 4GB directory by adding &quot;&lt;tt&gt;-D&lt;/tt&gt;&quot; to the &lt;tt&gt;run_e2fsck&lt;/tt&gt; options at the end.&lt;/p&gt;</comment>
                            <comment id="290905" author="gerrit" created="Mon, 1 Feb 2021 22:36:09 +0000"  >&lt;p&gt;&lt;del&gt;Andreas Dilger (adilger@whamcloud.com) uploaded a new patch:&lt;/del&gt; &lt;a href=&quot;https://review.whamcloud.com/41383&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/41383&lt;/a&gt;&lt;br/&gt;
&lt;del&gt;Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14345&quot; title=&quot;e2fsck of very large directories is broken&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14345&quot;&gt;&lt;del&gt;LU-14345&lt;/del&gt;&lt;/a&gt; e2fsck: fix check of directories over 4GB&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Project: tools/e2fsprogs&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Branch: master-lustre&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Current Patch Set: 1&lt;/del&gt;&lt;br/&gt;
&lt;del&gt;Commit: 4d38f15676c2f26e0feba4fa9b9f52a474aa4e72&lt;/del&gt;&lt;/p&gt;</comment>
                            <comment id="290920" author="gerrit" created="Tue, 2 Feb 2021 02:55:14 +0000"  >&lt;p&gt;Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/41385&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/41385&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14345&quot; title=&quot;e2fsck of very large directories is broken&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14345&quot;&gt;&lt;del&gt;LU-14345&lt;/del&gt;&lt;/a&gt; e2fsck: fix check of directories over 4GB&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 83d23e3593548735d94934d3d85d16103a86ab0e&lt;/p&gt;</comment>
                            <comment id="291056" author="gerrit" created="Wed, 3 Feb 2021 07:43:02 +0000"  >&lt;p&gt;Andreas Dilger (adilger@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/41385/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/41385/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14345&quot; title=&quot;e2fsck of very large directories is broken&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14345&quot;&gt;&lt;del&gt;LU-14345&lt;/del&gt;&lt;/a&gt; e2fsck: fix check of directories over 4GB&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 71b74579b7e6c5cfe6af05b00e45c8a75fce0d61&lt;/p&gt;</comment>
                            <comment id="291424" author="gerrit" created="Mon, 8 Feb 2021 12:02:00 +0000"  >&lt;p&gt;Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/41433&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/41433&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14345&quot; title=&quot;e2fsck of very large directories is broken&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14345&quot;&gt;&lt;del&gt;LU-14345&lt;/del&gt;&lt;/a&gt; misc: update e2fsprogs to 1.45.6.wc4&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 5093c63d2eb8ce8fc074cd49a91092643f79f777&lt;/p&gt;</comment>
                            <comment id="292474" author="gerrit" created="Fri, 19 Feb 2021 19:22:31 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/41433/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/41433/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14345&quot; title=&quot;e2fsck of very large directories is broken&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14345&quot;&gt;&lt;del&gt;LU-14345&lt;/del&gt;&lt;/a&gt; misc: update e2fsprogs to 1.45.6.wc5&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 0bf9c2c34805b017a39c473650496f059aeaef73&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="53659">LU-11546</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="55890">LU-12406</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="14248">LU-1365</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="54735">LU-11912</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i01jsf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>