<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:28: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-2871] Data can&apos;t be striped across all the OSTs correctly by running &quot;lfs setstripe -c -1 -i n&quot; (n&gt;0)</title>
                <link>https://jira.whamcloud.com/browse/LU-2871</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;I found this problem during the investigation on &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2809&quot; title=&quot;fix ll_setxattr() to always ignore ll_stripe_offset&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2809&quot;&gt;&lt;del&gt;LU-2809&lt;/del&gt;&lt;/a&gt;. While running &quot;lfs setstripe -c -1 -i n testfile&quot;, if ost index n doesn&apos;t start from 0, it shows that data can&apos;t be striped across all the OSTs and OST0 is always ignored.   &lt;/p&gt;</description>
                <environment></environment>
        <key id="17704">LU-2871</key>
            <summary>Data can&apos;t be striped across all the OSTs correctly by running &quot;lfs setstripe -c -1 -i n&quot; (n&gt;0)</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="1" iconUrl="https://jira.whamcloud.com/images/icons/priorities/blocker.svg">Blocker</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="1">Fixed</resolution>
                                        <assignee username="emoly.liu">Emoly Liu</assignee>
                                    <reporter username="emoly.liu">Emoly Liu</reporter>
                        <labels>
                            <label>MB</label>
                    </labels>
                <created>Tue, 26 Feb 2013 20:38:03 +0000</created>
                <updated>Fri, 15 Mar 2013 01:53:12 +0000</updated>
                            <resolved>Fri, 15 Mar 2013 01:52:55 +0000</resolved>
                                    <version>Lustre 2.4.0</version>
                                    <fixVersion>Lustre 2.4.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>10</watches>
                                                                            <comments>
                            <comment id="53060" author="emoly.liu" created="Tue, 26 Feb 2013 22:09:11 +0000"  >&lt;p&gt;OSTCOUNT=4,&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;[root@centos6-1 ~]# cd /mnt/lustre
[root@centos6-1 lustre]# mkdir test;cd test
[root@centos6-1 test]# &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; i in 0 1 2 3; &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; lfs setstripe -i $i -c -1 testfile$i;dd &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;=/dev/zero of=testfile$i bs=2M count=5;done
5+0 records in
5+0 records out
10485760 bytes (10 MB) copied, 0.0220632 s, 475 MB/s
5+0 records in
5+0 records out
10485760 bytes (10 MB) copied, 0.0193019 s, 543 MB/s
5+0 records in
5+0 records out
10485760 bytes (10 MB) copied, 0.0200823 s, 522 MB/s
5+0 records in
5+0 records out
10485760 bytes (10 MB) copied, 0.0190184 s, 551 MB/s
[root@centos6-1 test]# lfs getstripe *
testfile0
lmm_stripe_count:   4
lmm_stripe_size:    1048576
lmm_layout_gen:     0
lmm_stripe_offset:  0
	obdidx		 objid		objid		 group
	     0	             1	          0x1	             0
	     1	             1	          0x1	             0
	     2	             1	          0x1	             0
	     3	             1	          0x1	             0

testfile1
lmm_stripe_count:   4
lmm_stripe_size:    1048576
lmm_layout_gen:     0
lmm_stripe_offset:  1
	obdidx		 objid		objid		 group
	     1	             2	          0x2	             0
	     2	             2	          0x2	             0
	     3	             2	          0x2	             0
	     1	             3	          0x3	             0

testfile2
lmm_stripe_count:   4
lmm_stripe_size:    1048576
lmm_layout_gen:     0
lmm_stripe_offset:  2
	obdidx		 objid		objid		 group
	     2	             3	          0x3	             0
	     3	             3	          0x3	             0
	     1	             4	          0x4	             0
	     2	             4	          0x4	             0

testfile3
lmm_stripe_count:   4
lmm_stripe_size:    1048576
lmm_layout_gen:     0
lmm_stripe_offset:  3
	obdidx		 objid		objid		 group
	     3	             4	          0x4	             0
	     1	             5	          0x5	             0
	     2	             5	          0x5	             0
	     3	             5	          0x5	             0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="53111" author="emoly.liu" created="Wed, 27 Feb 2013 08:25:07 +0000"  >&lt;p&gt;I Added some debug messages, &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;diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c
