<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:32:50 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-17124] fiemap FIEMAP_FLAG_SYNC flag expects filemap_write_and_wait() or similar</title>
                <link>https://jira.whamcloud.com/browse/LU-17124</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;fiemap FIEMAP_FLAG_SYNC can race while client is writing data to disk&lt;/p&gt;

&lt;p&gt;In such a case fiemap() call returns that the data is not on disk (no data for the range) and cp can just truncates (or sparse fill) based on the size of the file/extent.&lt;/p&gt;

&lt;p&gt;strace shows that FIEMAP_FLAG_SYNC was sent. Further and the user reports that a &apos;sync; cp &amp;lt;blah&amp;gt;&apos; does not fail and a newer cp that uses copy_file_range() also does not fail.&lt;/p&gt;

&lt;p&gt;Looking further FIEMAP_FLAG_SYNC &lt;b&gt;expects&lt;/b&gt; the data to be on disk aka filemap_write_and_wait() not just filemap_fdatawrite()&lt;/p&gt;</description>
                <environment></environment>
        <key id="77972">LU-17124</key>
            <summary>fiemap FIEMAP_FLAG_SYNC flag expects filemap_write_and_wait() or similar</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="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="stancheff">Shaun Tancheff</assignee>
                                    <reporter username="stancheff">Shaun Tancheff</reporter>
                        <labels>
                    </labels>
                <created>Mon, 18 Sep 2023 10:40:44 +0000</created>
                <updated>Wed, 15 Nov 2023 17:09:26 +0000</updated>
                            <resolved>Thu, 28 Sep 2023 15:21:13 +0000</resolved>
                                                    <fixVersion>Lustre 2.16.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                            <comments>
                            <comment id="386281" author="gerrit" created="Mon, 18 Sep 2023 10:42:50 +0000"  >&lt;p&gt;&quot;Shaun Tancheff &amp;lt;shaun.tancheff@hpe.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/52402&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/52402&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17124&quot; title=&quot;fiemap FIEMAP_FLAG_SYNC flag expects filemap_write_and_wait() or similar&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17124&quot;&gt;&lt;del&gt;LU-17124&lt;/del&gt;&lt;/a&gt; llite: Write and wait on FIEMAP_FLAG_SYNC&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 39825b198f06234da2876637660663981d866bf1&lt;/p&gt;</comment>
                            <comment id="387510" author="gerrit" created="Thu, 28 Sep 2023 08:02:49 +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/+/52402/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/52402/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17124&quot; title=&quot;fiemap FIEMAP_FLAG_SYNC flag expects filemap_write_and_wait() or similar&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17124&quot;&gt;&lt;del&gt;LU-17124&lt;/del&gt;&lt;/a&gt; llite: Write and wait on FIEMAP_FLAG_SYNC&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 1af966fe6983f28e9d438b57944c4dccb8941c61&lt;/p&gt;</comment>
                            <comment id="387604" author="pjones" created="Thu, 28 Sep 2023 15:21:13 +0000"  >&lt;p&gt;Landed for 2.16&lt;/p&gt;</comment>
                            <comment id="392981" author="lflis" created="Tue, 14 Nov 2023 12:09:00 +0000"  >&lt;p&gt;Cyfronet here,&lt;/p&gt;



&lt;p&gt;Server: 2.15.3 &lt;br/&gt;
Client 2.15.3 + &#160;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17124&quot; title=&quot;fiemap FIEMAP_FLAG_SYNC flag expects filemap_write_and_wait() or similar&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17124&quot;&gt;&lt;del&gt;LU-17124&lt;/del&gt;&lt;/a&gt;&#160;llite: Write and wait on FIEMAP_FLAG_SYNC&lt;br/&gt;
Cllient OS: Rocky 9, cp is using copy_file_range instead of read/write&lt;/p&gt;

&lt;p&gt;We have observed the same issue prior applying the patch. When copying 4096 files from one directory to another (on the same fs), in parallel using 32 processes, some copies where corrupted. Some files were truncated more or less, around 10-30 destination files corrupted in total.&lt;/p&gt;

&lt;p&gt;Having applied the patch we observe less corrupted files and less bytes are missing.&#160;&lt;/p&gt;

&lt;p&gt;It seems that solution doesn&apos;t fix the problem completly, or maybe we miss some other patches between 2.15.3 and 2.16.0&lt;/p&gt;</comment>
                            <comment id="392982" author="lflis" created="Tue, 14 Nov 2023 12:12:16 +0000"  >&lt;p&gt;This is how we copy the files:&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;
find ./source_dir -name *.exr | xargs -P32 -I&lt;span class=&quot;code-quote&quot;&gt;&apos;{}&apos;&lt;/span&gt; cp -v {} ./dest_dir&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Parameter -P32 keeps 32 processes running in parallel&lt;/p&gt;</comment>
                            <comment id="393009" author="stancheff" created="Tue, 14 Nov 2023 15:23:28 +0000"  >&lt;p&gt;If you are copying from Lustre to Lustre on the same file system then I do not see this patch would have any obvious effect on your use case. I do not see fiemap() being involved on el9.2 when copy_file_range() can be used.&lt;/p&gt;

