<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:04:32 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-13823] Two hard links to the same directory</title>
                <link>https://jira.whamcloud.com/browse/LU-13823</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;2 directories in the same filesystem have the same inode&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;[root@rzslic5]==&amp;gt; ls -lid /p/czlustre2/reza2/5_star_pattern_J
288233885643309090 drwx------ 3 58904 58904 33280 Jul 24 15:55 /p/czlustre2/reza2/5_star_pattern_J
[root@rzslic5]==&amp;gt; ls -lid /p/czlustre2/reza2/5_star_pattern_J_2/
288233885643309090 drwx------ 3 58904 58904 33280 Jul 24 15:55 /p/czlustre2/reza2/5_star_pattern_J_2/
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;the same FID&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;[root@rzslic2:reza2]# lfs path2fid 5_star_pattern_J
[0x40003311e:0x22:0x0]
[root@rzslic2:reza2]# lfs path2fid 5_star_pattern_J_2
[0x40003311e:0x22:0x0] &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The directory has one subdirectory:&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;[root@oslic7:reza2]# ls -al 5_star_pattern_J
total 130
drwx------   3 pearce7 pearce7 33280 Jul 24 15:55 .
drwx------ 155 reza2   reza2   57856 Jul 27 12:54 ..
drwx------   2 pearce7 pearce7 41472 Sep 21  2019 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>kernel-3.10.0-1127.0.0.1chaos.ch6.x86_64&lt;br/&gt;
zfs-0.7.11-9.4llnl.ch6.x86_64&lt;br/&gt;
lustre-2.10.8_9.chaos-1.ch6.x86_64</environment>
        <key id="60143">LU-13823</key>
            <summary>Two hard links to the same directory</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="5">Cannot Reproduce</resolution>
                                        <assignee username="adilger">Andreas Dilger</assignee>
                                    <reporter username="ofaaland">Olaf Faaland</reporter>
                        <labels>
                            <label>llnl</label>
                    </labels>
                <created>Mon, 27 Jul 2020 17:33:17 +0000</created>
                <updated>Fri, 3 Feb 2023 21:56:36 +0000</updated>
                            <resolved>Fri, 3 Feb 2023 21:56:36 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="276153" author="ofaaland" created="Mon, 27 Jul 2020 17:34:34 +0000"  >&lt;p&gt;Perhaps the underlying cause of &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13758&quot; title=&quot;corrupt directory entry: FID is invalid&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13758&quot;&gt;&lt;del&gt;LU-13758&lt;/del&gt;&lt;/a&gt; ?&lt;/p&gt;</comment>
                            <comment id="276154" author="ofaaland" created="Mon, 27 Jul 2020 17:34:58 +0000"  >&lt;p&gt;stat shows:&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;[root@rzslic2:reza2]# stat 5_star_pattern_J
&#160; File: &apos;5_star_pattern_J&apos;
&#160; Size: 33280 &#160; &#160; 	Blocks: 65 &#160; &#160; &#160; &#160; IO Block: 131072 directory
Device: a2f6a642h/2734073410d	Inode: 288233885643309090&#160; Links: 3
Access: (0700/drwx------)&#160; Uid: (58904/ UNKNOWN) &#160; Gid: (58904/ UNKNOWN)
Access: 2020-07-27 10:08:25.000000000 -0700
Modify: 2020-07-24 15:55:46.000000000 -0700
Change: 2020-07-24 15:55:46.000000000 -0700
 Birth: - &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="276160" author="ofaaland" created="Mon, 27 Jul 2020 18:40:09 +0000"  >&lt;p&gt;The underlying object was created in September 2019:&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;[root@zinc9:~]# zdb -dddddddd zinc9/mdt1@toss-4847 117510086
Dataset zinc9/mdt1@toss-4847 [ZPL], ID 529, cr_txg 184688294, 162G, 57992145 objects, rootbp DVA[0]=&amp;lt;1:1fd6afb000:1000&amp;gt; DVA[1]=&amp;lt;2:3b680fe000:1000&amp;gt; [L0 DMU objset] fletcher4 uncompressed LE contiguous unique double size=800L/800P birth=184688294L/184688294P fill=57992145 cksum=c37b11463:e9a37744f6d:b651035441589:6a1e4605d58ac95