index 17dca0c..851caee 100644
--- a/lustre/lod/lod_dev.c
+++ b/lustre/lod/lod_dev.c
@@ -68,7 +68,10 @@ &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lod_fld_lookup(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct lu_env *env, struct lod_device *lod,
 
        LASSERTF(fid_is_sane(fid), &lt;span class=&quot;code-quote&quot;&gt;&quot;Invalid FID &quot;&lt;/span&gt;DFID&lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;, PFID(fid));
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fid_is_idif(fid)) {
+               printk(&lt;span class=&quot;code-quote&quot;&gt;&quot;before ostindex:%d, FID &quot;&lt;/span&gt;DFID&lt;span class=&quot;code-quote&quot;&gt;&quot;\n&quot;&lt;/span&gt;,
+                      cpu_to_le32(*tgt), PFID(fid));
                *tgt = fid_idif_ost_idx(fid);
+               printk(&lt;span class=&quot;code-quote&quot;&gt;&quot;after ostindex:%d\n&quot;&lt;/span&gt;, cpu_to_le32(*tgt));
                RETURN(rc);
        }
diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
index f6dad39..39decd5 100644
--- a/lustre/osd-ldiskfs/osd_handler.c
+++ b/lustre/osd-ldiskfs/osd_handler.c
@@ -2206,6 +2206,20 @@ &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; __osd_xattr_set(struct osd_thread_info *info,
 
        ll_vfs_dq_init(inode);
        dentry-&amp;gt;d_inode = inode;
+       &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (strcmp(name, XATTR_NAME_LOV) == 0) {
+               struct lov_mds_md_v1 *lmm = (struct lov_mds_md_v1 *)buf;
+               &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; stripe_count = lmm-&amp;gt;lmm_stripe_count;
+               struct lov_ost_data *objects = lmm-&amp;gt;lmm_objects;
+               &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; i;
+
+               printk(&lt;span class=&quot;code-quote&quot;&gt;&quot;stripecount=%d, stripesize=%d\n&quot;&lt;/span&gt;,
+                      stripe_count, lmm-&amp;gt;lmm_stripe_size);
+               &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (i = 0; i &amp;lt; stripe_count; i++) {
+                      &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; idx = objects[i].l_ost_idx;
+                      printk(&lt;span class=&quot;code-quote&quot;&gt;&quot;here ostindex:%d\n&quot;&lt;/span&gt;, idx);
+               }
+       }
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; inode-&amp;gt;i_op-&amp;gt;setxattr(dentry, name, buf, buflen, fl);
 }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and dmesg showed&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;Lustre: ctl-lustre-MDT0000: super-sequence allocation rc = 0 [0x0000000200000400-0x0000000240000400):0:mdt
before ostindex:-30720, FID [0x100000000:0x1:0x0]
after ostindex:0
before ostindex:0, FID [0x100010000:0x1:0x0]
after ostindex:1
before ostindex:1, FID [0x100020000:0x1:0x0]
after ostindex:2
before ostindex:2, FID [0x100030000:0x1:0x0]
after ostindex:3
stripecount=4, stripesize=1048576
here ostindex:0
here ostindex:1
here ostindex:2
here ostindex:3
before ostindex:-30720, FID [0x100010000:0x2:0x0]
after ostindex:1
before ostindex:1, FID [0x100020000:0x2:0x0]
after ostindex:2
before ostindex:2, FID [0x100030000:0x2:0x0]
after ostindex:3
before ostindex:3, FID [0x100010000:0x3:0x0]
after ostindex:1
stripecount=4, stripesize=1048576
here ostindex:1
here ostindex:2
here ostindex:3
here ostindex:1
before ostindex:-30720, FID [0x100020000:0x3:0x0]
after ostindex:2
before ostindex:2, FID [0x100030000:0x3:0x0]
after ostindex:3
before ostindex:3, FID [0x100010000:0x4:0x0]
after ostindex:1
before ostindex:1, FID [0x100020000:0x4:0x0]
after ostindex:2
stripecount=4, stripesize=1048576
here ostindex:2
here ostindex:3
here ostindex:1
here ostindex:2
before ostindex:-30720, FID [0x100030000:0x4:0x0]
after ostindex:3
before ostindex:3, FID [0x100010000:0x5:0x0]
after ostindex:1
before ostindex:1, FID [0x100020000:0x5:0x0]
after ostindex:2
before ostindex:2, FID [0x100030000:0x5:0x0]
after ostindex:3
stripecount=4, stripesize=1048576
here ostindex:3
here ostindex:1
here ostindex:2
here ostindex:3
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There is something wrong with fid sequence.&lt;/p&gt;</comment>
                            <comment id="53119" author="bobijam" created="Wed, 27 Feb 2013 11:36:42 +0000"  >&lt;p&gt;I found the root cause.&lt;/p&gt;

