<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:34:18 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-3484] Incorrect identification of anonymous dentry as root under SLES11SP2</title>
                <link>https://jira.whamcloud.com/browse/LU-3484</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;When attempting to export Lustre 2.4 via NFS with SLES11SP2, we ran in to an issue (See &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-3483&quot; title=&quot;Null pointer dereference in ll_revalidate_nd (llite/dcache.c) in an NFS mounted Lustre file system&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-3483&quot;&gt;&lt;del&gt;LU-3483&lt;/del&gt;&lt;/a&gt; as well for another) where Lustre identifies anonymous dentries as root dentries and bugs when calling ll_invalidate_aliases.&lt;/p&gt;

&lt;p&gt;Here&apos;s the code in question (from ll_invalidate_aliases in lustre/llite/dcache.c):&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; (dentry-&amp;gt;d_name.len == 1 &amp;amp;&amp;amp; dentry-&amp;gt;d_name.name[0] == &lt;span class=&quot;code-quote&quot;&gt;&apos;/&apos;&lt;/span&gt;) {
                        CERROR(&lt;span class=&quot;code-quote&quot;&gt;&quot;called on root (?) dentry=%p, inode=%p &quot;&lt;/span&gt;
                               &lt;span class=&quot;code-quote&quot;&gt;&quot;ino=%lu\n&quot;&lt;/span&gt;, dentry, inode, inode-&amp;gt;i_ino);
                        lustre_dump_dentry(dentry, 1);
                        libcfs_debug_dumpstack(NULL);
                }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem is a change in d_obtain_alias that&apos;s been made in SLES11SP2.  Here&apos;s where anonymous dentries are named, this is from d_obtain_alias in CentOS6.4 or SLES11SP1:&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;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct qstr anonstring = { .name = &quot;&quot; };
        :
        :
        tmp = d_alloc(NULL, &amp;amp;anonstring);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In SLES11SP2, it&apos;s this:&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;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct qstr anonstring = { .name = &lt;span class=&quot;code-quote&quot;&gt;&quot;/&quot;&lt;/span&gt;, .len = 1 };

        tmp = d_alloc(NULL, &amp;amp;anonstring);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;As you can see, that looks like a root dentry to the check being done by Lustre.  There&apos;s a comment just above saying this was the intention:&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; * This alias can sometimes be seen by prepend_path, so make it look
 * the same as a d_alloc_root alias.
 */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;[The commit is recorded here: &lt;a href=&quot;http://kernel.opensuse.org/cgit/kernel-source/commit/?id=f9a956fc1dc4b5271662736b5016324d43b1b99f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://kernel.opensuse.org/cgit/kernel-source/commit/?id=f9a956fc1dc4b5271662736b5016324d43b1b99f&lt;/a&gt;&lt;br/&gt;
and appears to be SLES specific.]&lt;/p&gt;


&lt;p&gt;Ideally, Lustre would find another way to identify the root dentry here.  I have simply commented out this check while doing further testing, but I&apos;d like to understand:&lt;br/&gt;
Is there a reason Lustre can&apos;t use the same method to see if a dentry is root as the kernel does?&lt;br/&gt;
IE:&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;#define IS_ROOT(x) ((x) == (x)-&amp;gt;d_parent)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If so, I&apos;d suggest that.&lt;/p&gt;</description>
                <environment></environment>
        <key id="19492">LU-3484</key>
            <summary>Incorrect identification of anonymous dentry as root under SLES11SP2</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="bogl">Bob Glossman</assignee>
                                    <reporter username="paf">Patrick Farrell</reporter>
                        <labels>
                            <label>mn4</label>
                            <label>patch</label>
                    </labels>
                <created>Thu, 20 Jun 2013 14:36:49 +0000</created>
                <updated>Thu, 27 Mar 2014 23:14:43 +0000</updated>
                            <resolved>Tue, 16 Jul 2013 22:05:55 +0000</resolved>
                                    <version>Lustre 2.4.0</version>
                                    <fixVersion>Lustre 2.5.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>6</watches>
                                                                            <comments>
                            <comment id="60916" author="paf" created="Thu, 20 Jun 2013 15:02:54 +0000"  >&lt;p&gt;Looks like there&apos;s a problem with that idea - Anonymous dentries are their own parents, just like root dentries.  From d_obtain_alias again:&lt;br/&gt;
        tmp-&amp;gt;d_parent = tmp; /* make sure dput doesn&apos;t croak */&lt;/p&gt;

&lt;p&gt;If no other alias is found, tmp is returned with the parent set as above.&lt;/p&gt;

&lt;p&gt;Suggestions?&lt;/p&gt;</comment>
                            <comment id="60925" author="adilger" created="Thu, 20 Jun 2013 17:09:38 +0000"  >&lt;p&gt;I think in modern kernels there is a flag in the dentry DCACHE_DISCONNECTED, that can be used instead of checking the name.&lt;/p&gt;</comment>
                            <comment id="60928" author="paf" created="Thu, 20 Jun 2013 17:20:21 +0000"  >&lt;p&gt;Andreas,&lt;/p&gt;