&#160; &#160; Object&#160; lvl &#160; iblk &#160; dblk&#160; dsize&#160; dnsize&#160; lsize &#160; %full&#160; type
 117510086&#160; &#160; 2 &#160; 128K&#160; &#160; 16K&#160; &#160; 32K &#160; &#160; 512&#160; &#160; 32K&#160; 100.00&#160; ZFS directory (K=inherit) (Z=inherit)
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 192 &#160; bonus&#160; System attributes
	dnode flags: USED_BYTES USERUSED_ACCOUNTED USEROBJUSED_ACCOUNTED SPILL_BLKPTR
	dnode maxblkid: 1
	path	???&amp;lt;object#117510086&amp;gt;
	uid &#160; &#160; 58904
	gid &#160; &#160; 58904
	atime	Mon Jul 27 10:08:25 2020
	mtime	Fri Jul 24 15:55:46 2020
	ctime	Fri Jul 24 15:55:46 2020
	crtime	Fri Sep 20 19:23:47 2019
	gen	95807852
	mode	40700
	size	2
	parent	8807988
	links	3
	pflags	0
	rdev	0x0000000000000000
	SA xattrs: 212 bytes, 3 entries


		trusted.lma = \000\000\000\000\000\000\000\000\0361\003\000\004\000\000\000&quot;\000\000\000\000\000\000\000
		trusted.version = Y4\3243(\000\000\000
		trusted.link = \337\361\352\021\001\000\000\000&amp;lt;\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000$\000\000\000\002\200\005`H\000\000\000\007\000\000\000\0005_star_pattern_J_2
 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="276169" author="adilger" created="Mon, 27 Jul 2020 20:20:46 +0000"  >&lt;p&gt;Note that birth time will be directly accessible on Lustre 2.14 clients with a suitably new (maybe RHEL8?) &lt;tt&gt;stat&lt;/tt&gt; command that uses &lt;tt&gt;statx()&lt;/tt&gt; under the covers.&lt;/p&gt;

&lt;p&gt;Is it possible to ask the user how these two directories were created?  Was there a rename, or they were possibly created in parallel?  Was &quot;&lt;tt&gt;lfs migrate -m&lt;/tt&gt;&quot; used on the directory to migrate between MDTs?&lt;/p&gt;

&lt;p&gt;The &quot;&lt;tt&gt;trusted.link&lt;/tt&gt;&quot; xattr shows only &quot;&lt;tt&gt;5_star_pattern_J_2&lt;/tt&gt;&quot; for the name of the directory.&lt;/p&gt;

&lt;p&gt;The dnode shows &quot;&lt;tt&gt;links 3&lt;/tt&gt;&quot;, but that could be because of a subdirectory, and not necessarily because of multiple hard links to the file, but it would be useful to check.  If the client had (somehow) allowed multiple hard links to the directory, it should also have added the filename to the &quot;&lt;tt&gt;trusted.link&lt;/tt&gt;&quot; xattr at that time.&lt;/p&gt;

&lt;p&gt;Have you tried creating hard links to a directory with ZFS?  This &lt;em&gt;should&lt;/em&gt; be caught by the client VFS, and also by ldiskfs, but I&apos;m wondering if maybe ldiskfs implements such a check, but ZFS does this in the ZPL and that is not checked by &lt;tt&gt;osd-zfs&lt;/tt&gt;?&lt;/p&gt;

&lt;p&gt;I ran a quick test on ldiskfs, and I was surprised to see that a hard-link RPC is sent to the MDS in such a case when the &quot;&lt;tt&gt;ln&lt;/tt&gt;&quot; binary is &lt;b&gt;not&lt;/b&gt; used.  The &lt;tt&gt;ln&lt;/tt&gt; binary &lt;tt&gt;stat()}}s the source and target names itself to see if they exist and the file type before even calling the {{link()&lt;/tt&gt; syscall:&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;stat(&quot;/mnt/testfs/link&quot;, 0x7ffee35aa3c0) = -1 ENOENT (No such file or directory)
lstat(&quot;/mnt/testfs/newdir&quot;, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
write(2, &quot;ln: /mnt/testfs/newdir: hard link not allowed for directory&quot;) = 61
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Running &lt;tt&gt;multiop&lt;/tt&gt; (from the &lt;tt&gt;lustre-tests&lt;/tt&gt; RPM) doesn&apos;t do any sanity checking before calling the &lt;tt&gt;link()&lt;/tt&gt; syscall:&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;mkdir /mnt/testfs/newdir
strace multiop /mnt/testfs/newdir L /mnt/testfs/link

link(&quot;/mnt/testfs2/newerdir&quot;, &quot;/mnt/testfs2/link3&quot;) = -1 EPERM (Operation not permitted)
write(3, &quot;link(): Operation not permitted\n&quot;, 32
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and this generates an RPC to the MDS, so it seems possible if some user binary was calling &lt;tt&gt;link(3)&lt;/tt&gt; itself instead of &lt;tt&gt;ln(1)&lt;/tt&gt; it might trigger this itself?&lt;/p&gt;</comment>
                            <comment id="276178" author="ofaaland" created="Tue, 28 Jul 2020 00:27:37 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Is it possible to ask the user how these two directories were created?  Was there a rename, or they were possibly created in parallel?  Was &quot;&lt;tt&gt;lfs migrate -m&lt;/tt&gt;&quot; used on the directory to migrate between MDTs?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&apos;m working on getting that information.  There&apos;s been a complex chain of ownership so we&apos;re working through it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &quot;&lt;tt&gt;trusted.link&lt;/tt&gt;&quot; xattr shows only &quot;&lt;tt&gt;5_star_pattern_J_2&lt;/tt&gt;&quot; for the name of the directory.&lt;/p&gt;

&lt;p&gt;The dnode shows &quot;&lt;tt&gt;links 3&lt;/tt&gt;&quot;, but that could be because of a subdirectory, and not necessarily because of multiple hard links to the file, but it would be useful to check.  If the client had (somehow) allowed multiple hard links to the directory, it should also have added the filename to the &quot;&lt;tt&gt;trusted.link&lt;/tt&gt;&quot; xattr at that time.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;There is one subdirectory, named &quot;0&quot;.  Sorry I left that out of the description.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Have you tried creating hard links to a directory with ZFS?  This &lt;em&gt;should&lt;/em&gt; be caught by the client VFS, and also by ldiskfs, but I&apos;m wondering if maybe ldiskfs implements such a check, but ZFS does this in the ZPL and that is not checked by &lt;tt&gt;osd-zfs&lt;/tt&gt;?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I haven&apos;t yet figured out where it&apos;s checked, but neither ZPL nor our lustre 2.10.8 backed by ZFS 0.7 allowed hard linking to a directory via link(3) when I tried it.  In both cases link() failed and errno was set to EPERM, as you saw with your test.  But there was nothing exciting going on while I tried that, like many processes in parallel, or a failover, etc.&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;bash-4.2$ ll -d existing newlink
ls: cannot access newlink: No such file or directory
drwx------ 2 faaland1 faaland1 33280 Jul 27 16:50 existing

bash-4.2$ strace -e link ./dolink existing newlink;
link(&quot;existing&quot;, &quot;newlink&quot;)             = -1 EPERM (Operation not permitted)
+++ exited with 255 +++
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;and this generates an RPC to the MDS, so&lt;br/&gt;
it seems possible if some user binary was calling &lt;tt&gt;link(3)&lt;/tt&gt; itself instead of &lt;tt&gt;ln(1)&lt;/tt&gt; it might trigger this itself?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Yes, maybe.  I hope we&apos;re able to find out how these directories were created.&lt;/p&gt;</comment>
                            <comment id="278090" author="ofaaland" created="Wed, 26 Aug 2020 00:18:02 +0000"  >&lt;p&gt;Andreas,&lt;/p&gt;

&lt;p&gt;We weren&apos;t able to get any good information about what led up to this.&#160; We believe it occurred during the &quot;mv&quot; operation below (this is bash history from a node the sysadmin was using)&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;40 cd /p/czlustre3/pearce7
41 ls
42 cd reza2
43 ls
44 ls /p/czlustre3/reza2/
45 pwd
46 mv * /p/czlustre3/reza2/&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and that before the &quot;mv&quot; command&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;b&gt;/p/czlustre3/reza2/&lt;/b&gt; was empty, and&lt;/li&gt;
	&lt;li&gt;&lt;b&gt;/p/czlustre3/pearce7/reza2/5_star_pattern_J&lt;/b&gt; was an apparently normal directory.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;During the &quot;mv&quot; command the sysadmin got an error message that &lt;b&gt;5_star_pattern_J&lt;/b&gt; already existed in the target. At that point he looked and saw that both the source and target directory had a subdirectory by that name, and then found they were two references to the same directory.&lt;/p&gt;

&lt;p&gt;It&apos;s hard to see how this sequence of events could create the problem, but that&apos;s unfortunately all we were able to find out.&lt;/p&gt;</comment>
                            <comment id="278473" author="ofaaland" created="Tue, 1 Sep 2020 06:41:27 +0000"  >&lt;p&gt;Andreas,&lt;/p&gt;

&lt;p&gt;I just noticed that the bash_history contents I pasted in above are for the wrong file system (/p/czlustre3 AKA /p/lustre3, != /p/lustre2).  It&apos;s typical that our users have quota and a directory on multiple Lustre file systems.&lt;/p&gt;

&lt;p&gt;So we have no context at all.  I don&apos;t see what else we can do.  If you can think of anything else we should look at, or a debug patch that would be helpful, let me know.&lt;/p&gt;

&lt;p&gt;thanks&lt;/p&gt;</comment>
                            <comment id="288493" author="ofaaland" created="Wed, 30 Dec 2020 01:25:41 +0000"  >&lt;p&gt;Removing &quot;topllnl&quot; tag because I do not see any way for us to get more information about what happened.  I&apos;m going to leave it open in case we see the same problem again, or someone else does.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="59862">LU-13758</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|i0168v:</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>