<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:23: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-16025] Read past file size after truncate from another client</title>
                <link>https://jira.whamcloud.com/browse/LU-16025</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;It was found that if a file which was already accessed on node1 is truncated by node2 and then opened and read again by node1, calls to read() can get data past the end of the file. The extra bytes are filled with zeroes.&lt;/p&gt;

&lt;p&gt;This is usually not seen as a call to (f)stat() on the file before being opened or read will actually trigger a glimpse lock, refreshing the actual file size on node1, which is the case for most usual unix tools.&lt;/p&gt;

&lt;p&gt;Note that reading the same file on node2 a second time will actually get it right.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Here is a reproducer:{&lt;tt&gt;}&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&#160;&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;
[seb@node1 ~]$ cat mycat.c
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;
&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; main(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; argc, &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; **argv)
{
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; i;
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; s;
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; fd;
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; buffer[4096];
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (i = 1; i &amp;lt; argc; i++) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; fd = open(argv[i], O_RDONLY);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fd &amp;lt; 0) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; perror(&lt;span class=&quot;code-quote&quot;&gt;&quot;Could not open file&quot;&lt;/span&gt;);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; (1);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; ( (s = read(fd, buffer, sizeof(buffer))) &amp;gt; 0) {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; write(1, buffer, s);
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; close(fd);
&#160; &#160; &#160; &#160; }
}&#160;
[seb@node1 ~]$ gcc -Wall mycat.c -o mycat &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&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;
[seb@node1 ~]$ cp somefile.txt /lustre/seb/somefile.txt
# Trigger a read of the file on node2 to fill up the inode informations
# Notice the file at &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; time is several megabytes
[seb@node1 ~]$ ssh node2 &lt;span class=&quot;code-quote&quot;&gt;&apos;cat /lustre/seb/somefile.txt &amp;gt; /dev/&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;; ls -l /lustre/seb/somefile.txt&apos;&lt;/span&gt;
-rw-r----- 1 seb seb 114052401 Jun 16 13:51 /lustre/seb/somefile.txt
[seb@node1 ~]$ truncate -s 100000 /lustre/seb/somefile.txt
# Now read the file from a remote node making sure no stat() call occurs before
[seb@node1 ~]$ ssh node2 &lt;span class=&quot;code-quote&quot;&gt;&apos;~/mycat /lustre/seb/somefile.txt | hexdump -C | tail -n 4&apos;&lt;/span&gt;
00018690 &#160;63 73 74 30 31 5b 4f 53 &#160;54 3a 33 36 5d 0a 32 30 &#160;|cst01[OST:36].20| 
000186a0 &#160;00 00 00 00 00 00 00 00 &#160;00 00 00 00 00 00 00 00 &#160;|................| 
* 
00019000 
# bytes above 100000 up to 102400 (completing the last page) are showing zeroes
[seb@node1 ~]$ ssh node2 &lt;span class=&quot;code-quote&quot;&gt;&apos;~/mycat /lustre/seb/somefile.txt | hexdump -C | tail -n 4&apos;&lt;/span&gt;
00018670 &#160;31 31 33 37 34 38 20 20 &#160;36 33 38 37 39 38 31 37 &#160;|113748 &#160;63879817| 
00018680 &#160;31 36 20 20 34 36 25 20 &#160;2f 6c 75 73 2f 68 31 74 &#160;|16 &#160;46% /lus/h1t| 
00018690 &#160;63 73 74 30 31 5b 4f 53 &#160;54 3a 33 36 5d 0a 32 30 &#160;|cst01[OST:36].20| 
000186a0 &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This was done with a simple ftruncate() call here, but the same problem occurs with an open( &quot;/lustre/seb/somefile.txt&quot;, O_WRONLY|O_TRUNC) + writes to a lower size than original.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment>RHEL 8.5 kernel 4.18.0-348.23.1.el8&lt;br/&gt;
Whamcloud release 2.12.8</environment>
        <key id="71191">LU-16025</key>
            <summary>Read past file size after truncate from another client</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.whamcloud.com/images/icons/priorities/critical.svg">Critical</priority>
                        <status id="6" iconUrl="https://jira.whamcloud.com/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="bobijam">Zhenyu Xu</assignee>
                                    <reporter username="hxing">Xing Huang</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Jul 2022 03:00:43 +0000</created>
                <updated>Tue, 30 Jan 2024 10:53:49 +0000</updated>
                            <resolved>Tue, 30 Jan 2024 10:53:49 +0000</resolved>
                                    <version>Lustre 2.12.8</version>
                                    <fixVersion>Lustre 2.16.0</fixVersion>
                    <fixVersion>Lustre 2.15.3</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>13</watches>
                                                                            <comments>
                            <comment id="340905" author="pjones" created="Tue, 19 Jul 2022 19:01:55 +0000"  >&lt;p&gt;Patch pushed to master - &lt;a href=&quot;https://review.whamcloud.com/47896&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/47896&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="342902" author="cthomaz" created="Mon, 8 Aug 2022 13:45:08 +0000"  >&lt;p&gt;Hi Peter&lt;/p&gt;

