<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:57: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-12977] fix i_mutex for ldiskfs_truncate() in osd_execute_truncate()</title>
                <link>https://jira.whamcloud.com/browse/LU-12977</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;The &lt;tt&gt;inode-&amp;gt;i_mutex&lt;/tt&gt; should be held when calling &lt;tt&gt;osd_execute_truncate-&amp;gt;ldiskfs_truncate()&lt;/tt&gt;.  However, due to locking order in osd-ldiskfs we cannot just grab &lt;tt&gt;i_mutex&lt;/tt&gt; around &lt;tt&gt;ldiskfs_truncate()&lt;/tt&gt; as that can lead to deadlocks as described in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6446&quot; title=&quot;Warn-on in ldiskfs_orphan_add/del&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6446&quot;&gt;&lt;del&gt;LU-6446&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-4252&quot; title=&quot;Failure on test suite racer test_1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-4252&quot;&gt;&lt;del&gt;LU-4252&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Currently, there is an ldiskfs patch to remove the &lt;tt&gt;WARN_ON()&lt;/tt&gt; in &lt;tt&gt;ext4_truncate()&lt;/tt&gt; when it is called without &lt;tt&gt;i_mutex&lt;/tt&gt; held.  This is safe because the &lt;tt&gt;osd-ldiskfs&lt;/tt&gt; code holds its own lock (&lt;tt&gt;oo_ext_idx_sem&lt;/tt&gt;) on the object over the &lt;tt&gt;ldiskfs_truncate()&lt;/tt&gt; call, but potentially there is a way to improve this without patching the ldiskfs code.&lt;/p&gt;

&lt;p&gt;The truncate-warning patch was first added with:&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; commit 3daba43a191a0a2c9358d39b3f48b1b759a41819
 Author:     Yang Sheng &amp;lt;yang.sheng@intel.com&amp;gt;

    LU-6446 ldiskfs: remove WARN_ON from ldiskfs_orphan_add{del}
    
    RHEL7.1 kernel carefully check i_mutex whether locked in
    many places. It will be triggered while ldiskfs_truncate()
    was invoked in osd layer. A dead lock would occured if we
    just locked i_mutex around it since Lustre using a reverse
    order for start journal==&amp;gt;lock i_mutex. Consider Lustre has
    own ldlm lock. So just remove such messages in ldiskfs patches.

    Reviewed-on: http://review.whamcloud.com/14690
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;so I think moving the lock is not as easily done as what is done in the current patch, see comments in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6446&quot; title=&quot;Warn-on in ldiskfs_orphan_add/del&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6446&quot;&gt;&lt;del&gt;LU-6446&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-4252&quot; title=&quot;Failure on test suite racer test_1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-4252&quot;&gt;&lt;del&gt;LU-4252&lt;/del&gt;&lt;/a&gt; for details.  The code &lt;em&gt;used&lt;/em&gt; to look like 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;
       &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!(inode-&amp;gt;i_state &amp;amp; (I_NEW|I_FREEING)))
               mutex_lock(&amp;amp;inode-&amp;gt;i_mutex);
       ldiskfs_truncate(inode);
       &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!(inode-&amp;gt;i_state &amp;amp; (I_NEW|I_FREEING)))
               mutex_unlock(&amp;amp;inode-&amp;gt;i_mutex);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;but this was removed as part of the patch:&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; commit b98792ae96ad2bb3c73ca3ebebdd8edfdfbc35df
 Author:     yangsheng &amp;lt;yang.sheng@intel.com&amp;gt;

    LU-4252 osd: remove locking i_mutex in osd_punch
    
    This piece of code intent to calm down the kernel
    WARN_ON messsage show up since 3.9 upstream. So we
    can just remove it for now. We&apos;ll add a ldiskfs
    patch to resolve this issue while 3.9 server support
    come up.

    Reviewed-on: http://review.whamcloud.com/9644
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In more recent developments, &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; changed the truncate code so that it is called asynchronously from the main transaction, so that it doesn&apos;t bloat transaction sizes, and avoids lock ordering issues:&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;commit cf29a5e7bfa254ccfcea023028fe7da80503c512
Author:     Alex Zhuravlev &amp;lt;alexey.zhuravlev@intel.com&amp;gt;

    LU-10048 osd: async truncate
    
    osd-ldiskfs should execute truncate outside of main transaction
    handle. This avoids restarting truncate transaction handles in
    main transaction, and allows &quot;transaction first, locking second&quot;
    model on OST.
    
    Reviewed-on: https://review.whamcloud.com/27488
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It &lt;em&gt;may&lt;/em&gt; now be OK to grab &lt;tt&gt;i_mutex&lt;/tt&gt; around &lt;tt&gt;ldiskfs_truncate()&lt;/tt&gt; in &lt;tt&gt;osd_execute_truncate()&lt;/tt&gt; and remove &lt;tt&gt;ext4-remove-truncate-warning.patch&lt;/tt&gt;, but this should be reviewed and tested properly (e.g. with the racer workload that triggered &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-4252&quot; title=&quot;Failure on test suite racer test_1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-4252&quot;&gt;&lt;del&gt;LU-4252&lt;/del&gt;&lt;/a&gt; originally).&lt;/p&gt;</description>
                <environment></environment>
        <key id="57402">LU-12977</key>
            <summary>fix i_mutex for ldiskfs_truncate() in osd_execute_truncate()</summary>
                <type id="4" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</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="simmonsja">James A Simmons</assignee>
                                    <reporter username="adilger">Andreas Dilger</reporter>
                        <labels>
                    </labels>
                <created>Fri, 15 Nov 2019 20:50:26 +0000</created>
                <updated>Fri, 24 Sep 2021 18:33:09 +0000</updated>
                            <resolved>Tue, 28 Jan 2020 13:51:05 +0000</resolved>
                                                    <fixVersion>Lustre 2.14.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="260460" author="gerrit" created="Mon, 30 Dec 2019 17:59:10 +0000"  >&lt;p&gt;James Simmons (jsimmons@infradead.org) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37116&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37116&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12977&quot; title=&quot;fix i_mutex for ldiskfs_truncate() in osd_execute_truncate()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12977&quot;&gt;&lt;del&gt;LU-12977&lt;/del&gt;&lt;/a&gt; ldiskfs: properly take inode_lock() for truncates&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: b8c9dbc6da6215c828b59e5654f66155da7d1382&lt;/p&gt;</comment>
                            <comment id="261984" author="gerrit" created="Tue, 28 Jan 2020 06:03:49 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/37116/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37116/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12977&quot; title=&quot;fix i_mutex for ldiskfs_truncate() in osd_execute_truncate()&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12977&quot;&gt;&lt;del&gt;LU-12977&lt;/del&gt;&lt;/a&gt; ldiskfs: properly take inode_lock() for truncates&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: f64e9f19f68e3983024520bd80122f12367a235a&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="22014">LU-4252</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="29458">LU-6446</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="48520">LU-10048</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="54424">LU-11832</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="57957">LU-13183</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="58052">LU-13234</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|i00pkf:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>