<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:45:15 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-11596] sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144</title>
                <link>https://jira.whamcloud.com/browse/LU-11596</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;sanity test 42d failed as follows:&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;Lustre: DEBUG MARKER: /usr/sbin/lctl get_param -n osc.lustre-*.cur_*grant_bytes
Lustre: DEBUG MARKER: /usr/sbin/lctl get_param osc.lustre-*.cur_*_bytes
Lustre: DEBUG MARKER: /usr/sbin/lctl mark  sanity test_42d: @@@@@@ FAIL: failed: client:143294464 server: 143110144. 
Lustre: DEBUG MARKER: sanity test_42d: @@@@@@ FAIL: failed: client:143294464 server: 143110144.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Dmesg on OSS node:&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;Lustre: DEBUG MARKER: == sanity test 42d: test complete truncate of file with cached dirty data ============================ 01:34:08 (1540517648)
Lustre: DEBUG MARKER: lctl set_param -n fail_loc=0 	    fail_val=0 2&amp;gt;/dev/null
Lustre: DEBUG MARKER: /usr/sbin/lctl get_param  obdfilter.lustre-OST*.{tot_granted,tot_pending,grant_precreate}
Lustre: DEBUG MARKER: /usr/sbin/lctl get_param obdfilter.lustre-OST*.tot* obdfilter.lustre-OST*.grant_*
Lustre: DEBUG MARKER: /usr/sbin/lctl mark  sanity test_42d: @@@@@@ FAIL: failed: client:143294464 server: 143110144. 
Lustre: DEBUG MARKER: sanity test_42d: @@@@@@ FAIL: failed: client:143294464 server: 143110144.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Maloo report: &lt;a href=&quot;https://testing.whamcloud.com/test_sets/88bbf5c2-d9d0-11e8-b46b-52540065bddc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://testing.whamcloud.com/test_sets/88bbf5c2-d9d0-11e8-b46b-52540065bddc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;sanity tests 63a, 63b, 64a, 64b, 64c also failed with the same issue.&lt;/p&gt;</description>
                <environment>Lustre Build: &lt;a href=&quot;https://build.whamcloud.com/job/lustre-master/3811&quot;&gt;https://build.whamcloud.com/job/lustre-master/3811&lt;/a&gt;&lt;br/&gt;