&lt;p&gt;Any news on this one?&#160;&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

&lt;p&gt;Carlos&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="342989" author="JIRAUSER17900" created="Tue, 9 Aug 2022 03:05:52 +0000"  >&lt;p&gt;Hi Carlos, we are actively working on the fix patch, now we are solving the test failures of the patch.&lt;/p&gt;</comment>
                            <comment id="349335" author="adilger" created="Wed, 12 Oct 2022 07:04:31 +0000"  >&lt;p&gt;Is patch also needed on b_es6_0?&lt;/p&gt;</comment>
                            <comment id="350710" author="gerrit" created="Tue, 25 Oct 2022 17:21:43 +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/+/47896/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/47896/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16025&quot; title=&quot;Read past file size after truncate from another client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16025&quot;&gt;&lt;del&gt;LU-16025&lt;/del&gt;&lt;/a&gt; llite: adjust read count as file got truncated&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 4468f6c9d92448cb72c5a616ec74653e83ee8e10&lt;/p&gt;</comment>
                            <comment id="350741" author="pjones" created="Tue, 25 Oct 2022 18:58:56 +0000"  >&lt;p&gt;Landed for 2.16&lt;/p&gt;</comment>
                            <comment id="369884" author="gerrit" created="Wed, 19 Apr 2023 12:17:21 +0000"  >&lt;p&gt;&quot;Sebastien Buisson &amp;lt;sbuisson@ddn.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/50689&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50689&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16025&quot; title=&quot;Read past file size after truncate from another client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16025&quot;&gt;&lt;del&gt;LU-16025&lt;/del&gt;&lt;/a&gt; llite: adjust read count as file got truncated&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_15&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 8acf9a3ebd3f45b193436b18a4d115d3327c7a56&lt;/p&gt;</comment>
                            <comment id="373024" author="gerrit" created="Sat, 20 May 2023 07:08:47 +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/+/50689/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50689/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16025&quot; title=&quot;Read past file size after truncate from another client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16025&quot;&gt;&lt;del&gt;LU-16025&lt;/del&gt;&lt;/a&gt; llite: adjust read count as file got truncated&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_15&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 48d247fcc97533ae10b204dd059c908344ab1d06&lt;/p&gt;</comment>
                            <comment id="375504" author="sihara" created="Thu, 15 Jun 2023 08:50:15 +0000"  >&lt;p&gt;an constant small performance regression (-10%) detected after patch &lt;a href=&quot;https://review.whamcloud.com/#/c/fs/lustre-release/+/50689&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/#/c/fs/lustre-release/+/50689&lt;/a&gt; landed in b2_15.&lt;/p&gt;