&lt;p&gt;There is such a flag, here&apos;s what the header file has to say in SLES11SP2:&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
#define DCACHE_DISCONNECTED     0x0004&lt;br/&gt;
     /* This dentry is possibly not currently connected to the dcache tree, in&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;which case its parent will either be itself, or will have this flag as&lt;/li&gt;
	&lt;li&gt;well.  nfsd will not use a dentry with this bit set, but will first&lt;/li&gt;
	&lt;li&gt;endeavour to clear the bit either by discovering that it is connected,&lt;/li&gt;
	&lt;li&gt;or by performing lookup operations.   Any filesystem which supports&lt;/li&gt;
	&lt;li&gt;nfsd_operations MUST have a lookup function which, if it finds a&lt;/li&gt;
	&lt;li&gt;directory inode with a DCACHE_DISCONNECTED dentry, will d_move that&lt;/li&gt;
	&lt;li&gt;dentry into place and return that dentry rather than the passed one,&lt;/li&gt;
	&lt;li&gt;typically using d_splice_alias. */&lt;br/&gt;
&amp;#8212;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;However, it&apos;s set on anonymous dentries (from d_obtain_alias):&lt;br/&gt;
&amp;#8212;&lt;br/&gt;
        /* attach a disconnected dentry */&lt;br/&gt;
        spin_lock(&amp;amp;tmp-&amp;gt;d_lock);&lt;br/&gt;
        tmp-&amp;gt;d_sb = inode-&amp;gt;i_sb;&lt;br/&gt;
        d_set_d_op(tmp, tmp-&amp;gt;d_sb-&amp;gt;s_d_op);&lt;br/&gt;
        tmp-&amp;gt;d_inode = inode;&lt;br/&gt;
-&lt;del&gt;&amp;gt;   tmp&lt;/del&gt;&amp;gt;d_flags |= DCACHE_DISCONNECTED;&lt;br/&gt;
        list_add(&amp;amp;tmp-&amp;gt;d_alias, &amp;amp;inode-&amp;gt;i_dentry);&lt;br/&gt;
        hlist_bl_lock(&amp;amp;tmp-&amp;gt;d_sb-&amp;gt;s_anon);&lt;br/&gt;
        hlist_bl_add_head(&amp;amp;tmp-&amp;gt;d_hash, &amp;amp;tmp-&amp;gt;d_sb-&amp;gt;s_anon);&lt;br/&gt;
        hlist_bl_unlock(&amp;amp;tmp-&amp;gt;d_sb-&amp;gt;s_anon);&lt;br/&gt;
        spin_unlock(&amp;amp;tmp-&amp;gt;d_lock);&lt;br/&gt;
        spin_unlock(&amp;amp;inode-&amp;gt;i_lock);&lt;br/&gt;
        security_d_instantiate(tmp, inode);&lt;/p&gt;

&lt;p&gt;        return tmp; &lt;br/&gt;
&amp;#8212;&lt;/p&gt;

&lt;p&gt;According to what I&apos;m reading here, it can be unset later, but I don&apos;t know when that would be:&lt;br/&gt;
&lt;a href=&quot;http://www.mjmwired.net/kernel/Documentation/filesystems/Exporting&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mjmwired.net/kernel/Documentation/filesystems/Exporting&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;ll do a bit more reading.&lt;/p&gt;</comment>
                            <comment id="60939" author="paf" created="Thu, 20 Jun 2013 18:41:19 +0000"  >&lt;p&gt;Couldn&apos;t we compare the value of the dentry pointer to the value of the root dentry as given in the super block?&lt;/p&gt;

&lt;p&gt;IE:&lt;br/&gt;
if(dentry == dentry-&amp;gt;d_sb-&amp;gt;s_root)&lt;br/&gt;
As a replacement for the name check.&lt;/p&gt;

&lt;p&gt;Is there a reason that might be unsafe or incorrect in some cases?&lt;/p&gt;</comment>
                            <comment id="60946" author="adilger" created="Thu, 20 Jun 2013 22:05:36 +0000"  >&lt;p&gt;It looks like comparing against &lt;tt&gt;d_sb-&amp;gt;s_root&lt;/tt&gt; should be correct.&lt;/p&gt;</comment>
                            <comment id="60950" author="paf" created="Thu, 20 Jun 2013 22:29:13 +0000"  >&lt;p&gt;Patch is up:&lt;br/&gt;
&lt;a href=&quot;http://review.whamcloud.com/6726&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/6726&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="61313" author="pjones" created="Tue, 25 Jun 2013 14:46:02 +0000"  >&lt;p&gt;Thanks Patrick!&lt;/p&gt;

&lt;p&gt;Bob&lt;/p&gt;

&lt;p&gt;Could you please take care of this patch?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="61405" author="paf" created="Wed, 26 Jun 2013 18:58:30 +0000"  >&lt;p&gt;Quick note on this:&lt;br/&gt;
Contrary to what I said above, the dentry name change has landed in the upstream Linux kernel, by at least 3.7.&lt;/p&gt;</comment>
                            <comment id="62431" author="bogl" created="Tue, 16 Jul 2013 22:03:27 +0000"  >&lt;p&gt;fix landed before 2.4.52 tag.  closing.&lt;/p&gt;</comment>
                    </comments>
                    <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|hzvtnz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8761</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>