<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:24:13 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-16124] Wrong condition in patch &quot;LU-13782 lnet: Have LNet routers monitor the ni_fatal flag&quot; ?</title>
                <link>https://jira.whamcloud.com/browse/LU-16124</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;While browsing the LNet code, I stumbled on the function lnet_update_ni_status_locked() showing the following:&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;
  &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (now &amp;lt; net-&amp;gt;net_last_alive + timeout)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; check_ni_fatal;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;

                spin_lock(&amp;amp;net-&amp;gt;net_lock);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-comment&quot;&gt;/* re-check with lock */&lt;/span&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (now &amp;lt; net-&amp;gt;net_last_alive + timeout) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; spin_unlock(&amp;amp;net-&amp;gt;net_lock);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; check_ni_fatal;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; spin_unlock(&amp;amp;net-&amp;gt;net_lock);
[...]
check_ni_fatal:
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; list_for_each_entry(ni, &amp;amp;net-&amp;gt;net_ni_list, ni_netlist) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; /* lnet_ni_set_status() will perform the same check of
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;* ni_status &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; holding the ni lock. We can safely
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;* check ni_status without that lock because it is only
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;* written to under net_lock/EX and our caller is
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;* holding a net lock.
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;*/
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (atomic_read(&amp;amp;ni-&amp;gt;ni_fatal_error_on) &amp;amp;&amp;amp;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ni-&amp;gt;ni_status &amp;amp;&amp;amp;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ni-&amp;gt;ni_status-&amp;gt;ns_status != LNET_NI_STATUS_DOWN &amp;amp;&amp;amp;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lnet_ni_set_status(ni, LNET_NI_STATUS_DOWN))
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; push = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; } &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;It seems to me that the condition (now &amp;lt; ni-&amp;gt;ni_last_alive + timeout) is inverted, as it will result in setting the interface status to down if the timeout was not yet reached.&lt;/p&gt;

&lt;p&gt;This was introduced by the patch &lt;a href=&quot;https://review.whamcloud.com/#/c/39353/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/#/c/39353/&lt;/a&gt; which changed the behavior without changing the condition.&lt;/p&gt;

&lt;p&gt;The code was previously 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;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (now &amp;lt; ni-&amp;gt;ni_last_alive + timeout)
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lnet_ni_lock(ni);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-comment&quot;&gt;/* re-check with lock */&lt;/span&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (now &amp;lt; ni-&amp;gt;ni_last_alive + timeout) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lnet_ni_unlock(ni);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Do I get this wrong ?&lt;/p&gt;</description>
                <environment>lustre 2.12.8_ddn14</environment>
        <key id="72054">LU-16124</key>
            <summary>Wrong condition in patch &quot;LU-13782 lnet: Have LNet routers monitor the ni_fatal flag&quot; ?</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="6" iconUrl="https://jira.whamcloud.com/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="6">Not a Bug</resolution>
                                        <assignee username="hornc">Chris Horn</assignee>
                                    <reporter username="spiechurski">Sebastien Piechurski</reporter>
                        <labels>
                    </labels>
                <created>Mon, 29 Aug 2022 16:14:11 +0000</created>
                <updated>Tue, 30 Aug 2022 17:32:36 +0000</updated>
                            <resolved>Tue, 30 Aug 2022 17:32:36 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="345004" author="pjones" created="Mon, 29 Aug 2022 19:26:54 +0000"  >&lt;p&gt;Chris&lt;/p&gt;

&lt;p&gt;Do you agree with Sebastien&apos;s analysis of your patch?&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="345089" author="hornc" created="Tue, 30 Aug 2022 15:55:00 +0000"  >&lt;p&gt;Thanks for the report Sebastien.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;It seems to me that the condition (now &amp;lt; ni-&amp;gt;ni_last_alive + timeout) is inverted&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This code does not appear in the lnet_update_ni_status_locked() function. I assume you meant &lt;tt&gt;(now &amp;lt; net-&amp;gt;net_last_alive + timeout)&lt;/tt&gt; ?&lt;/p&gt;

&lt;p&gt;If so, your analysis would be correct if the ni_status was unconditionally set to down by the code at the check_ni_fatal label. However, we can see that ni status is only set to down by this code if &lt;tt&gt;atomic_read(&amp;amp;ni-&amp;gt;ni_fatal_error_on)&lt;/tt&gt; returns non-zero. Thus, the code in lnet_update_ni_status_locked() should be correct.&lt;/p&gt;</comment>
                            <comment id="345100" author="spiechurski" created="Tue, 30 Aug 2022 17:32:14 +0000"  >&lt;p&gt;Ok, thanks Chris for the answer.&lt;/p&gt;

&lt;p&gt;I guess I was confused by the use of the goto, usually used for error handling. Even though the set status to down was conditional, I was still thinking it was something meant to be executed in case the timeout was reached.&lt;/p&gt;

&lt;p&gt;Glad I was wrong then !&lt;/p&gt;

&lt;p&gt;&#160;&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|i02ybj:</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>