&lt;p&gt;So I think your find | xargs -P32 cp &amp;lt;args&amp;gt; case is may be exposing a separate bug.&lt;/p&gt;

&lt;p&gt;If you could capture strace(s) of the cp -v and provide / attach a &apos;good&apos; sample and a &apos;bad&apos; sample we may be able to see what is happening.&lt;/p&gt;</comment>
                            <comment id="393021" author="lflis" created="Tue, 14 Nov 2023 16:47:28 +0000"  >&lt;p&gt;Two traces in the attachment, both captured for the same file&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;#good
...
uname({sysname=&quot;Linux&quot;, nodename=&quot;t0006&quot;, ...}) = 0
copy_file_range(3, NULL, 4, NULL, 9223372035781033984, 0) = 62924467
copy_file_range(3, NULL, 4, NULL, 9223372035781033984, 0) = 0
...
#bad
...
uname({sysname=&quot;Linux&quot;, nodename=&quot;t0006&quot;, ...}) = 0
copy_file_range(3, NULL, 4, NULL, 9223372035781033984, 0) = 19005440
copy_file_range(3, NULL, 4, NULL, 9223372035781033984, 0) = 1441792
copy_file_range(3, NULL, 4, NULL, 9223372035781033984, 0) = 0            &amp;lt;= short read?
...

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="393066" author="lflis" created="Tue, 14 Nov 2023 22:18:20 +0000"  >&lt;p&gt;Quick update.&lt;br/&gt;
Forcing fsync(fd_out) before copy_file_range() call fixes the problem with truncated output files&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;
 /*
&#160;* &#160; gcc -c -Wall -Werror -fpic ./&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.c -o cfr.o
&#160;* &#160; gcc -ldl -shared -o ./cfr.so ./cfr.o
&#160;* &#160; LD_PRELOAD=/full_path_to/cfr.so cp A B
&#160;*
&#160;* */

#define _GNU_SOURCE 1
#include &amp;lt;dlfcn.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;sys/types.h&amp;gt;
#include &amp;lt;sys/stat.h&amp;gt;
#include &amp;lt;fcntl.h&amp;gt;

typedef ssize_t *(*cfr_t)(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;, loff_t*, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;, loff_t*, size_t, unsigned &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt;);
&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; cfr_t p = NULL;
ssize_t copy_file_range(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; fd_in, loff_t *off_in, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; fd_out, loff_t *off_out, size_t len, unsigned &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; flags)
{
&#160; &#160; fsync(fd_out);
&#160; &#160; ssize_t r=-1;
&#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (p == NULL) {
&#160; &#160; &#160; &#160; p = &#160;dlsym(RTLD_NEXT, &lt;span class=&quot;code-quote&quot;&gt;&quot;copy_file_range&quot;&lt;/span&gt;);
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (p == NULL) {
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-comment&quot;&gt;/* Error handling */&lt;/span&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; r;
&#160; &#160; &#160; &#160; }
&#160; &#160; }&#160; &#160; r = (ssize_t) p(fd_in, off_in, fd_out, off_out, len,flags);
&#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; r;
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

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

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

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

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="393097" author="gerrit" created="Wed, 15 Nov 2023 07:46:52 +0000"  >&lt;p&gt;&quot;Shaun Tancheff &amp;lt;shaun.tancheff@hpe.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/53140&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53140&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-17124&quot; title=&quot;fiemap FIEMAP_FLAG_SYNC flag expects filemap_write_and_wait() or similar&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-17124&quot;&gt;&lt;del&gt;LU-17124&lt;/del&gt;&lt;/a&gt; llite: sync on splice write&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: c6c5e7c6664fcaeb4b4df51f6e0562f35a91d985&lt;/p&gt;</comment>
                            <comment id="393098" author="stancheff" created="Wed, 15 Nov 2023 07:52:25 +0000"  >&lt;p&gt;Please try the patch and see if the sync() occurs early enough to resolve the corruption you are finding.&lt;/p&gt;

&lt;p&gt;If not we may need to implement a file-system specific copy_file_range()&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</comment>
                            <comment id="393125" author="lflis" created="Wed, 15 Nov 2023 13:11:10 +0000"  >&lt;p&gt;Thank you for the patch. We tested the changes and unfortunately we still see corrupted destnation files.&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="393143" author="simmonsja" created="Wed, 15 Nov 2023 14:48:07 +0000"  >&lt;p&gt;A ticket exist for copy_file_range(). I just never got the cycles to implement for Lustre. Also RHEL7 doesn&apos;t support a proper hook for copy_file_range.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="53924">LU-11621</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="50929" name="SHOT02_09010.exr.trace.bad" size="13658" author="lflis" created="Tue, 14 Nov 2023 16:45:13 +0000"/>
                            <attachment id="50930" name="SHOT02_09010.exr.trace.good" size="13616" author="lflis" created="Tue, 14 Nov 2023 16:45:13 +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|i03vyv:</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>