<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:28:19 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-16589] sanityn test_55d: FAIL: (2) mv succeeded</title>
                <link>https://jira.whamcloud.com/browse/LU-16589</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;This issue was created by maloo for jianyu &amp;lt;yujian@whamcloud.com&amp;gt;&lt;/p&gt;

&lt;p&gt;This issue relates to the following test suite run: &lt;a href=&quot;https://testing.whamcloud.com/test_sets/5fae0359-520f-440f-9515-09d401c4ae9c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://testing.whamcloud.com/test_sets/5fae0359-520f-440f-9515-09d401c4ae9c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;test_55d failed with the following error:&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;== sanityn test 55d: rename file vs link ================= 17:25:02 (1677173102)
CMD: onyx-65vm4 /usr/sbin/lctl set_param fail_loc=0x155
fail_loc=0x155
ln: failed to create hard link &apos;/mnt/lustre2/d55d.sanityn/d55d.sanityn/&apos; =&amp;gt; &apos;/mnt/lustre2/d55d.sanityn/f1&apos;: No such file or directory
 sanityn test_55d: @@@@@@ FAIL: (2) mv succeeded
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Test session details:&lt;br/&gt;
clients: &lt;a href=&quot;https://build.whamcloud.com/job/lustre-master/4392&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://build.whamcloud.com/job/lustre-master/4392&lt;/a&gt; - 5.14.21-150400.24.28-default&lt;br/&gt;
servers: &lt;a href=&quot;https://build.whamcloud.com/job/lustre-master/4392&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://build.whamcloud.com/job/lustre-master/4392&lt;/a&gt; - 4.18.0-425.10.1.el8_lustre.x86_64&lt;/p&gt;

&lt;p&gt;&amp;lt;&amp;lt;Please provide additional information about the failure here&amp;gt;&amp;gt;&lt;/p&gt;







