<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:55:46 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-5933] FIEMAP: FIEMAP_EXTENT_LAST is not always set</title>
                <link>https://jira.whamcloud.com/browse/LU-5933</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;With the FS_IOC_FIEMAP ioctl, when the exact number of required extent is used, and the file ends with a hole, FIEMAP_EXTENT_LAST is not set like it should.&lt;/p&gt;

&lt;p&gt;Reproducer:&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;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.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;
#include &amp;lt;linux/fs.h&amp;gt;
#include &amp;lt;linux/fiemap.h&amp;gt;
#include &amp;lt;sys/ioctl.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[])
{
	struct fiemap *fiemap = NULL;
	struct fiemap fiemap_init;
	&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; fd;
	size_t extents_count;

	fd = open(argv[1], O_RDONLY);

	&lt;span class=&quot;code-comment&quot;&gt;/* Query to get the number of extents. */&lt;/span&gt;
	memset(&amp;amp;fiemap_init, 0, sizeof(fiemap_init));
	fiemap_init.fm_length = ~0;		&lt;span class=&quot;code-comment&quot;&gt;/* all of it */&lt;/span&gt;
	fiemap_init.fm_flags = FIEMAP_FLAG_SYNC; &lt;span class=&quot;code-comment&quot;&gt;/* sync file */&lt;/span&gt;

	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ioctl(fd, FS_IOC_FIEMAP, &amp;amp;fiemap_init) &amp;lt; 0) {
		perror(&lt;span class=&quot;code-quote&quot;&gt;&quot;fiemap 1 failed&quot;&lt;/span&gt;);
		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 1;
	}

	extents_count = fiemap_init.fm_mapped_extents;
	fprintf(stderr, &lt;span class=&quot;code-quote&quot;&gt;&quot;(1st) file has %zd extent(s)\n&quot;&lt;/span&gt;, extents_count);

	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (extents_count == 0) {
		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 1;
	}

	&lt;span class=&quot;code-comment&quot;&gt;/* Workaround &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; Lustre */&lt;/span&gt;
	&lt;span class=&quot;code-comment&quot;&gt;//extents_count++;
&lt;/span&gt;
	fiemap = calloc(1, sizeof(struct fiemap) +
					sizeof(struct fiemap_extent) * extents_count);
	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fiemap == NULL) {
		perror(&lt;span class=&quot;code-quote&quot;&gt;&quot;calloc failed&quot;&lt;/span&gt;);
		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 1;
	}

	&lt;span class=&quot;code-comment&quot;&gt;/* Get the extents. */&lt;/span&gt;
	fiemap-&amp;gt;fm_length = ~0;		&lt;span class=&quot;code-comment&quot;&gt;/* the whole file */&lt;/span&gt;
	fiemap-&amp;gt;fm_flags = FIEMAP_FLAG_SYNC; &lt;span class=&quot;code-comment&quot;&gt;/* sync file */&lt;/span&gt;
	fiemap-&amp;gt;fm_extent_count = extents_count;

	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ioctl(fd, FS_IOC_FIEMAP, fiemap) &amp;lt; 0) {
		perror(&lt;span class=&quot;code-quote&quot;&gt;&quot;fiemap 2 failed&quot;&lt;/span&gt;);
		&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 1;
	}

	fprintf(stderr, &lt;span class=&quot;code-quote&quot;&gt;&quot;(2nd) file has %zd extent(s)\n&quot;&lt;/span&gt;, extents_count);

	&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (fiemap-&amp;gt;fm_extents[fiemap-&amp;gt;fm_mapped_extents-1].fe_flags &amp;amp; FIEMAP_EXTENT_LAST)
		printf(&lt;span class=&quot;code-quote&quot;&gt;&quot;Good\n&quot;&lt;/span&gt;);
	&lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
		printf(&lt;span class=&quot;code-quote&quot;&gt;&quot;Bad\n&quot;&lt;/span&gt;);

	&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 0;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On ext4:&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;# echo sdfghjk &amp;gt; tfile
# ~/tsparse tfile 
file has 1 extent(s)
Good
# truncate -s 10000 tfile 
# ~/tsparse tfile 
(1st) file has 1 extent(s)
(2nd) file has 1 extent(s)
Good
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On Lustre head of tree:&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;# echo sdfghjk &amp;gt; tfile
# ~/tsparse tfile 
(1st) file has 1 extent(s)
(2nd) file has 1 extent(s)
Good
# truncate -s 1000000 tfile 
# ~/tsparse tfile 
file has 1 extent(s)
Bad
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If I uncomment the &quot;hack&quot; in the test code, allocating one extra extent, then it works, although only 1 extent is actually used.&lt;/p&gt;

&lt;p&gt;This is likely to break programs that rely on that flag to check the integrity of the returned mapping.&lt;/p&gt;

&lt;p&gt;I don&apos;t have a fix at this time.&lt;/p&gt;</description>
                <environment></environment>
        <key id="27642">LU-5933</key>
            <summary>FIEMAP: FIEMAP_EXTENT_LAST is not always set</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="1">Fixed</resolution>
                                        <assignee username="bobijam">Zhenyu Xu</assignee>
                                    <reporter username="fzago">Frank Zago</reporter>
                        <labels>
                    </labels>
                <created>Wed, 19 Nov 2014 00:05:09 +0000</created>
                <updated>Tue, 25 Aug 2015 00:29:52 +0000</updated>
                            <resolved>Fri, 5 Dec 2014 13:47:54 +0000</resolved>
                                    <version>Lustre 2.7.0</version>
                                    <fixVersion>Lustre 2.7.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="100815" author="gerrit" created="Fri, 5 Dec 2014 13:41:00 +0000"  >&lt;p&gt;Oleg Drokin (oleg.drokin@intel.com) merged in patch &lt;a href=&quot;http://review.whamcloud.com/12781/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/12781/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-5933&quot; title=&quot;FIEMAP: FIEMAP_EXTENT_LAST is not always set&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-5933&quot;&gt;&lt;del&gt;LU-5933&lt;/del&gt;&lt;/a&gt; fiemap: set FIEMAP_EXTENT_LAST correctly&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 5c2e692d2ae971f1ba0811487c37b3510ccde8be&lt;/p&gt;</comment>
                            <comment id="100821" author="pjones" created="Fri, 5 Dec 2014 13:47:54 +0000"  >&lt;p&gt;Landed for 2.7&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="27842">LU-6007</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|hzx16f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>16568</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>