<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:17:24 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-15330] ext2fs_get_pathname() very slow for large directory</title>
                <link>https://jira.whamcloud.com/browse/LU-15330</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Running e2fsck on an MDT with a very large &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; is extremely slow if there are entries in that directory that need to be repaired.  In the case of a 60M-entry &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; system, each directory entry was taking about 1.4s to repair due to &lt;tt&gt;PR_3_UNCONNECTED_DIR&lt;/tt&gt;:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;Unconnected directory inode 2102494 (/REMOTE_PARENT_DIR/???)
Connect to /lost+found? yes
Unconnected directory inode 2102510 (/REMOTE_PARENT_DIR/???)
Connect to /lost+found? yes
Unconnected directory inode 2102514 (/REMOTE_PARENT_DIR/???)
Connect to /lost+found? yes
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Depending on how many unattached entries there are, this might take days, weeks, or even months to complete (1M files might take 2 weeks to repair).&lt;/p&gt;

&lt;p&gt;Attaching &lt;tt&gt;ltrace&lt;/tt&gt; to &lt;tt&gt;e2fsck&lt;/tt&gt; showed that all of the time is spent in &lt;tt&gt;ext2fs_get_pathname()&lt;/tt&gt; opening and iterating through all of the entries in the huge directory (&lt;tt&gt;ltrace&lt;/tt&gt; slowed down the per-file repair time from 1s to 14s but is the same fraction of time):&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;1638486316.336885 ext2fs_read_inode(0x18ab2f0, 0x261db5f2, 0x7ffdc97a2d00, 10) = 0 &amp;lt;0.000069&amp;gt;
1638486316.336977 ext2fs_link(0x18ab2f0, 11, 0x7ffdc97a2d80, 0x261db5f2) = 0 &amp;lt;0.001130&amp;gt;
1638486316.338130 ext2fs_read_inode(0x18ab2f0, 0x261db5f2, 0x7ffdc97a2bd0, 0xa626870) = 0 &amp;lt;0.000071&amp;gt;
1638486316.338223 ext2fs_icount_increment(0x383027b0, 0x261db5f2, 0, 0x18ab2b0) = 0 &amp;lt;0.000084&amp;gt;
1638486316.338329 ext2fs_icount_increment(0x1efa400, 0x261db5f2, 0, 0) = 0 &amp;lt;0.000073&amp;gt;
1638486316.338425 ext2fs_write_inode(0x18ab2f0, 0x261db5f2, 0x7ffdc97a2bd0, 0) = 0 &amp;lt;0.000094&amp;gt;
1638486316.338542 ext2fs_u32_list_test(0x1efa310, 0x261db5f2, 11, 0) = 0 &amp;lt;0.000069&amp;gt;
1638486316.338633 ext2fs_dir_iterate(0x18ab2f0, 0x261db5f2, 1, 0 &amp;lt;unfinished ...&amp;gt;
1638486316.338727 ext2fs_read_inode(0x18ab2f0, 0x83f7c001, 0x7ffdc97a28f0, 0) = 0 &amp;lt;0.000071&amp;gt;
1638486316.338819 ext2fs_icount_decrement(0x383027b0, 0x83f7c001, 0, 0x18ab2c0) = 0 &amp;lt;0.000080&amp;gt;
1638486316.338921 ext2fs_read_inode(0x18ab2f0, 11, 0x7ffdc97a28f0, 0) = 0 &amp;lt;0.000070&amp;gt;
1638486316.339014 ext2fs_icount_increment(0x383027b0, 11, 0, 0x18ab2a0) = 0 &amp;lt;0.000075&amp;gt;
1638486316.339111 ext2fs_icount_increment(0x1efa400, 11, 0, 0) = 0 &amp;lt;0.000071&amp;gt;
1638486316.339205 ext2fs_write_inode(0x18ab2f0, 11, 0x7ffdc97a28f0, 0) = 0 &amp;lt;0.000087&amp;gt;
1638486316.339313 &amp;lt;... ext2fs_dir_iterate resumed&amp;gt; ) = 0 &amp;lt;0.000679&amp;gt;
1638486316.339337 ext2fs_test_generic_bmap(0x1efa870, 0x261db5f3, 0x7f527a6cce48, 0x7f52765db010) = 4 &amp;lt;0.000070&amp;gt;
1638486316.339428 ext2fs_mark_generic_bmap(0x296ee90, 0x261db5f3, 4, 2) = 0 &amp;lt;0.000070&amp;gt;
1638486316.339521 ext2fs_mark_generic_bmap(0x296ee90, 0x83f7c001, 0x261db5f3, 0) = 1 &amp;lt;0.000070&amp;gt;
1638486316.339614 ext2fs_test_generic_bmap(0x1efa870, 0x261db5f4, 0x7f527a6cce54, 0x7f52765db010) = 8 &amp;lt;0.000069&amp;gt;
1638486316.339705 ext2fs_mark_generic_bmap(0x296ee90, 0x261db5f4, 8, 3) = 0 &amp;lt;0.000070&amp;gt;
1638486316.339798 ext2fs_mark_generic_bmap(0x296ee90, 0x1a3e72d1, 0x261db5f4, 0) = 1 &amp;lt;0.000073&amp;gt;
1638486316.339894 ext2fs_test_generic_bmap(0x1efa870, 0x261db5f5, 0x7f527a6cce60, 0x7f52765db010) = 16 &amp;lt;0.000069&amp;gt;
1638486316.339985 ext2fs_mark_generic_bmap(0x296ee90, 0x261db5f5, 16, 4) = 0 &amp;lt;0.000069&amp;gt;
1638486316.340077 ext2fs_mark_generic_bmap(0x296ee90, 0x83f7c001, 0x261db5f5, 0) = 1 &amp;lt;0.000069&amp;gt;
1638486316.340168 ext2fs_test_generic_bmap(0x1efa870, 0x261db5f6, 0x7f527a6cce6c, 0x7f52765db010) = 32 &amp;lt;0.000069&amp;gt;
1638486316.340260 ext2fs_mark_generic_bmap(0x296ee90, 0x261db5f6, 32, 5) = 0 &amp;lt;0.000068&amp;gt;
1638486316.340350 ext2fs_mark_generic_bmap(0x296ee90, 0x545ad40d, 0x261db5f6, 0) = 0 &amp;lt;0.000069&amp;gt;
1638486316.340443 ext2fs_mark_generic_bmap(0x296ee90, 0x545ad40c, 0x2434746, 0) = 0 &amp;lt;0.000069&amp;gt;
1638486316.340534 ext2fs_mark_generic_bmap(0x296ee90, 0x1ec6326d, 0x2434743, 0) = 16 &amp;lt;0.000069&amp;gt;
1638486316.340625 ext2fs_test_generic_bmap(0x1efa870, 0x261db5f7, 0x7f527a6cce78, 0x7f52765db010) = 64 &amp;lt;0.000070&amp;gt;
1638486316.340717 ext2fs_mark_generic_bmap(0x296ee90, 0x261db5f7, 64, 6) = 0 &amp;lt;0.000069&amp;gt;
1638486316.340811 dcgettext(0, 0x448684, 5, 335) = 0x448684 &amp;lt;0.000079&amp;gt;
1638486316.340916 __fprintf_chk(0x7f5363936400, 1, 0x44cb40, 12) = 12 &amp;lt;0.000095&amp;gt;
1638486316.341033 dcgettext(0, 0x44cc4d, 5, 12)  = 0x44cc4d &amp;lt;0.000072&amp;gt;
1638486316.341128 __fprintf_chk(0x7f5363936400, 1, 0x44cb40, 9) = 9 &amp;lt;0.000088&amp;gt;
1638486316.341239 __fprintf_chk(0x7f5363936400, 1, 0x44cb40, 1) = 1 &amp;lt;0.000089&amp;gt;
1638486316.341350 dcgettext(0, 0x44ccb0, 5, 1)   = 0x44ccb0 &amp;lt;0.000071&amp;gt;
1638486316.341445 __fprintf_chk(0x7f5363936400, 1, 0x44cb40, 5) = 5 &amp;lt;0.000089&amp;gt;
1638486316.341557 __fprintf_chk(0x7f5363936400, 1, 0x44cb40, 1) = 1 &amp;lt;0.000092&amp;gt;
1638486316.341673 __ctype_b_loc()                = 0x7f5364a2d6f0 &amp;lt;0.000062&amp;gt;
1638486316.341758 __fprintf_chk(0x7f5363936400, 1, 0x44cafd, 0) = 9 &amp;lt;0.000094&amp;gt;
1638486316.341874 __fprintf_chk(0x7f5363936400, 1, 0x44cb40, 2) = 2 &amp;lt;0.000089&amp;gt;
1638486316.341985 __ctype_b_loc()                = 0x7f5364a2d6f0 &amp;lt;0.000062&amp;gt;
1638486316.342069 ext2fs_get_pathname(0x18ab2f0, 0x261db5f7, 0, 0x7ffdc97a2ce0) = 0 &amp;lt;13.722823&amp;gt;
1638486330.064926 strlen(&quot;/REMOTE_PARENT_DIR/???&quot;) = 22 &amp;lt;0.000133&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It isn&apos;t currently possible to reduce the number of unattached inodes (&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14168&quot; title=&quot;e2fsck should avoid moving files into lost+found&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14168&quot;&gt;LU-14168&lt;/a&gt; might avoid attaching them to &lt;tt&gt;lost+found&lt;/tt&gt;, see options there), and it isn&apos;t possible to reduce the size of &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; retroactively (&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-10329&quot; title=&quot;DNE3: REMOTE_PARENT_DIR scalability&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-10329&quot;&gt;LU-10329&lt;/a&gt; and &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15314&quot; title=&quot;set default max-inherit to 3 for default dir stripe policy if stripe count is not 0 or 1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15314&quot;&gt;&lt;del&gt;LU-15314&lt;/del&gt;&lt;/a&gt; can avoid it in the future), so the &lt;tt&gt;ext2fs_get_pathname()&lt;/tt&gt; function it self must be sped up by a few orders of magnitude.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="67478">LU-15330</key>
            <summary>ext2fs_get_pathname() very slow for large directory</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.whamcloud.com/images/icons/priorities/major.svg">Major</priority>
                        <status id="1" iconUrl="https://jira.whamcloud.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="adilger">Andreas Dilger</reporter>
                        <labels>
                    </labels>
                <created>Tue, 7 Dec 2021 05:29:02 +0000</created>
                <updated>Tue, 4 Apr 2023 00:56:39 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>6</watches>
                                                                            <comments>
                            <comment id="320232" author="adilger" created="Tue, 7 Dec 2021 21:03:16 +0000"  >&lt;p&gt;Instead of linearly traversing the whole 60M-entry &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; directory each time to resolve the non-existent pathname, there are a few optimizations that could be done:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;since it appears that &lt;tt&gt;ext2fs_get_pathname()&lt;/tt&gt; is purely informative, and e2fsck has already decided to link the entry into &lt;tt&gt;lost+found&lt;/tt&gt; because it wasn&apos;t found during the forward traversal, it isn&apos;t clear that spending 1.4s per entry to print &quot;&lt;tt&gt;REMOTE_PARENT_DIR/???&lt;/tt&gt;&quot; is worthwhile.  In other cases this might be useful, but not here. Add a special case to e2fsck to avoid doing the pathname lookup in this case.  The complexity is that the call to &lt;tt&gt;ext2fs_get_pathname()&lt;/tt&gt; is done inside &lt;tt&gt;fix_problem(PR_3_UNCONNECTED_DIR)&lt;/tt&gt; because the &quot;&lt;tt&gt;%p&lt;/tt&gt;&quot; directive is used, so a new &lt;tt&gt;PR_3_REMOTE_PARENT_DIR&lt;/tt&gt; would be needed for this.&lt;/li&gt;
	&lt;li&gt;for Lustre, if the parent directory is &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; it could get the FID from the &lt;tt&gt;trusted.lma&lt;/tt&gt; xattr and use that to regenerate the filename and reinsert the entry into &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; rather than adding it to &lt;tt&gt;lost+found&lt;/tt&gt;.  That saves extra work later to recover the file from &lt;tt&gt;lost+found&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;for Lustre, if the parent directory is &lt;b&gt;not&lt;/b&gt; &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt;, it could use the &lt;tt&gt;trusted.link&lt;/tt&gt; xattr to get the filename.  In the common case, there will only be a single link entry, and it can be used to reinsert the file into the parent, if it still exists. If there are multiple link entries, it might be able to match the name against the parent inode FID.&lt;/li&gt;
	&lt;li&gt;for generic &lt;tt&gt;e2fsck&lt;/tt&gt; the &lt;tt&gt;ext2fs_get_pathname()&lt;/tt&gt; function could be changed to use a hash in memory for filename lookups, either the on-disk htree if we assume it is working, or just an in-memory hash from reading and caching the whole directory on first access to do O(1) lookups of the filename instead of O(60M).  The directory itself was 2.9GB on disk, so the hash table could be 7-8GB of RAM (at 128 bytes/entry), but is within acceptable memory usage for the server.    Not yet sure if this is useful or not...&lt;/li&gt;
