<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:51:08 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-12272] Support renameat2() with RENAME_NOREPLACE flag</title>
                <link>https://jira.whamcloud.com/browse/LU-12272</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;This is related to a previous ticket &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11557&quot; title=&quot;Implement renameat2() with RENAME_EXCHANGE and RENAME_WHITEOUT&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11557&quot;&gt;LU-11557&lt;/a&gt; and is also about &lt;tt&gt;renameat2()&lt;/tt&gt;, but actually I think it is even more important so I decided to open a separate ticket.&lt;/p&gt;

&lt;p&gt;It would be nice to have support for &lt;a href=&quot;http://man7.org/linux/man-pages/man2/renameat2.2.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;renameat2()&lt;/a&gt; with &lt;tt&gt;RENAME_NOREPLACE&lt;/tt&gt; in Lustre.&lt;/p&gt;

&lt;p&gt;Currently, when &lt;tt&gt;renameat2&lt;/tt&gt; is called with this flag, Lustre doesn&apos;t perform the rename: it either returns &lt;tt&gt;errno=EINVAL&lt;/tt&gt; if the destination file doesn&apos;t exist, or we got &lt;tt&gt;errno=EEXIST&lt;/tt&gt; if the destination file already exists (the latter is expected). We see the same behavior with other filesystems that also don&apos;t support renameat2() flags.&lt;/p&gt;

&lt;p&gt;Reproducer:&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;[sthiell@sh-ln08 login /fir/users/sthiell]$ cat renameat2.c 
#include &amp;lt;errno.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;
#include &amp;lt;linux/fs.h&amp;gt;
#include &amp;lt;sys/syscall.h&amp;gt;

int main()
{
  int ret;

  ret = syscall(SYS_renameat2, 0, &quot;/fir/users/sthiell/file1&quot;, 0, &quot;/fir/users/sthiell/file2&quot;, RENAME_NOREPLACE);
  fprintf(stderr, &quot;renameat2 ret=%d errno=%d (%m)\n&quot;, ret, errno, errno);
  return ret;
}


[sthiell@sh-ln08 login /fir/users/sthiell]$ gcc -o renameat2 renameat2.c
[sthiell@sh-ln08 login /fir/users/sthiell]$ rm file1 file2
rm: cannot remove &#8216;file1&#8217;: No such file or directory
rm: cannot remove &#8216;file2&#8217;: No such file or directory
[sthiell@sh-ln08 login /fir/users/sthiell]$ touch file1
[sthiell@sh-ln08 login /fir/users/sthiell]$ ./renameat2
renameat2 ret=-1 errno=22 (Invalid argument)
[sthiell@sh-ln08 login /fir/users/sthiell]$ ls file*
file1
[sthiell@sh-ln08 login /fir/users/sthiell]$ touch file2
[sthiell@sh-ln08 login /fir/users/sthiell]$ ls -i file*
144117284070328763 file1 144117284070328764 file2
[sthiell@sh-ln08 login /fir/users/sthiell]$ ./renameat2
renameat2 ret=-1 errno=17 (File exists)
[sthiell@sh-ln08 login /fir/users/sthiell]$ ls -i file*
144117284070328763 file1 144117284070328764 file2
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;A local filesystem, here XFS, has the expected behavior:&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;[sthiell@sh-ln08 login /tmp]$ rm file1 file2
[sthiell@sh-ln08 login /tmp]$ touch file1
[sthiell@sh-ln08 login /tmp]$ ls -i file*
1075302339 file1
[sthiell@sh-ln08 login /tmp]$ ./renameat2 
renameat2 ret=0 errno=0 (Success)
[sthiell@sh-ln08 login /tmp]$ ls -i file*
1075302339 file2
[sthiell@sh-ln08 login /tmp]$ touch file1
[sthiell@sh-ln08 login /tmp]$ ls -i file*
1075302340 file1  1075302339 file2
[sthiell@sh-ln08 login /tmp]$ ./renameat2 
renameat2 ret=-1 errno=17 (File exists)
[sthiell@sh-ln08 login /tmp]$ ls -i file*
1075302340 file1  1075302339 file2
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;There are multiple use cases that I can think for this feature. Our particular use-case for this is to ensure that when multiple renames are done to the same destination file, only the first one would actually succeed and the others would fail with &lt;tt&gt;EEXIST&lt;/tt&gt;. As of today, subsequent renames always override the destination file. Thanks for considering this feature in a future version of Lustre. Happy to discuss this at LUG next week!&lt;/p&gt;</description>
                <environment>CentOS 7.6</environment>
        <key id="55587">LU-12272</key>
            <summary>Support renameat2() with RENAME_NOREPLACE flag</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="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="dongyang">Dongyang Li</assignee>
                                    <reporter username="sthiell">Stephane Thiell</reporter>
                        <labels>
                    </labels>
                <created>Wed, 8 May 2019 17:13:05 +0000</created>
                <updated>Mon, 21 Oct 2019 16:47:15 +0000</updated>
                                            <version>Lustre 2.12.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="246887" author="pjones" created="Thu, 9 May 2019 14:26:57 +0000"  >&lt;p&gt;Dongyang&lt;/p&gt;

&lt;p&gt;Seems related to &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11557&quot; title=&quot;Implement renameat2() with RENAME_EXCHANGE and RENAME_WHITEOUT&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11557&quot;&gt;LU-11557&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="53690">LU-11557</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|i00fyn:</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>