<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:15: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-15081] set_nlink() can race with itself corrupting s_remove_count on the client</title>
                <link>https://jira.whamcloud.com/browse/LU-15081</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;
Mar  3 16:08:57 c-lmo161 kernel: ------------[ cut here ]------------
Mar  3 16:08:57 c-lmo161 kernel: WARNING: CPU: 5 PID: 195090 at fs/inode.c:241 __destroy_inode+0xdb/0xf0
Mar  3 16:08:57 c-lmo161 kernel: Modules linked in: mgc(OE) lustre(OE) lmv(OE) mdc(OE) fid(OE) lov(OE) fld(OE) osc(OE) ko2iblnd(OE) ptlrpc(OE) obdclass(OE) lnet(OE) libcfs(OE) rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache mlx5_ib(OE) mlx5_core(OE) mlxfw sunrpc ib_isert(OE) ib_srpt(OE) ib_srp(OE) ib_ucm(OE) sb_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel iTCO_wdt iTCO_vendor_support lrw gf128mul glue_helper ablk_helper cryptd rpcrdma(OE) svcrdma(OE) xprtrdma(OE) ib_umad(OE) rdma_ucm(OE) rdma_cm(OE) iw_cm(OE) ib_iser(OE) ib_ipoib(OE) ib_cm(OE) pcspkr joydev lpc_ich mei_me sg i2c_i801 mei wmi ioatdma ipmi_si ipmi_devintf ipmi_msghandler ip_tables ext4 mbcache jbd2 sd_mod crc_t10dif crct10dif_generic mlx4_ib(OE) ib_uverbs(OE) mlx4_en(OE)
Mar  3 16:08:57 c-lmo161 kernel: ib_core(OE) mgag200 mlx4_core(OE) drm_kms_helper syscopyarea isci sysfillrect igb crct10dif_pclmul crct10dif_common sysimgblt fb_sys_fops ahci crc32c_intel ttm libsas libahci scsi_transport_sas ptp drm pps_core libata dca mlx_compat(OE) drm_panel_orientation_quirks i2c_algo_bit devlink dm_mirror dm_region_hash dm_log dm_mod
Mar  3 16:08:57 c-lmo161 kernel: CPU: 5 PID: 195090 Comm: mdtest Tainted: G        W  OE  ------------   3.10.0-957.5.1.el7.x86_64 #1
Mar  3 16:08:57 c-lmo161 kernel: Hardware name: Intel Corporation S2600JF/S2600JF, BIOS SE5C600.86B.02.04.0003.102320141138 10/23/2014
Mar  3 16:08:57 c-lmo161 kernel: Call Trace:
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9ff61e41&amp;gt;] dump_stack+0x19/0x1b
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9f897688&amp;gt;] __warn+0xd8/0x100
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9f8977cd&amp;gt;] warn_slowpath_null+0x1d/0x20
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9fa5ecbb&amp;gt;] __destroy_inode+0xdb/0xf0
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9fa5ecf2&amp;gt;] destroy_inode+0x22/0x60
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9fa5ee45&amp;gt;] evict+0x115/0x180
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9fa5f6ec&amp;gt;] iput+0xfc/0x190
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9fa5385e&amp;gt;] do_unlinkat+0x1ae/0x2d0
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9fa54916&amp;gt;] SyS_unlink+0x16/0x20
Mar  3 16:08:57 c-lmo161 kernel: [&amp;lt;ffffffff9ff74ddb&amp;gt;] system_call_fastpath+0x22/0x27
Mar  3 16:08:57 c-lmo161 kernel: ---[ end trace f53c1dca536ee43c ]---
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Despite the fact that s_remove_counter itself is an atomic, set_nlink() handling is not atomic. Two racing set_nlink()&apos;s, depending on the race, will lead to one of the two nlink values. However, this race can corrupt s_remove_counter which will lead to spam in the kernel logs.&lt;/p&gt;</description>
                <environment></environment>
        <key id="66580">LU-15081</key>
            <summary>set_nlink() can race with itself corrupting s_remove_count on the client</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="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="panda">Andrew Perepechko</assignee>
                                    <reporter username="panda">Andrew Perepechko</reporter>
                        <labels>
                            <label>patch</label>
                    </labels>
                <created>Mon, 11 Oct 2021 19:07:25 +0000</created>
                <updated>Mon, 16 Jan 2023 22:32:35 +0000</updated>
                            <resolved>Wed, 27 Oct 2021 04:00:53 +0000</resolved>
                                                    <fixVersion>Lustre 2.15.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="315242" author="panda" created="Mon, 11 Oct 2021 19:08:11 +0000"  >&lt;p&gt;A patch will be uploaded shortly.&lt;/p&gt;</comment>
                            <comment id="315243" author="gerrit" created="Mon, 11 Oct 2021 19:13:53 +0000"  >&lt;p&gt;&quot;Andrew Perepechko &amp;lt;andrew.perepechko@hpe.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/45191&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/45191&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15081&quot; title=&quot;set_nlink() can race with itself corrupting s_remove_count on the client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15081&quot;&gt;&lt;del&gt;LU-15081&lt;/del&gt;&lt;/a&gt; vfs: set_nlink() is not race-safe&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 0cf621e17c0d035ff33edf56035bce5ecb8beef2&lt;/p&gt;</comment>
                            <comment id="315246" author="panda" created="Mon, 11 Oct 2021 19:56:19 +0000"  >&lt;p&gt;Although we did not capture the logs for this issue in the field. I believe, a possible scenario is dropping n_link to zero in the context of ll_unlink() and then raising it to 1 in some getattr context as a result of delayed getattr processing:&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;
void set_nlink(struct inode *inode, unsigned &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; nlink)
{
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!nlink) {
                clear_nlink(inode);
        } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
                &lt;span class=&quot;code-comment&quot;&gt;/* Yes, some filesystems &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; change nlink from zero to one */&lt;/span&gt;
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (inode-&amp;gt;i_nlink == 0)
                        atomic_long_dec(&amp;amp;inode-&amp;gt;i_sb-&amp;gt;s_remove_count);

                inode-&amp;gt;__i_nlink = nlink;
        }
}
EXPORT_SYMBOL(set_nlink);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If two threads are setting nlink to 1 and simultaneously processing &quot;if (inode-&amp;gt;i_nlink == 0)&quot;, then both of them can drop s_remove_count while it was incremented only once when nlink initially dropped to zero in ll_unlink().&lt;/p&gt;</comment>
                            <comment id="316638" author="gerrit" created="Wed, 27 Oct 2021 00:38:14 +0000"  >&lt;p&gt;&quot;Oleg Drokin &amp;lt;green@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/45191/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/45191/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15081&quot; title=&quot;set_nlink() can race with itself corrupting s_remove_count on the client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15081&quot;&gt;&lt;del&gt;LU-15081&lt;/del&gt;&lt;/a&gt; vfs: set_nlink() is not race-safe&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 12b05772fdb6d080819b6c213fcd7f8705278412&lt;/p&gt;</comment>
                            <comment id="316663" author="pjones" created="Wed, 27 Oct 2021 04:00:53 +0000"  >&lt;p&gt;Landed for 2.15&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                                        </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|i026v3:</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>