<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:19:37 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-15590] e2fsprogs direct IO raw_read_blk() issues</title>
                <link>https://jira.whamcloud.com/browse/LU-15590</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;In e2fsprogs (master=v1.46.2-9-g32fda1e5 and recent wc tags), there is a one line bug in the direct IO case of &lt;tt&gt;raw_read_blk()&lt;/tt&gt;. &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;
bounce_read:
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (channel-&amp;gt;align == 0)
                channel-&amp;gt;align = 1;
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ((channel-&amp;gt;block_size &amp;gt; channel-&amp;gt;align) &amp;amp;&amp;amp;
            (channel-&amp;gt;block_size % channel-&amp;gt;align) == 0)
                align_size = channel-&amp;gt;block_size;
        &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt;
                align_size = channel-&amp;gt;align;
        aligned_blk = location / align_size;
        offset = location % align_size;

        mutex_lock(data, BOUNCE_MTX);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ext2fs_llseek(data-&amp;gt;dev, aligned_blk * align_size, SEEK_SET) &amp;lt; 0) {
                retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
                &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; error_unlock;
        }
        &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; (size &amp;gt; 0) {
                actual = read(data-&amp;gt;dev, data-&amp;gt;bounce, align_size);
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (actual != align_size) {
                        mutex_unlock(data, BOUNCE_MTX);
                        actual = really_read;
                        buf -= really_read;
                        size += really_read;
                        &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; short_read;
                }
                actual = size; &lt;span class=&quot;code-comment&quot;&gt;/* HERE HIER AQUI ICI QUI TUK */&lt;/span&gt;
                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (actual &amp;gt; align_size)
                        actual = align_size;
                actual -= offset;
                memcpy(buf, data-&amp;gt;bounce + offset, actual);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;We should not be setting &lt;tt&gt;actual = size&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;When this is called from &lt;tt&gt;ext2fs_open()&lt;/tt&gt; to read the super block on devices with a 4KB logical block size and &lt;tt&gt;EXT2_FLAG_DIRECT_IO&lt;/tt&gt; it mis-initializes the super block and &lt;tt&gt;ext2fs_open()&lt;/tt&gt; fails with &lt;tt&gt;EXT2_ET_BAD_MAGIC&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;This can be reproduced in a few ways.&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Get a recent version of losetup that supports the -b option to set the logical blocksize.&lt;/li&gt;
	&lt;li&gt;Hack ext2fs_get_device_sectsize() to return 4K.&lt;/li&gt;
	&lt;li&gt;Use a device with 4K blocks.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Note, that you need to use EXT2_FLAG_DIRECT_IO in any of these cases to reproduce the issue.&lt;/p&gt;

&lt;p&gt;It looks like this was fixed by &lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=artem_blagodarenko&quot; class=&quot;user-hover&quot; rel=&quot;artem_blagodarenko&quot;&gt;artem_blagodarenko&lt;/a&gt;&apos;s change&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;c0015961 libext2fs: fix unix_io&apos;s Direct I/O support
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and then inadvertently reintroduced by&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;d557b965 libext2fs: fix potential races in unix_io
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;See &lt;a href=&quot;https://marc.info/?l=linux-ext4&amp;amp;m=161461569206170&amp;amp;w=2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://marc.info/?l=linux-ext4&amp;amp;m=161461569206170&amp;amp;w=2&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="68838">LU-15590</key>
            <summary>e2fsprogs direct IO raw_read_blk() issues</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="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="jhammond">John Hammond</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                    </labels>
                <created>Wed, 23 Feb 2022 22:18:03 +0000</created>
                <updated>Tue, 19 Jul 2022 23:25:12 +0000</updated>
                            <resolved>Thu, 24 Feb 2022 20:13:42 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                            <comments>
                            <comment id="327180" author="gerrit" created="Wed, 23 Feb 2022 22:37:56 +0000"  >&lt;p&gt;&quot;John L. Hammond &amp;lt;jhammond@whamcloud.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/46601&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/46601&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15590&quot; title=&quot;e2fsprogs direct IO raw_read_blk() issues&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15590&quot;&gt;&lt;del&gt;LU-15590&lt;/del&gt;&lt;/a&gt; libext2fs: fix direct I/O read&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 077102b72c3146305d5de24668298bcf26fa747b&lt;/p&gt;</comment>
                            <comment id="327317" author="gerrit" created="Thu, 24 Feb 2022 20:11:44 +0000"  >&lt;p&gt;&quot;Andreas Dilger &amp;lt;adilger@whamcloud.com&amp;gt;&quot; merged in patch &lt;a href=&quot;https://review.whamcloud.com/46601/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/46601/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-15590&quot; title=&quot;e2fsprogs direct IO raw_read_blk() issues&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-15590&quot;&gt;&lt;del&gt;LU-15590&lt;/del&gt;&lt;/a&gt; libext2fs: fix direct I/O read&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 980a75706e0ea08efc3138727fde0bf9440bee1c&lt;/p&gt;</comment>
                            <comment id="327318" author="adilger" created="Thu, 24 Feb 2022 20:13:42 +0000"  >&lt;p&gt;Patch will be included in e2fsprogs-1.46.2.wc5.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="68839">LU-15591</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|i02j9b:</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>