&lt;p&gt;VVVVVVV DO NOT REMOVE LINES BELOW, Added by Maloo for auto-association VVVVVVV&lt;br/&gt;
sanityn test_55d - (2) mv succeeded&lt;/p&gt;</description>
                <environment></environment>
        <key id="74811">LU-16589</key>
            <summary>sanityn test_55d: FAIL: (2) mv succeeded</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="yujian">Jian Yu</assignee>
                                    <reporter username="maloo">Maloo</reporter>
                        <labels>
                    </labels>
                <created>Fri, 24 Feb 2023 00:19:45 +0000</created>
                <updated>Wed, 19 Apr 2023 03:37:43 +0000</updated>
                            <resolved>Wed, 19 Apr 2023 03:37:43 +0000</resolved>
                                    <version>Lustre 2.16.0</version>
                    <version>Lustre 2.15.3</version>
                                    <fixVersion>Lustre 2.16.0</fixVersion>
                    <fixVersion>Lustre 2.15.3</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>11</watches>
                                                                            <comments>
                            <comment id="363987" author="yujian" created="Fri, 24 Feb 2023 00:21:53 +0000"  >&lt;p&gt;Besides SLES 15 SP4 client, the same failure also occurred on SLES 15 SP3, RHEL 9.0 and RHEL 9.1 clients on master branch.&lt;/p&gt;</comment>
                            <comment id="363988" author="yujian" created="Fri, 24 Feb 2023 00:23:34 +0000"  >&lt;p&gt;The ln command in coreutils-8.22 passed on RHEL 7.9 client and the strace outputs were:&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;1677185837.907658 stat(&quot;/mnt/lustre2/d55d.sanityn/d55d.sanityn/&quot;, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
1677185837.908877 lstat(&quot;/mnt/lustre2/d55d.sanityn/f1&quot;, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
1677185837.909992 linkat(AT_FDCWD, &quot;/mnt/lustre2/d55d.sanityn/f1&quot;, AT_FDCWD, &quot;/mnt/lustre2/d55d.sanityn/d55d.sanityn/f1&quot;, 0) = 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;While the ln command in coreutils-8.32 failed on SLES 15 SP4 client with strace outputs as follows:&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;1677175127.556014 linkat(AT_FDCWD, &quot;/mnt/lustre2/d55d.sanityn/f1&quot;, AT_FDCWD, &quot;/mnt/lustre2/d55d.sanityn/d55d.sanityn/&quot;, 0) = -1 ENOENT (No such file or directory)
1677175127.557279 newfstatat(AT_FDCWD, &quot;/mnt/lustre2/d55d.sanityn/f1&quot;, {st_mode=S_IFREG|0644, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
1677175127.558307 write(2, &quot;ln: &quot;, 4)   = 4
1677175127.558492 write(2, &quot;failed to create hard link &apos;/mnt&quot;..., 102) = 102
1677175127.558945 write(2, &quot;: No such file or directory&quot;, 27) = 27
1677175127.559092 write(2, &quot;\n&quot;, 1)     = 1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The stat() and lstat() operations were removed from ln by the following commit in coreutils-8.30:&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 571f63f5010b047a8a3250304053f05949faded4
Author:     Paul Eggert &amp;lt;eggert@cs.ucla.edu&amp;gt;
AuthorDate: Fri Oct 19 12:19:43 2018 -0700
Commit:     Paul Eggert &amp;lt;eggert@cs.ucla.edu&amp;gt;
CommitDate: Fri Oct 19 12:38:34 2018 -0700

    ln: avoid directory hard-link races
    
    Previously, &apos;ln A B&apos; did &apos;stat(&quot;B&quot;), lstat(&quot;A&quot;), link(&quot;A&quot;,&quot;B&quot;)&apos;
    where the stat and lstat were necessary to avoid hard-linking
    directories on systems that can hard-link directories.
    Now, in situations that prohibit hard links to directories,
    &apos;ln A B&apos; merely does &apos;link(&quot;A&quot;,&quot;B&quot;)&apos;.  The new behavior
    avoids some races and should be more efficient.
    This patch was inspired by Bug#10020, which was about &apos;ln&apos;.
    * bootstrap.conf (gnulib_modules): Add unlinkdir.
    * src/force-link.c (force_linkat, force_symlinkat): New arg for
    error number of previous try.  Return error number, 0, or -1 if
    error, success, or success after removal.  All callers changed.
    * src/ln.c: Include priv-set.h, unlinkdir.h.
    (beware_hard_dir_link): New static var.
    (errnoize, atomic_link): New functions.
    (target_directory_operand): Use errnoize for simplicity.
    (do_link): New arg for error number of previous try.  All callers
    changed.  Do each link atomically if possible.
    (main): Do -r check earlier.  Remove linkdir privileges so we can
    use a single linkat/symlinkat instead of a racy substitute for the
    common case of &apos;ln A B&apos; and &apos;ln -s A B&apos;.  Set beware_hard_dir_link
    to disable this optimization.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I&apos;m creating a patch to add ls command before running ln in sanityn/55d to trigger stat()/statx().&lt;/p&gt;</comment>
                            <comment id="363994" author="gerrit" created="Fri, 24 Feb 2023 01:31:29 +0000"  >&lt;p&gt;&quot;Jian Yu &amp;lt;yujian@whamcloud.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/50127&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50127&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16589&quot; title=&quot;sanityn test_55d: FAIL: (2) mv succeeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16589&quot;&gt;&lt;del&gt;LU-16589&lt;/del&gt;&lt;/a&gt; tests: fix dir hard-link failure in sanityn/55d&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 7f5977ab6e1a6f0c81ad74121350d2872da813e0&lt;/p&gt;</comment>
                            <comment id="364490" author="yujian" created="Wed, 1 Mar 2023 08:55:17 +0000"  >&lt;p&gt;I found without adding ls command before ln, just removing the trailing slash from &quot;$tdir/&quot; can also make the ln command succeed:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;sanityn/55d&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
        # link in reverse locking order
-       ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir/
+       ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;$DIR2/$tdir/$tdir/f1 was created as a hard link to file $DIR2/$tdir/f1.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="364721" author="yujian" created="Thu, 2 Mar 2023 16:45:29 +0000"  >&lt;p&gt;The failure can be simply reproduced as follows:&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;# touch /mnt/lustre/tfile
# mkdir /mnt/lustre/tdir

# ln /mnt/lustre/tfile /mnt/lustre/tdir/
ln: failed to create hard link &apos;/mnt/lustre/tdir/&apos; =&amp;gt; &apos;/mnt/lustre/tfile&apos;: No such file or directory

# ln /mnt/lustre/tfile /mnt/lustre/tdir
# ls /mnt/lustre/tdir
tfile
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The strace outputs of &quot;ln /mnt/lustre/tfile /mnt/lustre/tdir/&quot; (with a trailing slash) are:&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;1677747428.112785 linkat(AT_FDCWD, &quot;/mnt/lustre/tfile&quot;, AT_FDCWD, &quot;/mnt/lustre/tdir/&quot;, 0) = -1 ENOENT (No such file or directory)
1677747428.113910 newfstatat(AT_FDCWD, &quot;/mnt/lustre/tfile&quot;, {st_mode=S_IFREG|0644, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
&amp;lt;~snip~&amp;gt;
1677747428.116781 write(2, &quot;ln: &quot;, 4)   = 4
1677747428.116922 write(2, &quot;failed to create hard link &apos;/mnt&quot;..., 69) = 69
&amp;lt;~snip~&amp;gt;
1677747428.117833 write(2, &quot;: No such file or directory&quot;, 27) = 27
1677747428.117941 write(2, &quot;\n&quot;, 1)     = 1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The strace outputs of &quot;ln /mnt/lustre/tfile /mnt/lustre/tdir&quot; (without a trailing slash) are:&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;1677747364.665989 linkat(AT_FDCWD, &quot;/mnt/lustre/tfile&quot;, AT_FDCWD, &quot;/mnt/lustre/tdir&quot;, 0) = -1 EEXIST (File exists)
1677747364.668271 openat(AT_FDCWD, &quot;/mnt/lustre/tdir&quot;, O_RDONLY|O_PATH|O_DIRECTORY) = 3
1677747364.670377 linkat(AT_FDCWD, &quot;/mnt/lustre/tfile&quot;, 3, &quot;tfile&quot;, 0) = 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="364740" author="adilger" created="Thu, 2 Mar 2023 18:15:02 +0000"  >&lt;p&gt;The difference in behavior of &quot;&lt;tt&gt;ln&lt;/tt&gt;&quot; and the success/failure of the test appears to boil down to the return code of &lt;tt&gt;linkat()&lt;/tt&gt; with/without the trailing &quot;&lt;tt&gt;/&lt;/tt&gt;&quot;.&lt;/p&gt;

&lt;p&gt;So this looks like a dcache lookup issue in Lustre, or possibly something slightly with how &lt;tt&gt;linkat()&lt;/tt&gt; is being handled by the kernel or Lustre (e.g. returning &quot;&lt;tt&gt;-ENOENT&lt;/tt&gt;&quot; instead of &quot;&lt;tt&gt;-EEXIST&lt;/tt&gt;&quot;)?  The presence of the trailing &quot;&lt;tt&gt;/&lt;/tt&gt;&quot; &lt;em&gt;shouldn&apos;t&lt;/em&gt; make any difference to the kernel (AFAIK it should strip out &quot;&lt;tt&gt;/&lt;/tt&gt;&quot; during lookup?) but possibly something strange happening during path processing.&lt;/p&gt;

&lt;p&gt;Jian, could you please capture the Lustre kernel &lt;tt&gt;debug=all&lt;/tt&gt; logs for the two test cases, and check how the two &lt;tt&gt;linkat()&lt;/tt&gt; calls are different in Lustre.  Probably only the time from the start to the end of the &lt;tt&gt;linkat()&lt;/tt&gt; syscall is interesting, and where &lt;tt&gt;ENOENT&lt;/tt&gt; vs. &lt;tt&gt;EEXIST&lt;/tt&gt; are being generated.&lt;/p&gt;</comment>
                            <comment id="364744" author="yujian" created="Thu, 2 Mar 2023 18:30:47 +0000"  >&lt;p&gt;Sure, Andreas. I have gathered the full debug logs and been looking at them.&lt;/p&gt;</comment>
                            <comment id="364769" author="yujian" created="Thu, 2 Mar 2023 22:22:17 +0000"  >&lt;p&gt;In Lustre debug logs, with the trailing &quot;&lt;tt&gt;/&lt;/tt&gt;&quot;, there was no &quot;&lt;tt&gt;-ENOENT&lt;/tt&gt;&quot; error. &lt;tt&gt;ll_link()&lt;/tt&gt; from client and &lt;tt&gt;mdt_reint_link()&lt;/tt&gt; from MDS were not called.&lt;br/&gt;
Without the trailing &quot;&lt;tt&gt;/&lt;/tt&gt;&quot;, &lt;tt&gt;ll_link()&lt;/tt&gt; was called from client, and &lt;tt&gt;mdt_reint_link()&lt;/tt&gt; on MDS returned &quot;&lt;tt&gt;-EEXIST&lt;/tt&gt;&quot;:&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;00000004:00000040:0.0:1677747185.111782:0:22177:0:(mdt_reint.c:1456:mdt_reint_link()) link target tdir existed!
00000004:00000001:0.0:1677747185.111783:0:22177:0:(mdt_reint.c:1457:mdt_reint_link()) Process leaving via unlock_source (rc=18446744073709551599 : -17 : 0xffffffffffffffef)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I&apos;m looking into &lt;tt&gt;linkat()&lt;/tt&gt; to see where &quot;&lt;tt&gt;ENOENT&lt;/tt&gt;&quot; is generated.&lt;br/&gt;
&#160;&lt;/p&gt;</comment>
                            <comment id="364789" author="yujian" created="Fri, 3 Mar 2023 07:13:56 +0000"  >&lt;p&gt;In &lt;tt&gt;linkat()&amp;#45;&amp;gt;__file_name_split_at()-&amp;gt;&amp;#95;_hurd_file_name_split()&lt;/tt&gt;:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;__hurd_file_name_split()&lt;/b&gt;&lt;/div&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;const&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *lastslash = strrchr (file_name, &lt;span class=&quot;code-quote&quot;&gt;&apos;/&apos;&lt;/span&gt;);

  &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (lastslash != NULL)
    {
      &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (lastslash == file_name)
        {
          &lt;span class=&quot;code-comment&quot;&gt;/* &lt;span class=&quot;code-quote&quot;&gt;&quot;/foobar&quot;&lt;/span&gt; =&amp;gt; crdir + &lt;span class=&quot;code-quote&quot;&gt;&quot;foobar&quot;&lt;/span&gt;.  */&lt;/span&gt;
          *name = (&lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *) file_name + 1;
          &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; (*use_init_port) (INIT_PORT_CRDIR, &amp;amp;addref);
        }
      &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
        {
          &lt;span class=&quot;code-comment&quot;&gt;/* &lt;span class=&quot;code-quote&quot;&gt;&quot;/dir1/dir2/.../file&quot;&lt;/span&gt;.  */&lt;/span&gt;
          &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; dirname[lastslash - file_name + 1];
          memcpy (dirname, file_name, lastslash - file_name);
          dirname[lastslash - file_name] = &lt;span class=&quot;code-quote&quot;&gt;&apos;\0&apos;&lt;/span&gt;;
          *name = (&lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *) lastslash + 1;
          &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt;
            __hurd_file_name_lookup (use_init_port, get_dtable_port, lookup,
                                     dirname, 0, 0, dir);
        }
    }
  &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (file_name[0] == &lt;span class=&quot;code-quote&quot;&gt;&apos;\0&apos;&lt;/span&gt;)
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; ENOENT;
  &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
    {
      &lt;span class=&quot;code-comment&quot;&gt;/* &lt;span class=&quot;code-quote&quot;&gt;&quot;foobar&quot;&lt;/span&gt; =&amp;gt; cwdir + &lt;span class=&quot;code-quote&quot;&gt;&quot;foobar&quot;&lt;/span&gt;.  */&lt;/span&gt;
      *name = (&lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *) file_name;
      &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; (*use_init_port) (INIT_PORT_CWDIR, &amp;amp;addref);
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And in &lt;tt&gt;__hurd_file_name_lookup&lt;/tt&gt;:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;__hurd_file_name_lookup()&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
      /* The caller wants to require that the file we look up is a directory.
         We can &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; without an extra RPC by appending a trailing slash
         to the file name we look up.  */
      size_t len = strlen (file_name);
      &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (len == 0) 
        file_name = &lt;span class=&quot;code-quote&quot;&gt;&quot;/&quot;&lt;/span&gt;;
      &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (file_name[len - 1] != &lt;span class=&quot;code-quote&quot;&gt;&apos;/&apos;&lt;/span&gt;)
        {
          &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *n = alloca (len + 2);
          memcpy (n, file_name, len);
          n[len] = &lt;span class=&quot;code-quote&quot;&gt;&apos;/&apos;&lt;/span&gt;;
          n[len + 1] = &lt;span class=&quot;code-quote&quot;&gt;&apos;\0&apos;&lt;/span&gt;;
          file_name = n;
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I haven&apos;t found out anything is wrong here.&lt;/p&gt;</comment>
                            <comment id="364805" author="laisiyao" created="Fri, 3 Mar 2023 09:56:27 +0000"  >&lt;p&gt;What&apos;s the result of this command on local filesystem? e.g. xfs?&lt;/p&gt;</comment>
                            <comment id="364841" author="yujian" created="Fri, 3 Mar 2023 16:39:51 +0000"  >&lt;blockquote&gt;&lt;p&gt;What&apos;s the result of this command on local filesystem? e.g. xfs?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;It works on local ext4 filesystem:&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;# df -T /root/
Filesystem     Type 1K-blocks    Used Available Use% Mounted on
/dev/vda2      ext4  20466256 5675620  13725676  30% /

# touch /root/tfile
# mkdir /root/tdir
# ln /root/tfile /root/tdir/
# ls /root/tdir/
tfile
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="365039" author="yujian" created="Tue, 7 Mar 2023 05:05:17 +0000"  >&lt;p&gt;It turned out the &lt;tt&gt;ENOENT&lt;/tt&gt; error was returned from kernel &lt;tt&gt;do_linkat()-&amp;gt;filename_create()&lt;/tt&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;# rm -rf /mnt/lustre/*
# touch /mnt/lustre/tfile
# mkdir /mnt/lustre/tdir

# trace-cmd record -g do_linkat -p function_graph ln /mnt/lustre/tfile /mnt/lustre/tdir/
  plugin &apos;function_graph&apos;
ln: failed to create hard link &apos;/mnt/lustre/tdir/&apos; =&amp;gt; &apos;/mnt/lustre/tfile&apos;: No such file or directory
CPU0 data recorded at offset=0x177000
    0 bytes in size (0 uncompressed)
CPU1 data recorded at offset=0x177000
    349 bytes in size (4096 uncompressed)

# trace-cmd report
cpus=2
              ln-31499 [001] 2019833.457879: funcgraph_entry:                   |  do_linkat() {
              ln-31499 [001] 2019833.457888: funcgraph_entry:        0.449 us   |    irq_enter_rcu();
              ln-31499 [001] 2019833.457889: funcgraph_entry:        8.943 us   |    __sysvec_irq_work();
              ln-31499 [001] 2019833.457898: funcgraph_entry:        0.368 us   |    irq_exit_rcu();
              ln-31499 [001] 2019833.457899: funcgraph_entry:      # 1459.949 us |    user_path_at_empty();
              ln-31499 [001] 2019833.459366: funcgraph_entry:        0.340 us   |    irq_enter_rcu();
              ln-31499 [001] 2019833.459366: funcgraph_entry:        0.834 us   |    __sysvec_irq_work();
              ln-31499 [001] 2019833.459367: funcgraph_entry:        0.304 us   |    irq_exit_rcu();
              ln-31499 [001] 2019833.459368: funcgraph_entry:        0.769 us   |    getname_flags();
              ln-31499 [001] 2019833.459369: funcgraph_entry:      ! 297.289 us |    filename_create();
              ln-31499 [001] 2019833.459667: funcgraph_entry:        4.795 us   |    dput();
              ln-31499 [001] 2019833.459672: funcgraph_entry:        0.343 us   |    mntput();
              ln-31499 [001] 2019833.459673: funcgraph_exit:       # 1794.900 us |  }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="365049" author="yujian" created="Tue, 7 Mar 2023 08:06:14 +0000"  >&lt;p&gt;By comparing the attached Ftrace outputs (with and without the trailing &quot;&lt;tt&gt;/&lt;/tt&gt;&quot;, &lt;tt&gt;&amp;#45;-max-graph-depth&lt;/tt&gt; is 6), and the source code of &lt;tt&gt;filename_create()&lt;/tt&gt; in kernel &lt;tt&gt;fs/namei.c&lt;/tt&gt;, we can see the &lt;tt&gt;ENOENT&lt;/tt&gt; error was returned as follows:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;fs/namei.c&lt;/b&gt;&lt;/div&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;static&lt;/span&gt; struct dentry *filename_create(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; dfd, struct filename *name,
                                struct path *path, unsigned &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lookup_flags)
{
        &lt;span class=&quot;code-comment&quot;&gt;// ......
&lt;/span&gt;        /*
         * Special &lt;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; - lookup gave negative, but... we had foo/bar/
         * From the vfs_mknod() POV we just have a negative dentry -
         * all is fine. Let&lt;span class=&quot;code-quote&quot;&gt;&apos;s be bastards - you had / on the end, you&apos;&lt;/span&gt;ve
         * been asking &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (non-existent) directory. -ENOENT &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; you.
         */
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (unlikely(!is_dir &amp;amp;&amp;amp; last.name[last.len])) {
                error = -ENOENT;
                &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; fail;
        }
        &lt;span class=&quot;code-comment&quot;&gt;// ......
&lt;/span&gt;}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt; &lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/attachment/48354/48354_ftrace.with_slash.depth_6.txt&quot; title=&quot;ftrace.with_slash.depth_6.txt attached to LU-16589&quot;&gt;ftrace.with_slash.depth_6.txt&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.whamcloud.com/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;  &lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/attachment/48355/48355_ftrace.without_slash.depth_6.txt&quot; title=&quot;ftrace.without_slash.depth_6.txt attached to LU-16589&quot;&gt;ftrace.without_slash.depth_6.txt&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.whamcloud.com/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt; &lt;/p&gt;</comment>
                            <comment id="365179" author="adilger" created="Wed, 8 Mar 2023 02:27:47 +0000"  >&lt;p&gt;Jian, looking at what test_55d is doing, it is unclear why the &lt;tt&gt;linkat()-&amp;gt;filename_create()&lt;/tt&gt; operation is returning &lt;tt&gt;-ENOENT&lt;/tt&gt;?  The directory &lt;b&gt;does&lt;/b&gt; exist, since it was created with &lt;tt&gt;mkdir&lt;/tt&gt; on the previous line, so &lt;em&gt;either&lt;/em&gt; the &lt;tt&gt;mkdir $DIR/$tdir/$tdir&lt;/tt&gt; operation should have instantiated this directory into dcache, or the &lt;tt&gt;linkat()&lt;/tt&gt; syscall &lt;b&gt;should&lt;/b&gt; have looked up the second &lt;tt&gt;$tdir&lt;/tt&gt; component during traversal.&lt;/p&gt;

&lt;p&gt;It would be interesting to see what the test does with &quot;&lt;tt&gt;ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir/f1&lt;/tt&gt;&quot; (i.e. with the target filename specified)?  That is really what the &quot;&lt;tt&gt;ln&lt;/tt&gt;&quot; command is trying to do - link &lt;tt&gt;f1&lt;/tt&gt; into the second &lt;tt&gt;$tdir&lt;/tt&gt; directory so that the delayed &lt;tt&gt;mv $DIR2/$tdir/f1 $DIR2/$tdir/$tdir&lt;/tt&gt; that was trying to create a &lt;b&gt;file&lt;/b&gt; named &lt;tt&gt;$tdir&lt;/tt&gt; cannot succeed when there is later a &lt;b&gt;directory&lt;/b&gt; named &lt;tt&gt;$tdir&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Even if that allows the test to pass (which would be slightly better than the &quot;pre-stat&quot;), there is still a dcache bug in there somewhere, because the kernel lookup of the second &lt;tt&gt;$tdir/&lt;/tt&gt; should not have failed.&lt;/p&gt;

&lt;p&gt;What else is interesting is that newer kernels (since v5.18-rc2-188-gb3d4650d82c7) have slightly different code here:&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;static&lt;/span&gt; struct dentry *filename_create(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; dfd, struct filename *name,
                                      struct path *path, unsigned &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lookup_flags)
{
        unsigned &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; create_flags = LOOKUP_CREATE | LOOKUP_EXCL;
        :
        :
        /*
         * Special &lt;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; - lookup gave negative, but... we had foo/bar/
         * From the vfs_mknod() POV we just have a negative dentry -
         * all is fine. Let&lt;span class=&quot;code-quote&quot;&gt;&apos;s be bastards - you had / on the end, you&apos;&lt;/span&gt;ve
         * been asking &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (non-existent) directory. -ENOENT &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; you.
         */
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (unlikely(!create_flags)) {
                error = -ENOENT;
                &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; fail;
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;so it would be interesting to know what &lt;tt&gt;create_flags&lt;/tt&gt; are being passed from Lustre?&lt;/p&gt;

&lt;p&gt;It just happens that the commit v5.18-rc2-188-gb3d4650d82c7 that changed this code was written by Neil Brown, whom I&apos;ve CC&apos;d here in case he has some insight into what is going wrong here.  It definitely seems from the commit message that this is a similar situation being hit in Lustre as was previously hit by NFS:&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;    VFS: filename_create(): fix incorrect intent.
    
    When asked to create a path ending &apos;/&apos;, but which is not to be a
    directory (LOOKUP_DIRECTORY not set), filename_create() will never try
    to create the file.  If it doesn&apos;t exist, -ENOENT is reported.
    
    However, it still passes LOOKUP_CREATE|LOOKUP_EXCL to the filesystems
    -&amp;gt;lookup() function, even though there is no intent to create.  This is
    misleading and can cause incorrect behaviour.
    
    If you try
    
       ln -s foo /path/dir/
    
    where &apos;dir&apos; is a directory on an NFS filesystem which is not currently
    known in the dcache, this will fail with ENOENT.
    
    But as the name is not in the dcache, nfs_lookup gets called with
    LOOKUP_CREATE|LOOKUP_EXCL and so it returns NULL without performing any
    lookup, with the expectation that a subsequent call to create the target
    will be made, and the lookup can be combined with the creation.  In the
    case with a trailing &apos;/&apos; and no LOOKUP_DIRECTORY, that call is never
    made.  Instead filename_create() sees that the dentry is not (yet)
    positive and returns -ENOENT - even though the directory actually
    exists.
    
    So only set LOOKUP_CREATE|LOOKUP_EXCL if there really is an intent to
    create, and use the absence of these flags to decide if -ENOENT should
    be returned.
    
    Note that filename_parentat() is only interested in LOOKUP_REVAL, so we
    split that out and store it in &apos;reval_flag&apos;.  __lookup_hash() then gets
    reval_flag combined with whatever create flags were determined to be
    needed.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It isn&apos;t clear whether we can add a workaround in the Lustre &lt;tt&gt;-&amp;gt;lookup()&lt;/tt&gt; method to handle this case or only fix the test (to add the &lt;tt&gt;/f1&lt;/tt&gt; component at the end) and get the client distros to apply Neil&apos;s patch.  It looks like both SLES15sp4 and RHEL9.x are using a 5.14-based kernel, and are missing the v5.18-rc2-188-gb3d4650d82c7 patch, or we are somehow not handling the &lt;tt&gt;LOOKUP_&amp;#42;&lt;/tt&gt; flags properly in Lustre.  The changed code may have been affected by v5.14-rc7-68-g0ee50b47532a &quot;&lt;tt&gt;namei: change filename_parentat() calling conventions&lt;/tt&gt;&quot;, so it is possible we didn&apos;t update to those new conventions?&lt;/p&gt;</comment>
                            <comment id="365204" author="neilb" created="Wed, 8 Mar 2023 04:18:03 +0000"  >&lt;p&gt;Hi Andreas,&lt;/p&gt;

&lt;p&gt;&#160;I think it likely that you have identified the problem.&#160; Especially if it is possible that the &quot;rename&quot; happening in the background might have called d_lustre_invalidate() on the original dentry.&lt;/p&gt;

&lt;p&gt;I think it unlikely that the filename_parentat() change is relevant.&#160; That is an internal api in namei.c&lt;/p&gt;

&lt;p&gt;The only way I can think of to work around the problem in lustre is to skip the optimisation in ll_lookup_nd() for a CREATE that isn&apos;t an OPEN.&#160; You might be able to detect this particular case by seeing there is an invalid dentry still present.&#160; Maybe.&lt;/p&gt;

&lt;p&gt;I really should apply that patch to SP4.&#160; We have it in SP3.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="365211" author="yujian" created="Wed, 8 Mar 2023 06:08:23 +0000"  >&lt;p&gt;Thank you Andreas and Neil for the detailed analysis.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;It would be interesting to see what the test does with &quot;ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir/f1&quot; (i.e. with the target filename specified)?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Test passed on SLES 15 SP4 client (with kernel 5.14.21-150400.24.28-default):&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;== sanityn test 55d: rename file vs link ============================================================= 05:52:19 (1678254739)
CMD: trevis-86vm8 /usr/sbin/lctl set_param fail_loc=0x155
fail_loc=0x155
mv: &apos;/mnt/lustre/d55d.sanityn/f1&apos; and &apos;/mnt/lustre/d55d.sanityn/d55d.sanityn/f1&apos; are the same file
Resetting fail_loc on all nodes...CMD: trevis-86vm7.trevis.whamcloud.com,trevis-86vm8,trevis-87vm7 lctl set_param -n fail_loc=0             fail_val=0 2&amp;gt;/dev/null
done.
CMD: trevis-86vm7.trevis.whamcloud.com /usr/sbin/lctl get_param catastrophe 2&amp;gt;&amp;amp;1
CMD: trevis-86vm8 /usr/sbin/lctl get_param catastrophe 2&amp;gt;&amp;amp;1
CMD: trevis-87vm7 /usr/sbin/lctl get_param catastrophe 2&amp;gt;&amp;amp;1
CMD: trevis-86vm7.trevis.whamcloud.com,trevis-86vm8,trevis-87vm7 dmesg
PASS 55d (9s)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="365212" author="yujian" created="Wed, 8 Mar 2023 06:20:28 +0000"  >&lt;blockquote&gt;&lt;p&gt;The only way I can think of to work around the problem in lustre is to skip the optimization in ll_lookup_nd() for a CREATE that isn&apos;t an OPEN. &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The optimization was added by &lt;a href=&quot;https://review.whamcloud.com/8257&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/8257&lt;/a&gt; (&quot;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-4185&quot; title=&quot;Incorrect permission handling when creating existing directories at ICHEC&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-4185&quot;&gt;&lt;del&gt;LU-4185&lt;/del&gt;&lt;/a&gt; llite: Revise create with no open optimization&quot;):&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 a2d5b2e83c0a512a3ea59698e8481621ab5856c2
Author:     Bobi Jam &amp;lt;bobijam@whamcloud.com&amp;gt;
AuthorDate: Wed Nov 13 15:56:25 2013 +0800
Commit:     Oleg Drokin &amp;lt;green@whamcloud.com&amp;gt;
CommitDate: Wed Oct 5 03:51:18 2016 +0000

    LU-4185 llite: Revise create with no open optimization
    
    Currently ll_lookup_nd just returns a negative when we are trying
    to create something with no open (read mkdir). This is all fine most
    of the cases, except if the directory where we are trying to do is
    not writeable by us. In that case vfs_create would return EPERM
    seeing as how a negative dentry means the create cannot proceed.
    But in reality if there is an existing name there that we just did
    not have cached, the proper return is EEXIST that could only happen
    if we did do the lookup.
    
    So amend the optimization to only take place if the directory is
    writeable by us, otherwise do the full lookup.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="365633" author="bobijam" created="Sun, 12 Mar 2023 16:41:10 +0000"  >&lt;p&gt;Would it work to change ll_lookup_nd() to skip the optimization if flags contains&#160;LOOKUP_CREATE | LOOKUP_EXCL and LOOKUP_CREATE + !LOOKUP_OPEN + !LOOKUP_EXCL still use the optimization?&lt;/p&gt;</comment>
                            <comment id="365636" author="adilger" created="Sun, 12 Mar 2023 21:02:52 +0000"  >&lt;p&gt;This workaround should go under an #ifdef so that the optimization is only disabled for kernels that are affected by it. It definitely is not needed for kernels newer than 5.18, but I&apos;m not totally sure what is the oldest version affected, or if there is a #define we can check that was introduced in the original patch. This is also complicated by vendor backports, so there may need to be both a vanilla kernel version check and a vendor version check.&#160;&lt;/p&gt;</comment>
                            <comment id="365641" author="neilb" created="Sun, 12 Mar 2023 22:25:30 +0000"  >&lt;p&gt;&amp;gt; Would it work to change ll_lookup_nd() to skip the optimization if flags contains LOOKUP_CREATE | LOOKUP_EXCL and LOOKUP_CREATE + !LOOKUP_OPEN + !LOOKUP_EXCL still use the optimization?&lt;/p&gt;

&lt;p&gt;I don&apos;t think -&amp;gt;lookup is ever called with LOOKUP_CREATE but not LOOKUP_EXCL.&#160; And if it is, it is every likely to include LOOKUP_OPEN.&#160; Most syscalls that create names give an error (EEXIST) if the name exists.&#160; The only exception is open(O_CREATE).&lt;/p&gt;

&lt;p&gt;Do we really need to fix this is lustre?&#160; It is clearly not a lustre bug.&#160; If we want test_55d to succeed more reliably we can just change the ln command to &quot;&lt;tt&gt;ln $DIR2/$tdir/f1 $DIR2/$tdir/$tdir/f1&lt;/tt&gt;&quot; as Andreas suggested.&#160; That performs exactly the same effective test, but avoids the kernel bug.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="365642" author="yujian" created="Mon, 13 Mar 2023 00:20:40 +0000"  >&lt;blockquote&gt;&lt;p&gt;I&apos;m not totally sure what is the oldest version affected&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Even on RHEL 7.9 (with kernel 3.10.0-1160), after changing &lt;tt&gt;ln&lt;/tt&gt; from version 8.22 to 8.32, the &quot;&lt;tt&gt;ln /mnt/lustre/tfile /mnt/lustre/tdir/&lt;/tt&gt;&quot; command also failed with &lt;tt&gt;-ENOENT&lt;/tt&gt;.&lt;br/&gt;
This means the kernel issue exists in all of the vendor kernels we support now.&lt;/p&gt;</comment>
                            <comment id="365643" author="adilger" created="Mon, 13 Mar 2023 01:58:59 +0000"  >&lt;p&gt;Jian, then it seems this bug has existed for so long and could even be considered an issue in the new coreutils? At least it is fixed in newer kernels, and it seems like a very uncommon use case, so it isn&apos;t clear that putting a ton of effort into fixing it in Lustre is worthwhile. Neil can work on backporting the fix to SLES15 (if needed), and James or someone can file a ticket to fix it in RHEL8/9.&lt;/p&gt;

&lt;p&gt;It seems the right thing for now is to fix the test (either add &quot;/f1&quot; at the end or remove the trailing &quot;/&quot;) so that it is executing the original intent of the patch that added it.&lt;/p&gt;

&lt;p&gt;A separate patch should be made with a new subtest for only this &quot;ln&quot; case. This new subtest should be skipped for new coreutils and old kernels:&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;
        local ln_ver=$(ln --version | awk &lt;span class=&quot;code-quote&quot;&gt;&apos;/coreutils/ { print $4 }&apos;&lt;/span&gt;)

        (( $(version_code $ln_ver) &amp;lt; $(version code 8.32) )) ||
        (( $(version_code $(uname -r)) &amp;gt;= $(version_code 5.18) )) ||
                skip &lt;span class=&quot;code-quote&quot;&gt;&quot;need coreutils &amp;lt; 8.32 or kernel &amp;gt;= 5.18 &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ln&quot;&lt;/span&gt;

        touch $DIR/$tfile || error &lt;span class=&quot;code-quote&quot;&gt;&quot;create failed&quot;&lt;/span&gt;
        mkdir $DIR/$tdir || error &lt;span class=&quot;code-quote&quot;&gt;&quot;mkdir failed&quot;&lt;/span&gt;
        ln $DIR/$tfile $DIR/tdir/ || error &lt;span class=&quot;code-quote&quot;&gt;&quot;ln to &lt;span class=&quot;code-quote&quot;&gt;&apos;$tdir/&apos;&lt;/span&gt; failed&quot;&lt;/span&gt;
        &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This will at least add test coverage for newer kernels and keep it for old coreutils, so that it doesn&apos;t regress in the future. &#160;Additional checks can be added to allow running the test when we know particular distro kernels are fixed.&#160;&lt;/p&gt;</comment>
                            <comment id="365649" author="yujian" created="Mon, 13 Mar 2023 03:53:30 +0000"  >&lt;p&gt;Sure, Andreas. I just updated &lt;a href=&quot;https://review.whamcloud.com/50127&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/50127&lt;/a&gt; to fix sanityn/55d. I&apos;m working on a separate patch to add a new subtest for &quot;&lt;tt&gt;ln&lt;/tt&gt;&quot;. BTW, I just found the actual version of coreutils that started containing the &quot;&lt;tt&gt;ln&lt;/tt&gt;&quot; change is 8.31.&lt;/p&gt;</comment>
                            <comment id="365650" author="gerrit" created="Mon, 13 Mar 2023 05:03:47 +0000"  >&lt;p&gt;&quot;Jian Yu &amp;lt;yujian@whamcloud.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/50265&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50265&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16589&quot; title=&quot;sanityn test_55d: FAIL: (2) mv succeeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16589&quot;&gt;&lt;del&gt;LU-16589&lt;/del&gt;&lt;/a&gt; tests: add sanity/31l to test ln command&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 8b6e20e63be8edc4fda22f2318fa8df350c7297b&lt;/p&gt;</comment>
                            <comment id="366585" author="gerrit" created="Tue, 21 Mar 2023 05:13:33 +0000"  >&lt;p&gt;&quot;Jian Yu &amp;lt;yujian@whamcloud.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/50348&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50348&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16589&quot; title=&quot;sanityn test_55d: FAIL: (2) mv succeeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16589&quot;&gt;&lt;del&gt;LU-16589&lt;/del&gt;&lt;/a&gt; tests: fix hard-link failure in sanityn/55d&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_15&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 5b3526d01808b0dd270ae0655918fa3b7fc4f941&lt;/p&gt;</comment>
                            <comment id="366766" author="gerrit" created="Tue, 21 Mar 2023 23:15:06 +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/c/fs/lustre-release/+/50127/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50127/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16589&quot; title=&quot;sanityn test_55d: FAIL: (2) mv succeeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16589&quot;&gt;&lt;del&gt;LU-16589&lt;/del&gt;&lt;/a&gt; tests: fix hard-link failure in sanityn/55d&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 25c6b7ad2859729197c3cc6e6dcf0621e4bda6fa&lt;/p&gt;</comment>
                            <comment id="367646" author="gerrit" created="Tue, 28 Mar 2023 22:19:17 +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/c/fs/lustre-release/+/50265/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50265/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16589&quot; title=&quot;sanityn test_55d: FAIL: (2) mv succeeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16589&quot;&gt;&lt;del&gt;LU-16589&lt;/del&gt;&lt;/a&gt; tests: add sanity/31l to test ln command&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: e998d21caf99e32495950219e88dd9e7f981363e&lt;/p&gt;</comment>
                            <comment id="369845" author="gerrit" created="Wed, 19 Apr 2023 03:32:56 +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/c/fs/lustre-release/+/50348/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50348/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16589&quot; title=&quot;sanityn test_55d: FAIL: (2) mv succeeded&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16589&quot;&gt;&lt;del&gt;LU-16589&lt;/del&gt;&lt;/a&gt; tests: fix hard-link failure in sanityn/55d&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_15&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: b01209416cb73e06d50a2bf00855e56fcc37ed02&lt;/p&gt;</comment>
                            <comment id="369847" author="pjones" created="Wed, 19 Apr 2023 03:37:43 +0000"  >&lt;p&gt;Landed for 2.16&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="23498">LU-4725</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="48354" name="ftrace.with_slash.depth_6.txt" size="23020" author="yujian" created="Tue, 7 Mar 2023 08:04:47 +0000"/>
                            <attachment id="48355" name="ftrace.without_slash.depth_6.txt" size="107125" author="yujian" created="Tue, 7 Mar 2023 08:05:51 +0000"/>
                    </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|i03ewn:</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>