&lt;/ul&gt;
</comment>
                            <comment id="320269" author="gerrit" created="Wed, 8 Dec 2021 07:58:15 +0000"  >&lt;p&gt;&quot;Andreas Dilger &amp;lt;adilger@whamcloud.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/45785&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/45785&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15330&quot; title=&quot;ext2fs_get_pathname() very slow for large directory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15330&quot;&gt;LU-15330&lt;/a&gt; e2fsck: no parent lookup in disconnected dir&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: ee63db45622128b378abf613ac34ada013097344&lt;/p&gt;</comment>
                            <comment id="321079" author="gerrit" created="Fri, 17 Dec 2021 05:05:30 +0000"  >&lt;p&gt;&quot;Andreas Dilger &amp;lt;adilger@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/45785/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/45785/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15330&quot; title=&quot;ext2fs_get_pathname() very slow for large directory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15330&quot;&gt;LU-15330&lt;/a&gt; e2fsck: no parent lookup in disconnected dir&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 92846e036c76b820445822edc80fc9cff0310a5d&lt;/p&gt;</comment>
                            <comment id="321080" author="gerrit" created="Fri, 17 Dec 2021 05:09:35 +0000"  >&lt;p&gt;&quot;Andreas Dilger &amp;lt;adilger@whamcloud.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/45875&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/45875&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15330&quot; title=&quot;ext2fs_get_pathname() very slow for large directory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15330&quot;&gt;LU-15330&lt;/a&gt; build: update version to 1.46.2.wc4&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 71626c6cbc398101feac0648879a66c48864e326&lt;/p&gt;</comment>
                            <comment id="321083" author="adilger" created="Fri, 17 Dec 2021 05:31:36 +0000"  >&lt;p&gt;Will be included in e2fsprogs-1.46.2.wc4.&lt;/p&gt;</comment>
                            <comment id="321130" author="gerrit" created="Fri, 17 Dec 2021 17:22:25 +0000"  >&lt;p&gt;&quot;Andreas Dilger &amp;lt;adilger@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/45875/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/45875/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15330&quot; title=&quot;ext2fs_get_pathname() very slow for large directory&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15330&quot;&gt;LU-15330&lt;/a&gt; build: update version to 1.46.2.wc4&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: b7742e844edf00cd8a20af2791d9d0ecb9e96a24&lt;/p&gt;</comment>
                            <comment id="321136" author="adilger" created="Fri, 17 Dec 2021 18:49:23 +0000"  >&lt;p&gt;The current patch avoids the parent lookup for unconnected directories, since that will never succeed. That speeds up e2fsck, but still results in thousands or millions of entries in lost+found. I&apos;ve filed &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15383&quot; title=&quot;DNE directories not connected to REMOTE_PARENT_DIR&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15383&quot;&gt;LU-15383&lt;/a&gt; to understand/fix the root cause, but for filesystems that have this problem already, a better outcome would be to use the &lt;tt&gt;trusted.lma&lt;/tt&gt; xattr to generate the filename (from &lt;tt&gt;lma_self_fid&lt;/tt&gt;) and link the entry back into &lt;tt&gt;REMOTE_PARENT_DIR&lt;/tt&gt; instead of &lt;tt&gt;lost+found&lt;/tt&gt;, as long as e2fsck is properly handling the htree insertion. &lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10324">
                    <name>Cloners</name>
                                                                <inwardlinks description="is cloned by">
                                        <issuelink>
            <issuekey id="67676">LU-15383</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="49558">LU-10329</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|i02brj:</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>