<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:56:17 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-5994] DT transaction start and object lock ordering</title>
                <link>https://jira.whamcloud.com/browse/LU-5994</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&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;lfsck_layout_slave_conditional_destroy()&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; and &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;lfsck_layout_slave_repair_pfid()&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; both call dt_trans_start_local() while holding a DT write lock on an object. This was found by code inspection.&lt;/p&gt;

&lt;p&gt;I also ran with the following:&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;diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
index 80d1e67..ed15b0c 100644
--- a/lustre/osd-ldiskfs/osd_handler.c
+++ b/lustre/osd-ldiskfs/osd_handler.c
@@ -1058,6 +1058,8 @@ int osd_trans_start(const struct lu_env *env, struct dt_device *d,
         if (!IS_ERR(jh)) {
                 oh-&amp;gt;ot_handle = jh;
                 LASSERT(oti-&amp;gt;oti_txns == 0);
+               LASSERT(oti-&amp;gt;oti_w_locks == 0);
+               LASSERT(oti-&amp;gt;oti_r_locks == 0);
                 lu_context_init(&amp;amp;th-&amp;gt;th_ctx, th-&amp;gt;th_tags);
                 lu_context_enter(&amp;amp;th-&amp;gt;th_ctx);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Running sanity-lfsck.sh I was able to trigger a crash from &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;lfsck_layout_slave_repair_pfid()&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&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;[ 1827.711965] Lustre: DEBUG MARKER: == sanity-lfsck test 19b: OST-object inconsistency self repair == 11:01:32 (1417798892)
[ 1827.813194] Lustre: DEBUG MARKER: cancel_lru_locks osc start
[ 1827.838214] Lustre: *** cfs_fail_loc=1611, val=0***
[ 1827.839821] Lustre: Skipped 3 previous similar messages
[ 1827.877070] Lustre: DEBUG MARKER: cancel_lru_locks osc stop
[ 1827.957214] LustreError: 21862:0:(osd_handler.c:1061:osd_trans_start()) ASSERTION( oti-&amp;gt;oti_w_locks == 0 ) failed:
[ 1827.960100] LustreError: 21862:0:(osd_handler.c:1061:osd_trans_start()) LBUG
[ 1827.961698] Pid: 21862, comm: inconsistency_v
[ 1827.962700]
[ 1827.962702] Call Trace:
[ 1827.963692]  [&amp;lt;ffffffffa052f8c5&amp;gt;] libcfs_debug_dumpstack+0x55/0x80 [libcfs]
[ 1827.965393]  [&amp;lt;ffffffffa052fec7&amp;gt;] lbug_with_loc+0x47/0xb0 [libcfs]
[ 1827.966913]  [&amp;lt;ffffffffa0d98809&amp;gt;] osd_trans_start+0x389/0x730 [osd_ldiskfs]
[ 1827.968553]  [&amp;lt;ffffffffa0c44ed2&amp;gt;] lfsck_layout_slave_in_notify+0x982/0xcf0 [lfsck]
[ 1827.969963]  [&amp;lt;ffffffffa0c0cd37&amp;gt;] lfsck_in_notify+0xf7/0x5a0 [lfsck]
[ 1827.971155]  [&amp;lt;ffffffffa0fe6037&amp;gt;] ofd_inconsistency_verification_main+0x367/0xdb0 [ofd]
[ 1827.972639]  [&amp;lt;ffffffff8105e59d&amp;gt;] ? finish_task_switch+0x7d/0x110
[ 1827.973774]  [&amp;lt;ffffffff8105e568&amp;gt;] ? finish_task_switch+0x48/0x110
[ 1827.974896]  [&amp;lt;ffffffff81061d90&amp;gt;] ? default_wake_function+0x0/0x20
[ 1827.976039]  [&amp;lt;ffffffffa0fe5cd0&amp;gt;] ? ofd_inconsistency_verification_main+0x0/0xdb0 [ofd]
[ 1827.977539]  [&amp;lt;ffffffff8109e856&amp;gt;] kthread+0x96/0xa0
[ 1827.978448]  [&amp;lt;ffffffff8100c30a&amp;gt;] child_rip+0xa/0x20
[ 1827.979368]  [&amp;lt;ffffffff815562e0&amp;gt;] ? _spin_unlock_irq+0x30/0x40
[ 1827.980507]  [&amp;lt;ffffffff8100bb10&amp;gt;] ? restore_args+0x0/0x30
[ 1827.981704]  [&amp;lt;ffffffff8109e7c0&amp;gt;] ? kthread+0x0/0xa0
[ 1827.982787]  [&amp;lt;ffffffff8100c300&amp;gt;] ? child_rip+0x0/0x20
[ 1827.983912]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I also found that OFD also does this in enough places that I added &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; || strstr(current-&amp;gt;comm, &lt;span class=&quot;code-quote&quot;&gt;&quot;ll_ost&quot;&lt;/span&gt;) != NULL&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; to the assertions above. Should OFD be following the same order?&lt;/p&gt;</description>
                <environment></environment>
        <key id="27816">LU-5994</key>
            <summary>DT transaction start and object lock ordering</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="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="3">Duplicate</resolution>
                                        <assignee username="yong.fan">nasf</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Dec 2014 19:47:08 +0000</created>
                <updated>Tue, 5 Jun 2018 16:58:47 +0000</updated>
                            <resolved>Tue, 5 Jun 2018 16:58:47 +0000</resolved>
                                    <version>Lustre 2.7.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>6</watches>
                                                                            <comments>
                            <comment id="101067" author="yong.fan" created="Tue, 9 Dec 2014 08:48:22 +0000"  >&lt;p&gt;Hm, I remembered that why LFSCK used such transaction/dt_lock order. Normally, or say on MDT, we start transaction firstly, then take dt_lock; but on the OST, we use the reverse order, for example, ofd_object_destroy().&lt;/p&gt;

&lt;p&gt;I do not know why the OFD has different behaviour as MDT does.&lt;br/&gt;
Alex, what&apos;s your suggestion for that?&lt;/p&gt;</comment>
                            <comment id="101068" author="bzzz" created="Tue, 9 Dec 2014 08:54:36 +0000"  >&lt;p&gt;yes, this is a known technical debt.. we always wanted to have locks-the-transaction order (this is what the majority of the filesystem do) and implemented OFD this way, but that would serialize directory operations on MDS..&lt;/p&gt;</comment>
                            <comment id="101072" author="yong.fan" created="Tue, 9 Dec 2014 09:58:07 +0000"  >&lt;p&gt;If according to local filesystem order, we should take dt_lock before transaction started, right? But as a distributed filesystem, what&apos;s the potential trouble if we change MDS side order to match OST side? And what we should do for this ticket? We have kept such confused orders for a long time.&lt;/p&gt;</comment>
                            <comment id="101074" author="bzzz" created="Tue, 9 Dec 2014 10:05:45 +0000"  >&lt;p&gt;well, I think it&apos;d be very good to have a same order of course. as for MDS: basically we use dt_write_lock() to control nlink+&lt;ins&gt;/nlink&lt;/ins&gt;+. IIRC. if we take the lock outside of a transaction, then basically all the operations in a directory are serialized. actually both OSDs protect nlink internally and I wonder wouldn&apos;t it be enough. originally this &quot;local&quot; locking was introduced in 2.0 to support a mode where LDLM lock is taken for a node, not for a thread. something to take into account, I guess.&lt;/p&gt;</comment>
                            <comment id="101078" author="yong.fan" created="Tue, 9 Dec 2014 11:59:01 +0000"  >&lt;p&gt;Then I would say that it will not be a small change. We need to unify the dt_lock and transaction order on both MDT and OST, that may be affect not only scalabilities but also potential deadlock. Currently, the order of dt_lock and transaction in LFSCK matches both MDT and OST (different functions use different orders).&lt;br/&gt;
Since Lustre-2.7 feature landing has been already closed, we can resolve this known main technical debt in next release.&lt;/p&gt;</comment>
                            <comment id="179179" author="yong.fan" created="Thu, 29 Dec 2016 13:20:08 +0000"  >&lt;p&gt;Part of the issues for the order of starting transaction and locking object will be handled via the patch &lt;a href=&quot;http://review.whamcloud.com/23689&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/23689&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="229115" author="yong.fan" created="Tue, 5 Jun 2018 16:58:47 +0000"  >&lt;p&gt;It will be fixed via &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-10048&quot; title=&quot;osd-ldiskfs to truncate outside of main transaction&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-10048&quot;&gt;&lt;del&gt;LU-10048&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="48520">LU-10048</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="41374">LU-8806</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hzx207:</customfieldvalue>

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