<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:35:32 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-10487] ostid_set_{seq,id}() badness</title>
                <link>https://jira.whamcloud.com/browse/LU-10487</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Reviewing &lt;a href=&quot;https://review.whamcloud.com/#/c/30376/,&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/#/c/30376/&lt;/a&gt; I noticed several issues with &lt;tt&gt;ostid_set_seq()&lt;/tt&gt; and &lt;tt&gt;ostid_set_id()&lt;/tt&gt;. The normal use of these functions looks like:&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;struct ost_id oi;
...
ostid_set_seq(&amp;amp;oi, ...);
rc = ostid_set_id(&amp;amp;oi, ...);
...

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;1. In &lt;tt&gt;ostid_set_seq()&lt;/tt&gt; we (sometimes) make decisions based on &lt;tt&gt;oi_fid.f_oid&lt;/tt&gt; and &lt;tt&gt;oi_fid.f_ver&lt;/tt&gt; which may be uninitialized:&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; inline void ostid_set_seq(struct ost_id *oi, __u64 seq)
{
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fid_seq_is_mdt0(seq) || fid_seq_is_default(seq)) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oi-&amp;gt;oi.oi_seq = seq;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oi-&amp;gt;oi_fid.f_seq = seq;
&#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;&#160;&#160;&#160;&#160;&#160;&#160; * Note: &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; f_oid + f_ver is zero, we need init it
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * to be 1, otherwise, ostid_seq will treat &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * as old ostid (oi_seq == 0)
&#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;&#160;&#160;&#160;&#160;&#160;&#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!oi-&amp;gt;oi_fid.f_oid &amp;amp;&amp;amp; !oi-&amp;gt;oi_fid.f_ver)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; oi-&amp;gt;oi_fid.f_oid = LUSTRE_FID_INIT_OID;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2. In &lt;tt&gt;ostid_set_id()&lt;/tt&gt; we make decisions based on &lt;tt&gt;fid_is_idif(&amp;amp;oi-&amp;gt;oi_fid) === fid_seq_is_idif(oi-&amp;gt;oi_fid.f_seq)&lt;/tt&gt; which may not have been initialized by &lt;tt&gt;ostid_set_seq()&lt;/tt&gt;:&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; inline &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; ostid_set_id(struct ost_id *oi, __u64 oid)
{
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fid_seq_is_mdt0(oi-&amp;gt;oi.oi_seq)) {
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (oid &amp;gt;= IDIF_MAX_OID)
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; -E2BIG;
                oi-&amp;gt;oi.oi_id = oid;
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fid_is_idif(&amp;amp;oi-&amp;gt;oi_fid)) {
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (oid &amp;gt;= IDIF_MAX_OID)
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; -E2BIG;
                oi-&amp;gt;oi_fid.f_seq = fid_idif_seq(oid,
                                                fid_idif_ost_idx(&amp;amp;oi-&amp;gt;oi_fid));
                oi-&amp;gt;oi_fid.f_oid = oid;
                oi-&amp;gt;oi_fid.f_ver = oid &amp;gt;&amp;gt; 48;
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (oid &amp;gt;= OBIF_MAX_OID)
                        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; -E2BIG;
                oi-&amp;gt;oi_fid.f_oid = oid;
        }
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 0;
}

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;3. In the IDIF case, setting &lt;tt&gt;f_ver = oid &amp;gt;&amp;gt; 48&lt;/tt&gt; seems broken. We have already rejected OIDs greater than or equal to &lt;tt&gt;IDIF_MAX_OID === 1UL &amp;lt;&amp;lt; 48&lt;/tt&gt;. So we must have &lt;tt&gt;oid &amp;lt; (1UL &amp;lt;&amp;lt; 48)&lt;/tt&gt; and therefore &lt;tt&gt;oid &amp;gt;&amp;gt; 48&lt;/tt&gt; is always zero.&lt;/p&gt;

&lt;p&gt;Perhaps it would be safer (and clearer) to have a single function that takes seq and oid and initializes the ostid completely.&lt;/p&gt;</description>
                <environment></environment>
        <key id="50132">LU-10487</key>
            <summary>ostid_set_{seq,id}() badness</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="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="jhammond">John Hammond</reporter>
                        <labels>
                            <label>medium</label>
                    </labels>
                <created>Wed, 10 Jan 2018 17:29:47 +0000</created>
                <updated>Thu, 27 May 2021 01:24:38 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="64332">LU-14692</issuekey>
        </issuelink>
                            </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|hzzqtz:</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>