&lt;p&gt;in lod_qos_ost_in_use_clear(), the ost_in_use array is initialised to 0, and in lod_qos_prep_create()-&amp;gt;old_alloc_specific(), the ost_idx is&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;for&lt;/span&gt; (i = 0; i &amp;lt; ost_count;
                        i++, array_idx = (array_idx + 1) % ost_count) {
                ost_idx = osts-&amp;gt;op_array[array_idx];
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and the ost_idx will be checked upon ost_in_use array&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; (lod_qos_is_ost_used(env, ost_idx, stripe_num))
                        &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If the stripe_offset starts from 0, and in the 1st iteration, stripe_num is also 0, and lod_qos_is_ost_used() will return false, then object will be allocated on the first OST device.&lt;/p&gt;

&lt;p&gt;While if file stripe starting from a number other than 0, when the loop comes to which ost_idx is 0, the lod_qos_is_ost_used(env, 0, stripe_num) will return true, and the 1st OST device will be skipped.&lt;/p&gt;

&lt;p&gt;The fix should be in lod_qos_ost_in_use_clear(). With following patch, the object stripe allocation will be correct.&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;diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c
index 2b81ad8..2f46e7c 100644
--- a/lustre/lod/lod_qos.c
+++ b/lustre/lod/lod_qos.c
@@ -629,7 +629,7 @@ &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; lod_qos_ost_in_use_clear(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct lu_env *env, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; stripes
                CERROR(&lt;span class=&quot;code-quote&quot;&gt;&quot;can&apos;t allocate memory &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ost-in-use array\n&quot;&lt;/span&gt;);
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; -ENOMEM;
        }
-       memset(info-&amp;gt;lti_ea_store, 0, sizeof(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;) * stripes);
+       memset(info-&amp;gt;lti_ea_store, -1, sizeof(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;) * stripes);
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 0;
 }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="53142" author="bzzz" created="Wed, 27 Feb 2013 20:47:30 +0000"  >&lt;p&gt;pretty much correct. please put a patch into gerrit, thanks.&lt;/p&gt;</comment>
                            <comment id="53145" author="emoly.liu" created="Wed, 27 Feb 2013 21:32:35 +0000"  >&lt;p&gt;Another way, run lod_qos_ost_in_use() after lod_qos_is_ost_used() check, right?&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;diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c
index 2b81ad8..92b3b36 100644
--- a/lustre/lod/lod_qos.c
+++ b/lustre/lod/lod_qos.c
@@ -887,6 +887,7 @@ repeat_find:
                 */
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (lod_qos_is_ost_used(env, ost_idx, stripe_num))
                        &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
+               lod_qos_ost_in_use(env, stripe_num, ost_idx);
 
                /* Drop slow OSCs &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; we can, but not &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; requested start idx.
                 *
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="53152" author="emoly.liu" created="Wed, 27 Feb 2013 21:58:59 +0000"  >&lt;p&gt;I will add a sanity test for this case.&lt;/p&gt;</comment>
                            <comment id="53163" author="emoly.liu" created="Thu, 28 Feb 2013 01:54:39 +0000"  >&lt;p&gt;Patch is at &lt;a href=&quot;http://review.whamcloud.com/5554&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/5554&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="53213" author="bzzz" created="Fri, 1 Mar 2013 04:19:14 +0000"  >&lt;p&gt;liuying, it&apos;s better to mark index used after successful lod_qos_declare_object_on(). and I don&apos;t think this is an option to the change by Zhenyu Xu, I think the both changes should be applied.&lt;/p&gt;</comment>
                            <comment id="53214" author="emoly.liu" created="Fri, 1 Mar 2013 04:27:45 +0000"  >&lt;p&gt;Sure, I made the both changes in the patch and will update it per Ned Bass&apos; advice later. Thanks!&lt;/p&gt;</comment>
                            <comment id="54081" author="emoly.liu" created="Fri, 15 Mar 2013 01:52:56 +0000"  >&lt;p&gt;Landed for 2.4&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="17740">LU-2893</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="17560">LU-2809</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|hzvjv3:</customfieldvalue>

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