Distro/Arch: RHEL7.5/aarch64 (client), RHEL7.5/x86_64 (server)</environment>
        <key id="53880">LU-11596</key>
            <summary>sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144</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="simmonsja">James A Simmons</assignee>
                                    <reporter username="yujian">Jian Yu</reporter>
                        <labels>
                            <label>arm</label>
                            <label>ppc</label>
                            <label>rhel8</label>
                    </labels>
                <created>Thu, 1 Nov 2018 17:40:46 +0000</created>
                <updated>Tue, 21 Mar 2023 20:58:40 +0000</updated>
                            <resolved>Tue, 18 Jan 2022 14:20:07 +0000</resolved>
                                    <version>Lustre 2.12.0</version>
                    <version>Lustre 2.13.0</version>
                    <version>Lustre 2.14.0</version>
                    <version>Lustre 2.12.4</version>
                    <version>Lustre 2.12.5</version>
                    <version>Lustre 2.12.6</version>
                                    <fixVersion>Lustre 2.15.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>9</watches>
                                                                            <comments>
                            <comment id="236973" author="gerrit" created="Wed, 14 Nov 2018 08:19:41 +0000"  >&lt;p&gt;Jian Yu (yujian@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/33652&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/33652&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: disable sanity tests 42d,63&lt;span class=&quot;error&quot;&gt;&amp;#91;a,b&amp;#93;&lt;/span&gt;,64&lt;span class=&quot;error&quot;&gt;&amp;#91;a-c&amp;#93;&lt;/span&gt; for ARM&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: f03165045efacafb69204d460c3409ab91f00a3a&lt;/p&gt;</comment>
                            <comment id="237298" author="gerrit" created="Wed, 21 Nov 2018 04:05:16 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/33652/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/33652/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: disable several sanity sub-tests for ARM&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: ef38bdfd2b7e672e1886d5c9874e4749ce2ac258&lt;/p&gt;</comment>
                            <comment id="237549" author="adilger" created="Tue, 27 Nov 2018 19:37:11 +0000"  >&lt;p&gt;It looks like this is one of the few test failures that seems to legitimately be caused by the code running on ARM 64KB PAGE_SIZE.  I suspect that there is somewhere in the client (OSC) or server (OFD) grant code that is assuming &lt;tt&gt;PAGE_SIZE&lt;/tt&gt; = 4096, and is adding/subtracting 4096 bytes instead of &lt;tt&gt;PAGE_SIZE&lt;/tt&gt;.  In the case reported in the bug title, the difference between the grant values is 184320 bytes, or 45x 4096 bytes.&lt;/p&gt;

&lt;p&gt;Given that this is a 100% failure it should be fairly straight forward to debug.  Note, however, that it is possible the grant has become out-of-sync in some earlier test, and these tests are failing because they are the only ones in &lt;tt&gt;$GRANT_CHECK_LIST&lt;/tt&gt;.  It may be useful to modify &lt;tt&gt;test-framework.c::check_grant()&lt;/tt&gt; to allow setting an environment variable (e.g. &lt;tt&gt;GRANT_CHECK_ALWAYS=yes&lt;/tt&gt;) to check grant for every subtest to catch the actual source of the problem.&lt;/p&gt;</comment>
                            <comment id="237552" author="yujian" created="Tue, 27 Nov 2018 19:55:32 +0000"  >&lt;p&gt;Thank you Andreas for the suggestions. Let me look into the grant codes.&lt;/p&gt;</comment>
                            <comment id="237917" author="sergey" created="Tue, 4 Dec 2018 14:29:45 +0000"  >&lt;p&gt;Faced the same problem on arm session for another sanity tests - 63a, 63b, 64a, 64c&lt;br/&gt;
&lt;a href=&quot;https://testing.whamcloud.com/test_sets/f33166da-ecdb-11e8-adf2-52540065bddc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://testing.whamcloud.com/test_sets/f33166da-ecdb-11e8-adf2-52540065bddc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="237980" author="adilger" created="Wed, 5 Dec 2018 04:15:52 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Faced the same problem on arm session for another sanity tests - 63a, 63b, 64a, 64c&lt;br/&gt;
 &lt;a href=&quot;https://testing.whamcloud.com/test_sets/f33166da-ecdb-11e8-adf2-52540065bddc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://testing.whamcloud.com/test_sets/f33166da-ecdb-11e8-adf2-52540065bddc&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Sergey,&lt;br/&gt;
if you are still hitting these failures on ARM, then it means your patch is not updated to the latest master that includes the above patch to skip these tests.  You could rebase your patch to get these fixes, but it is not critical for review-ldiskfs-arm because that test session is optional and does not affect the Maloo +/-1 result.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="241503" author="adilger" created="Wed, 6 Feb 2019 22:09:24 +0000"  >&lt;p&gt;It looks like there are also failures on sanity test_64d on ARM, so that should be added to the skip list:&lt;br/&gt;
&lt;a href=&quot;https://testing.whamcloud.com/test_sets/48e911d6-2a08-11e9-b901-52540065bddc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://testing.whamcloud.com/test_sets/48e911d6-2a08-11e9-b901-52540065bddc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="244031" author="gerrit" created="Fri, 15 Mar 2019 21:34:53 +0000"  >&lt;p&gt;Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/34432&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/34432&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: skip sanity test_64d for ARM&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 74d6824790616f3a997783b65d3c5e0af4a1566e&lt;/p&gt;</comment>
                            <comment id="244990" author="gerrit" created="Mon, 1 Apr 2019 06:36:49 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/34432/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/34432/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: skip sanity test_64d for ARM&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 946764287309a274fa805d930e4f1126d4a66570&lt;/p&gt;</comment>
                            <comment id="262752" author="gerrit" created="Thu, 6 Feb 2020 16:41:01 +0000"  >&lt;p&gt;James Nunez (jnunez@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37463&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37463&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: skip sanity tests for PPC&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 1916b688570501112977b7062c3affcf13a6aaaa&lt;/p&gt;</comment>
                            <comment id="265075" author="gerrit" created="Wed, 11 Mar 2020 07:01:11 +0000"  >&lt;p&gt;Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37876&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37876&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: wait for grant to stop changing&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: fd1d4176367a33eccd2f0715de8e0abf4fcd4996&lt;/p&gt;</comment>
                            <comment id="266381" author="gerrit" created="Tue, 31 Mar 2020 06:59:28 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/37876/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37876/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: wait for grant to stop changing&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 75ebfa0b924a41d15aea026dc9a29bec39d1419a&lt;/p&gt;</comment>
                            <comment id="286035" author="gerrit" created="Wed, 25 Nov 2020 22:02:08 +0000"  >&lt;p&gt;James Simmons (jsimmons@infradead.org) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/40758&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/40758&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; tests: re-enable sanity grant test for ARM&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: b11e62e18bbdb56102f872c8c3aeefb2faa0e799&lt;/p&gt;</comment>
                            <comment id="311514" author="xinliang" created="Mon, 30 Aug 2021 10:07:57 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=adilger&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Andreas Dilger&lt;/a&gt;&apos;s guess was right. I can make the test pass on arm CentOS8. When changing the write amount to page size align:&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;
@@ -5091,7 +5091,7 @@ test_42a() {
        sync; sleep 1; sync # just to be safe
        BEFOREWRITES=`count_ost_writes`
         lctl get_param -n osc.*[oO][sS][cC][_-]*.cur_grant_bytes | grep &lt;span class=&quot;code-quote&quot;&gt;&quot;[0-9]&quot;&lt;/span&gt;
-        dd &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;=/dev/zero of=$DIR/f42a bs=1024 count=100
+        dd &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt;=/dev/zero of=$DIR/f42a bs=$PAGE_SIZE count=2
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;And looking into the client end grant calculation code, it likely related to this part code:&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;
 830 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; osc_extent_finish(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct lu_env *env, struct osc_extent *ext,
 831                       &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; sent, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; rc)
 832 {
...
 865         } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (blocksize &amp;lt; PAGE_SIZE &amp;amp;&amp;amp;
 866                    last_count != PAGE_SIZE) {
 867                 /* For &lt;span class=&quot;code-object&quot;&gt;short&lt;/span&gt; writes we shouldn&apos;t count parts of pages that
 868                  * span a whole chunk on the OST side, or our accounting goes
 869                  * wrong.  Should match the code in filter_grant_check. */
 870                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; offset = last_off &amp;amp; ~PAGE_MASK;
 871                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; count = last_count + (offset &amp;amp; (blocksize - 1));
 872                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; end = (offset + last_count) &amp;amp; (blocksize - 1);
 873                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (end)
 874                         count += blocksize - end;
 875
 876                 lost_grant = PAGE_SIZE - count;
 877         }
 878         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ext-&amp;gt;oe_grants &amp;gt; 0)
 879                 osc_free_grant(cli, nr_pages, lost_grant, ext-&amp;gt;oe_grants);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This part code will never go into on x86_64 as page size and block size are always 4k.&#160;But this part code looks doesn&apos;t match the sever end related code of tgt_grant_check() on Arm RHEL/CentOS, the blocksize seems always 4k, but&#160; page size is 64k on Arm RHEL/CentOS:&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;
 645 &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; inline u64 tgt_grant_rnb_size(struct obd_export *exp,
 646                                      struct lu_target *lut,
 647                                      struct niobuf_remote *rnb)
 648 {
...
 659
 660         /* The network buffer might span several blocks, align it on block
 661          * boundaries */
 662         bytes  = rnb-&amp;gt;rnb_offset &amp;amp; (blksize - 1);
 663         bytes += rnb-&amp;gt;rnb_len;
 664         end    = bytes &amp;amp; (blksize - 1);
 665         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (end)
 666                 bytes += blksize - end;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;But I have no idea how to fix now. Please give me some help, thanks.&lt;/p&gt;</comment>
                            <comment id="311620" author="adilger" created="Mon, 30 Aug 2021 22:00:05 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=xinliang&quot; class=&quot;user-hover&quot; rel=&quot;xinliang&quot;&gt;xinliang&lt;/a&gt;, thanks for looking into this. Strictly speaking, the grant is related to the amount of space consumed in the back-end filesystem, which is usually in 4KB multiples (blocksize).  The reason that PAGE_SIZE is involved is because the client VM cannot track cached dirty data of less than a full page.  As a result, the 64KB clients will need to send 64KB writes, even though only a byte of data was modified in the page.  This will consume more of the client grant to dirty the page, but if there is still free space in the OST it will receive replacement grant in the RPC reply.&lt;/p&gt;

&lt;blockquote&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;Should match the code in filter_grant_check.
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;The &lt;tt&gt;filter_grant_check()&lt;/tt&gt; function doesn&apos;t exist anymore, and was replaced by &lt;tt&gt;tgt_grant_check()&lt;/tt&gt;, as you mentioned.  If you are updating this code, please also fix this comment.&lt;/p&gt;

&lt;p&gt;It looks like the server code is more focussed on handling the case of request size &amp;lt; blocksize (ZFS), compared to request size &amp;gt; blocksize (the common case).  Where this &lt;em&gt;might&lt;/em&gt; be going wrong is writes at the end of the file, since &lt;tt&gt;osc_extent_finish()&lt;/tt&gt; is not consuming a whole page worth of grant if the end of file is 4KB * N less than the full PAGE_SIZE?&lt;/p&gt;</comment>
                            <comment id="312586" author="xinliang" created="Mon, 13 Sep 2021 01:39:48 +0000"  >&lt;p&gt;Hi&#160;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=adilger&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Andreas Dilger&lt;/a&gt;, thanks for the explanation about grant, will update the comment when send the fixed patch.&lt;/p&gt;

&lt;p&gt;After looking into the code and git log, I found that starting from this commit (bd1e41672c &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2049&quot; title=&quot;add support for OBD_CONNECT_GRANT_PARAM&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2049&quot;&gt;&lt;del&gt;LU-2049&lt;/del&gt;&lt;/a&gt; grant: add support for OBD_CONNECT_GRANT_PARAM), this OSC part code,&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;
 830 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; osc_extent_finish(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct lu_env *env, struct osc_extent *ext,
 831                       &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; sent, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; rc)
 832 {
...
 865         } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (blocksize &amp;lt; PAGE_SIZE &amp;amp;&amp;amp;
 866                    last_count != PAGE_SIZE) {
 867                 /* For &lt;span class=&quot;code-object&quot;&gt;short&lt;/span&gt; writes we shouldn&apos;t count parts of pages that
 868                  * span a whole chunk on the OST side, or our accounting goes
 869                  * wrong.  Should match the code in filter_grant_check. */
 870                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; offset = last_off &amp;amp; ~PAGE_MASK;
 871                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; count = last_count + (offset &amp;amp; (blocksize - 1));
 872                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; end = (offset + last_count) &amp;amp; (blocksize - 1);
 873                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (end)
 874                         count += blocksize - end;
 875
 876                 lost_grant = PAGE_SIZE - count;
 877         }
 878         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ext-&amp;gt;oe_grants &amp;gt; 0)
 879                 osc_free_grant(cli, nr_pages, lost_grant, ext-&amp;gt;oe_grants);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;begins to mismatch the code of OST tgt_grant_check&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;
708 &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; void tgt_grant_check(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; struct lu_env *env, struct obd_export *exp,
 709                             struct obdo *oa, struct niobuf_remote *rnb,
 710                             &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; niocount, u64 *left)
 711 {
...
 716         unsigned &lt;span class=&quot;code-object&quot;&gt;long&lt;/span&gt;            ungranted = 0;
 717         unsigned &lt;span class=&quot;code-object&quot;&gt;long&lt;/span&gt;            granted = 0;
...
 740         } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (exp_grant_param_supp(exp) &amp;amp;&amp;amp; oa-&amp;gt;o_grant_used &amp;gt; 0) {
 741                 /* Client supports the &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; grant parameters and is telling us
 742                  * how much grant space it consumed &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; bulk write.
 743                  * Although all rnbs are supposed to have the OBD_BRW_FROM_GRANT
 744                  * flag set, we will scan the rnb list and looks &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; non-cache
 745                  * I/O in &lt;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; it changes in the &lt;span class=&quot;code-keyword&quot;&gt;future&lt;/span&gt; */
 746                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ted-&amp;gt;ted_grant &amp;gt;= oa-&amp;gt;o_grant_used) {
 747                         /* skip grant accounting &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; rnbs with
 748                          * OBD_BRW_FROM_GRANT and just used grant consumption
 749                          * claimed in the request */
 750                         granted = oa-&amp;gt;o_grant_used;
 751                         skip = &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;;
 752                 } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {
 ...
 773         }
774
 775         &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (i = 0; i &amp;lt; niocount; i++) {
 776                 &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; bytes;
 777
 778                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ((rnb[i].rnb_flags &amp;amp; OBD_BRW_FROM_GRANT)) {
 779                         &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (skip) {
 780                                 rnb[i].rnb_flags |= OBD_BRW_GRANTED;
 781                                 &lt;span class=&quot;code-keyword&quot;&gt;continue&lt;/span&gt;;
 782                         }
 ...
 829         }
 830
 831         /* record in o_grant_used the actual space reserved &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the I/O, will be
 832          * used later in tgt_grant_commmit() */
 833         oa-&amp;gt;o_grant_used = granted + ungranted;
 ...
 872 }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;So when client PAGE_SIZE is 64KB bigger than backend file system block size 4KB (Ldiskfs),&lt;/p&gt;

&lt;p&gt;The matched thing should be:&lt;/p&gt;

&lt;p&gt;If both server and client support&#160;OBD_CONNECT_GRANT_PARAM, the lost_grant in&#160;osc_extent_finish should be 0, because server will use&#160;grant consumption&#160;claimed&#160; by the client.&#160;&lt;/p&gt;

&lt;p&gt;And note that, in this case, lost_grant = (client claim o_grant_used) - (OST actual+ o_grant_used)&#160; = 0.&lt;/p&gt;</comment>
                            <comment id="322973" author="gerrit" created="Tue, 18 Jan 2022 09:08:11 +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/40758/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/40758/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11596&quot; title=&quot;sanity test_42d/test_42e: FAIL: failed: client:143294464 server: 143110144&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11596&quot;&gt;&lt;del&gt;LU-11596&lt;/del&gt;&lt;/a&gt; osc: Fix and re-enable sanity grant test for ARM&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 7d3edce0650f0b66bdd280373a54a16cb28b8469&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="48477">LU-10033</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="50419">LU-10571</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="63882">LU-14630</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="55544">LU-12255</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="60200">LU-13838</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="49488">LU-10300</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|i005hj:</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>