&lt;p&gt;a workload is single process and 4k buffered IO&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;# salloc -p 40n -N 1 --ntasks-per-node=1 /usr/mpi/gcc/openmpi-4.1.5a1/bin/mpirun --allow-run-as-root /work/tools/bin/ior -i 1 -w -r -b 256g -t 4k -C -Q 2 -e -vv -F -o /exafs/d0/d1/d2/ior.single.out/file
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;here is list of b2_15 branch&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;- snip -
a4e89bffe6 LU-16369 ldiskfs: do not check enc context at lookup 
Max Write: 539.39 MiB/sec (565.60 MB/sec)
Max Read: &#160;2503.16 MiB/sec (2624.75 MB/sec)

48d247fcc9 LU-16025 llite: adjust read count as file got truncated
Max Write: 538.69 MiB/sec (564.85 MB/sec)
Max Read:  2416.74 MiB/sec (2534.13 MB/sec)

b74560d74a LU-16286 ldiskfs: reimplement nodelalloc optimization
Max Write: 533.40 MiB/sec (559.31 MB/sec)
Max Read:  2761.09 MiB/sec (2895.21 MB/sec)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Is this expected performance degradation to solve original defect, or is it possible to fix without performance impacts?&lt;/p&gt;

&lt;p&gt;NOTE: &lt;br/&gt;
the performance was back after reverted patch &lt;a href=&quot;https://review.whamcloud.com/#/c/fs/lustre-release/+/50689&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/#/c/fs/lustre-release/+/50689&lt;/a&gt;  from b2_15 &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;Max Write: 529.53 MiB/sec (555.25 MB/sec)
Max Read:  2704.63 MiB/sec (2836.01 MB/sec)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="375556" author="paf0186" created="Thu, 15 Jun 2023 14:57:02 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=bobijam&quot; class=&quot;user-hover&quot; rel=&quot;bobijam&quot;&gt;bobijam&lt;/a&gt; , I posted a comment in &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/50689&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50689&lt;/a&gt; - I think I know why we have a regression in 4K reads, and maybe have a suggestion?&#160; But Ihara, fyi, this patch is an important correctness fix so definitely no revert.&lt;/p&gt;</comment>
                            <comment id="375598" author="sihara" created="Thu, 15 Jun 2023 21:04:18 +0000"  >&lt;p&gt;OK, that&apos;s I thought. Thanks for confirmation, Patrick. It&apos;s a trade off to fix an critical problem first and will imporve the codes later if it&apos;s possible.&lt;/p&gt;</comment>
                            <comment id="375687" author="paf0186" created="Fri, 16 Jun 2023 15:52:41 +0000"  >&lt;p&gt;Bobi commented in Gerrit - He tried it and my suggested approach doesn&apos;t work (for anyone following along here).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/50689&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50689&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically the fix adds slight overhead to each read, so it&apos;s more significant for smaller reads and probably can&apos;t even be measured for large reads.&#160; But we need the fix and the cost isn&apos;t too high, so that&apos;s where we&apos;re at for now.&lt;/p&gt;</comment>
                            <comment id="401382" author="bobijam" created="Fri, 26 Jan 2024 10:06:23 +0000"  >&lt;p&gt;iocb-&amp;gt;ki_pos could be wrong so that next read could start from wrong offset.&lt;/p&gt;</comment>
                            <comment id="401385" author="gerrit" created="Fri, 26 Jan 2024 10:15:23 +0000"  >&lt;p&gt;&quot;Zhenyu Xu &amp;lt;bobijam@hotmail.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/53827&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53827&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16025&quot; title=&quot;Read past file size after truncate from another client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16025&quot;&gt;&lt;del&gt;LU-16025&lt;/del&gt;&lt;/a&gt; llite: short read could mess up next read offset&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: be710a787d4af182d51866dd5dc09b71b880688b&lt;/p&gt;</comment>
                            <comment id="401787" author="bobijam" created="Tue, 30 Jan 2024 10:53:49 +0000"  >&lt;p&gt;short read reset ki_pos issue is tracked at &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17482&quot; title=&quot;short read does not set ki_pos correctly&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17482&quot;&gt;LU-17482&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="80360">LU-17469</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i02uv3:</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>