<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:40: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-11053] problem with loop device associated with lustre file</title>
                <link>https://jira.whamcloud.com/browse/LU-11053</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;lustre&apos;s file open does not bring the file size info in-core inode. losetup avoids stat for the backing lustre file before LOOP_SET_FD:&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;open(&quot;/mnt/lustre/ext4image&quot;, O_RDWR)    = 3
open(&quot;/dev/loop0&quot;, O_RDWR)              = 4
ioctl(4, LOOP_SET_FD, 0x3)              = 0
stat(&quot;/mnt/lustre/ext4image&quot;...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;So losetup creates block device inode with zero size which eventually leads to failure on umounting the loop device at BUG_ON(!buffer_mapped(bh)) in submit_bh():&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;&amp;lt;2&amp;gt;kernel BUG at fs/buffer.c:3157!
&amp;lt;4&amp;gt;invalid opcode: 0000 [#1] SMP
&amp;lt;4&amp;gt;last sysfs file: /sys/devices/system/cpu/online
&amp;lt;4&amp;gt;CPU 37
...
&amp;lt;4&amp;gt;Pid: 6751, comm: umount Not tainted 2.6.32-696.18.7.el6.x86_64 #1 BULL bullx blade/CHPD
&amp;lt;4&amp;gt;RIP: 0010:[&amp;lt;ffffffff811d0962&amp;gt;]  [&amp;lt;ffffffff811d0962&amp;gt;] submit_bh+0x152/0x1f0
&amp;lt;4&amp;gt;RSP: 0018:ffff88107483bd68  EFLAGS: 00010246
&amp;lt;4&amp;gt;RAX: 0000000000000005 RBX: ffff88087c7fbd60 RCX: 0000000000000017
...
&amp;lt;4&amp;gt;Call Trace:
&amp;lt;4&amp;gt; [&amp;lt;ffffffff811d2973&amp;gt;] __sync_dirty_buffer+0x53/0xf0
&amp;lt;4&amp;gt; [&amp;lt;ffffffff811d2a23&amp;gt;] sync_dirty_buffer+0x13/0x20
&amp;lt;4&amp;gt; [&amp;lt;ffffffffa0d1877b&amp;gt;] ext2_sync_super+0x5b/0x70 [ext2]
&amp;lt;4&amp;gt; [&amp;lt;ffffffffa0d19733&amp;gt;] ext2_put_super+0x133/0x150 [ext2]
&amp;lt;4&amp;gt; [&amp;lt;ffffffff8119cc4b&amp;gt;] generic_shutdown_super+0x5b/0xe0
&amp;lt;4&amp;gt; [&amp;lt;ffffffff8119cd01&amp;gt;] kill_block_super+0x31/0x50
&amp;lt;4&amp;gt; [&amp;lt;ffffffff8119d4d7&amp;gt;] deactivate_super+0x57/0x80
&amp;lt;4&amp;gt; [&amp;lt;ffffffff811bd50f&amp;gt;] mntput_no_expire+0xbf/0x110
&amp;lt;4&amp;gt; [&amp;lt;ffffffff811be05b&amp;gt;] sys_umount+0x7b/0x3a0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The modification to sanity.sh:test_54c (from Andrew Perepechko) illustrates the problem.&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;diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index c6b292b029..d2961dbf0e 100755
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -4656,10 +4656,15 @@ test_54c() {
        mknod $loopdev b 7 $LOOPNUM
        echo &lt;span class=&quot;code-quote&quot;&gt;&quot;make a loop file system with $DIR/$tfile on $loopdev ($LOOPNUM).&quot;&lt;/span&gt;
        dd &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;=/dev/zero of=$DIR/$tfile bs=$(get_page_size client) seek=1024 count=1 &amp;gt; /dev/&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;
+       mkfs.ext2 $DIR/$tfile  || error &lt;span class=&quot;code-quote&quot;&gt;&quot;mke2fs on $DIR/$tfile &quot;&lt;/span&gt;
+       test_mkdir $DIR/$tdir
+
+       cancel_lru_locks mdc
+       cancel_lru_locks osc
+
        losetup $loopdev $DIR/$tfile ||
                error &lt;span class=&quot;code-quote&quot;&gt;&quot;can&apos;t set up $loopdev &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; $DIR/$tfile&quot;&lt;/span&gt;
-       mkfs.ext2 $loopdev || error &lt;span class=&quot;code-quote&quot;&gt;&quot;mke2fs on $loopdev&quot;&lt;/span&gt;
-       test_mkdir $DIR/$tdir
+
        mount -t ext2 $loopdev $DIR/$tdir ||
                error &lt;span class=&quot;code-quote&quot;&gt;&quot;error mounting $loopdev on $DIR/$tdir&quot;&lt;/span&gt;
        dd &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;=/dev/zero of=$DIR/$tdir/tmp bs=$(get_page_size client) count=30 ||
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="52382">LU-11053</key>
            <summary>problem with loop device associated with lustre file</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="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="vsaveliev">Vladimir Saveliev</assignee>
                                    <reporter username="vsaveliev">Vladimir Saveliev</reporter>
                        <labels>
                    </labels>
                <created>Thu, 24 May 2018 10:28:07 +0000</created>
                <updated>Mon, 27 May 2019 16:58:31 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="228672" author="gerrit" created="Sun, 27 May 2018 21:05:19 +0000"  >&lt;p&gt;Vladimir Saveliev (c17830@cray.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/32565&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/32565&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11053&quot; title=&quot;problem with loop device associated with lustre file&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11053&quot;&gt;LU-11053&lt;/a&gt; llite: get file size in ll_file_open()&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 0078cef4a222051b88fd240f961bf4acafda1a6c&lt;/p&gt;</comment>
                            <comment id="228756" author="gerrit" created="Tue, 29 May 2018 11:48:01 +0000"  >&lt;p&gt;Vladimir Saveliev (c17830@cray.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/32573&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/32573&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11053&quot; title=&quot;problem with loop device associated with lustre file&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11053&quot;&gt;LU-11053&lt;/a&gt; llite: check loop device file size before read&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: efb697a45b56388fc4aba38f176996b054072ff0&lt;/p&gt;</comment>
                            <comment id="231668" author="adilger" created="Wed, 8 Aug 2018 20:14:12 +0000"  >&lt;p&gt;This could be considered a bug in the kernel rather than in Lustre, that the losetup code does not revalidate the inode size before it is attaching the device to the inode.  It seems likely that you could hit this same bug with NFS, which gives you a legitimate reason to submit a patch upstream and to the distro kernels.  Getting this fixed in the upstream kernels would at least put an upper limit on how long we need to keep a workaround in the Lustre code.&lt;/p&gt;</comment>
                            <comment id="247784" author="vsaveliev" created="Mon, 27 May 2019 16:08:12 +0000"  >&lt;p&gt;Andreas,&lt;/p&gt;

&lt;p&gt;I tried something like&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;
--- linux-3.10.0-862.14.4.el7.x86_64.orig/drivers/block/loop.c
+++ linux-3.10.0-862.14.4.el7.x86_64/drivers/block/loop.c
@@ -853,6 +853,7 @@ &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; loop_set_fd(struct loop_devic
+       struct kstat stat;
...
+       &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (vfs_fstat(arg, &amp;amp;stat))
+               &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; out_putf;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That helps for lustre file, but does not in case of NFS which seems to retain outdated file size, although it has been changed on server right after NFS open.&lt;/p&gt;

&lt;p&gt;It seems that there is no suitable inode operation for the invalidation. Do you have a clue on how that could be done?&lt;br/&gt;
Thanks&lt;/p&gt;

&lt;p&gt;PS: In case of NFS, the BUG_ON(!buffer_mapped(bh)) does not happen on umount.&lt;br/&gt;
mount fails with &quot;EXT4-fs (loop0): VFS: Can&apos;t find ext4 filesystem&quot; when it tries to mount loop device associated with zero length nfs file.&lt;/p&gt;</comment>
                            <comment id="247798" author="adilger" created="Mon, 27 May 2019 16:58:31 +0000"  >&lt;p&gt;If problem can be reproduced with NFS, then the best solution is to submit a patch upstream (don&apos;t mention Lustre, just NFS) to add a call to &lt;tt&gt;-&amp;gt;d_revalidate&lt;/tt&gt; before accessing the size. This is the correct thing to do anyway - it only adds overhead when loopback files are being used. &lt;/p&gt;

&lt;p&gt;I tested this locally, but was unable to reproduce it on my Ubuntu client because &lt;tt&gt;losetup&lt;/tt&gt; is calling &lt;tt&gt;lstat()&lt;/tt&gt; on the filename before accessing it (using &lt;tt&gt;util-linux-ng-2.29.2&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;stat64(&quot;/dev/loop0&quot;, {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 0), ...}) = 0
lstat64(&quot;/myth&quot;, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
lstat64(&quot;/myth/tmp&quot;, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
lstat64(&quot;/myth/tmp/MythDora-12.23-X64-DVD&quot;, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64(&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, {st_mode=S_IFREG|0644, st_size=1243049984, ...}) = 0
open(&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, O_RDWR|O_LARGEFILE|O_CLOEXEC) = 3
open(&quot;/dev/loop0&quot;, O_RDWR|O_LARGEFILE|O_CLOEXEC) = 4ioctl(4, LOOP_SET_FD, 3)                = 0
ioctl(4, LOOP_SET_STATUS64, {lo_offset=0, lo_number=0, lo_flags=0, lo_file_name=&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, ...}) = 0
close(3)                                = 0
stat64(&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, {st_mode=S_IFREG|0644, st_size=1243049984, ...}) = 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Running on an old RHEL6 client &lt;tt&gt;losetup&lt;/tt&gt; from &lt;tt&gt;util-linux-ng-2.17.2&lt;/tt&gt; uses &lt;tt&gt;readlink()&lt;/tt&gt; instead of &lt;tt&gt;stat()&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;readlink(&quot;/myth&quot;, 0x7ffd359c6a50, 4096) = -1 EINVAL (Invalid argument)
readlink(&quot;/myth/tmp&quot;, 0x7ffd359c6a50, 4096) = -1 EINVAL (Invalid argument)
readlink(&quot;/myth/tmp/MythDora-12.23-X64-DVD&quot;, 0x7ffd359c6a50, 4096) = -1 EINVAL (Invalid argument)
readlink(&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, 0x7ffd359c6a50, 4096) = -1 EINVAL (Invalid argument)
ioctl(4, LOOP_SET_FD, 0x3)              = 0
close(3)                                = 0
ioctl(4, LOOP_SET_STATUS64, {offset=0, number=0, flags=0, file_name=&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, ...}) = 0
close(4)                                = 0
stat(&quot;/myth/tmp/MythDora-12.23-X64-DVD/MythDora-12-x86_64-DVD.iso&quot;, {st_mode=S_IFREG|0644, st_size=1243049984, ...}) = 0
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It may be that updating &lt;tt&gt;util-linux-ng&lt;/tt&gt; will fix this for you, but it would still be good to fix it in the upstream kernel. As for fixing it in Lustre, I think it would be best to limit this workaround to the &quot;losetup&quot; binary so that it doesn&apos;t hurt all open operations. &lt;/p&gt;</comment>
                    </comments>
                    <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|hzzxr3:</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>