<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:28:43 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-16637] ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1</title>
                <link>https://jira.whamcloud.com/browse/LU-16637</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;truncate_inode_pages() is required to be called under (and serialised by) inode lock, or else  new page could be added in the inode&apos;s page tree even ll_truncate_inode_pages_final() leverages mapping-&amp;gt;i_pages protection to prevent a page is still in the process of deletion (inside __delete_from_page_cache())&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;649346.462967] LustreError: 482172:0:(llite_lib.c:2235:ll_truncate_inode_pages_final()) ASSERTION( nrpages == 0 ) failed: exa5: inode=[0x5c004247c:0x9b:0x0](000000000c1d2c09) nrpages=1, see https://jira.whamcloud.com/browse/LU-118
[649346.483202] LustreError: 482172:0:(llite_lib.c:2235:ll_truncate_inode_pages_final()) LBUG
[649346.491472] Pid: 482172, comm: nsmb6.09.23.mpi 4.18.0-348.12.2.el8_5.x86_64 #1 SMP Wed Jan 19 17:53:40 UTC 2022
[649346.501648] Call Trace TBD:
[649346.504644] [&amp;lt;0&amp;gt;] libcfs_call_trace+0x6f/0x90 [libcfs]
[649346.509880] [&amp;lt;0&amp;gt;] lbug_with_loc+0x43/0x80 [libcfs]
[649346.514891] [&amp;lt;0&amp;gt;] ll_truncate_inode_pages_final+0xa7/0xe0 [lustre]
[649346.521185] [&amp;lt;0&amp;gt;] vvp_prune+0x178/0x1d0 [lustre]
[649346.525932] [&amp;lt;0&amp;gt;] cl_object_prune+0x51/0x110 [obdclass]
[649346.531263] [&amp;lt;0&amp;gt;] lov_conf_set+0x5ad/0xa90 [lov]
[649346.536007] [&amp;lt;0&amp;gt;] cl_conf_set+0x59/0x110 [obdclass]
[649346.540995] [&amp;lt;0&amp;gt;] ll_layout_conf+0x13e/0x3d0 [lustre]
[649346.546160] [&amp;lt;0&amp;gt;] ll_layout_refresh+0x581/0x980 [lustre]
[649346.551588] [&amp;lt;0&amp;gt;] vvp_io_init+0x225/0x370 [lustre]
[649346.556502] [&amp;lt;0&amp;gt;] cl_io_init0.isra.15+0x84/0x130 [obdclass]
[649346.562186] [&amp;lt;0&amp;gt;] ll_fault_io_init+0x1cf/0x430 [lustre]
[649346.567527] [&amp;lt;0&amp;gt;] ll_fault+0x222/0x900 [lustre]
[649346.572158] [&amp;lt;0&amp;gt;] __do_fault+0x38/0xb0
[649346.576000] [&amp;lt;0&amp;gt;] do_fault+0x1a0/0x3c0
[649346.579851] [&amp;lt;0&amp;gt;] __handle_mm_fault+0x4d5/0x820
[649346.584473] [&amp;lt;0&amp;gt;] handle_mm_fault+0xbe/0x1e0
[649346.588836] [&amp;lt;0&amp;gt;] __do_page_fault+0x1ed/0x4c0
[649346.593289] [&amp;lt;0&amp;gt;] do_page_fault+0x37/0x130
[649346.597478] [&amp;lt;0&amp;gt;] page_fault+0x1e/0x30
[649346.601326] Kernel panic - not syncing: LBUG
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="75023">LU-16637</key>
            <summary>ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1</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="bobijam">Zhenyu Xu</reporter>
                        <labels>
                    </labels>
                <created>Mon, 13 Mar 2023 15:29:09 +0000</created>
                <updated>Fri, 26 Jan 2024 17:15:36 +0000</updated>
                            <resolved>Tue, 23 Jan 2024 13:32:13 +0000</resolved>
                                                    <fixVersion>Lustre 2.16.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>9</watches>
                                                                            <comments>
                            <comment id="365821" author="gerrit" created="Tue, 14 Mar 2023 02:21:17 +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/+/50284&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50284&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: call truncate_inode_pages() under inode lock&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 8d7eba935a6117e3afa8dd951358172fb14f08b7&lt;/p&gt;</comment>
                            <comment id="366781" author="gerrit" created="Tue, 21 Mar 2023 23:34:58 +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/+/50284/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50284/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: call truncate_inode_pages() under inode lock&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: ef9be34478036db0544753e33030fff7e32bfe44&lt;/p&gt;</comment>
                            <comment id="366849" author="bobijam" created="Wed, 22 Mar 2023 08:58:32 +0000"  >&lt;p&gt;Noted that in a later kernel (v5.14) commit, and invalidate_lock was added to protect adding page to page cache, we might need to adapt that in new EL version.&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;commit 730633f0b7f951726e87f912a6323641f674ae34
Author:     Jan Kara &amp;lt;jack@suse.cz&amp;gt;
AuthorDate: Thu Jan 28 19:19:45 2021 +0100
Commit:     Jan Kara &amp;lt;jack@suse.cz&amp;gt;
CommitDate: Tue Jul 13 13:14:27 2021 +0200

    mm: Protect operations adding pages to page cache with invalidate_lock
    
    Currently, serializing operations such as page fault, read, or readahead
    against hole punching is rather difficult. The basic race scheme is
    like:
    
    fallocate(FALLOC_FL_PUNCH_HOLE)                 read / fault / ..
      truncate_inode_pages_range()
                                                      &amp;lt;create pages in page
                                                       cache here&amp;gt;
      &amp;lt;update fs block mapping and free blocks&amp;gt;
    
    Now the problem is in this way read / page fault / readahead can
    instantiate pages in page cache with potentially stale data (if blocks
    get quickly reused). Avoiding this race is not simple - page locks do
    not work because we want to make sure there are *no* pages in given
    range. inode-&amp;gt;i_rwsem does not work because page fault happens under
    mmap_sem which ranks below inode-&amp;gt;i_rwsem. Also using it for reads makes
    the performance for mixed read-write workloads suffer.
    
    So create a new rw_semaphore in the address_space - invalidate_lock -
    that protects adding of pages to page cache for page faults / reads /
    readahead.
    
    Reviewed-by: Darrick J. Wong &amp;lt;djwong@kernel.org&amp;gt;
    Reviewed-by: Christoph Hellwig &amp;lt;hch@lst.de&amp;gt;
    Signed-off-by: Jan Kara &amp;lt;jack@suse.cz&amp;gt;

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="367235" author="pjones" created="Fri, 24 Mar 2023 16:37:07 +0000"  >&lt;p&gt;Bobijam&lt;/p&gt;

&lt;p&gt;So does that mean that RHEL9.x clients would require a different fix?&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="367525" author="bobijam" created="Tue, 28 Mar 2023 11:03:19 +0000"  >&lt;p&gt;I guess so, truncate_inode_pages need to acquire invalidate_lock to protect from pages cache filling (fault, read, ...) in kernel &amp;gt; v5.14&lt;/p&gt;</comment>
                            <comment id="368026" author="paf0186" created="Fri, 31 Mar 2023 16:25:08 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=qian_wc&quot; class=&quot;user-hover&quot; rel=&quot;qian_wc&quot;&gt;qian_wc&lt;/a&gt; , do your patches with the invalidate_lock cover this case as well?&lt;/p&gt;</comment>
                            <comment id="369505" author="qian_wc" created="Fri, 14 Apr 2023 15:42:23 +0000"  >&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I originally thought that we need invalidate_lock in the following case:&lt;br/&gt;
There are four place that will delete a page from Lustre:&lt;br/&gt;
1. extent lock blocking AST callback&lt;br/&gt;
2. truncate&lt;br/&gt;
3. punch hole&lt;br/&gt;
4. layout change will prune the pages&lt;/p&gt;

&lt;p&gt;Then I wrote test scripts to verify it, but found that:&lt;br/&gt;
1.  Extent lock blocking AST callback: we solve it in the ticket  &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16651&quot; title=&quot;hold invalidate_lock when invalidating page cache under kernel 5.15+&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16651&quot;&gt;&lt;del&gt;LU-16651&lt;/del&gt;&lt;/a&gt; llite: hold invalidate_lock when invalidate cache pages;&lt;br/&gt;
2. Truncate: For user space truncate() operation, we hole &lt;span class=&quot;error&quot;&gt;&amp;#91;size, EOF&amp;#93;&lt;/span&gt; extent lock for the truncate() operations, thus it is same problem as  Case 1.&lt;br/&gt;
3. punch hole: Lustre currently does not support it.&lt;br/&gt;
4. layout change will prune the pages: we can only change layout when there is no I/O activities (@&amp;amp;lov-&amp;gt;lo_active_ios == 0), so this can also not happen.&lt;/p&gt;

&lt;p&gt;So I think the patch under &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16651&quot; title=&quot;hold invalidate_lock when invalidating page cache under kernel 5.15+&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16651&quot;&gt;&lt;del&gt;LU-16651&lt;/del&gt;&lt;/a&gt; is enough.&lt;br/&gt;
It does not need to hold invalidate_lock in this case for the current Lustre, I think.&lt;/p&gt;</comment>
                            <comment id="371295" author="gerrit" created="Thu, 4 May 2023 03:22:15 +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/+/50857&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50857&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: call truncage_inode_pages() in inode lock&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 94d493f7b99eaa681628f068e8d18979e99fdb26&lt;/p&gt;</comment>
                            <comment id="378054" author="gerrit" created="Sat, 8 Jul 2023 22:41:54 +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/+/50857/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/50857/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: call truncate_inode_pages() in inode lock&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 51d62f2122fee14fbb3ff8333b5a830e1181e4e5&lt;/p&gt;</comment>
                            <comment id="378079" author="pjones" created="Sun, 9 Jul 2023 14:37:28 +0000"  >&lt;p&gt;Landed for 2.16&lt;/p&gt;</comment>
                            <comment id="387847" author="panda" created="Sun, 1 Oct 2023 18:47:36 +0000"  >&lt;p&gt;I&apos;m able to reproduce the assertion failure with the fix in place.&#160;&lt;/p&gt;

&lt;p&gt;The reproducer is the following:&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;
swap()
{
&#160; &#160; &#160; &#160; cd /mnt/lustre

&#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;; &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; lfs swap_layouts f1 f2
&#160; &#160; &#160; &#160; done
}

writedata()
{
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;; &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt;
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; echo -n a
&#160; &#160; &#160; &#160; done &amp;gt; /mnt/lustre/f1
}

touch /mnt/lustre/f1
touch /mnt/lustre/f2

swap &amp;amp;

writedata &amp;amp;
writedata &amp;amp;
writedata &amp;amp;
writedata &amp;amp;
writedata &amp;amp;
writedata &amp;amp;
writedata &amp;amp;
writedata &amp;amp;

wait
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The following change was made to Lustre hash c1ebcb0fa to speed up reproduction:&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;
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index eba1cf4ff51..9542fb98e97 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -3011,6 +3011,8 @@ void ll_truncate_inode_pages_final(struct inode *inode)
&#160;
&#160; &#160; &#160; &#160; truncate_inode_pages_final(mapping);
&#160;
+ &#160; &#160; &#160; udelay(10000);
+
&#160; &#160; &#160; &#160; /* Workaround &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; LU-118: Note nrpages may not be totally updated when
&#160; &#160; &#160; &#160; &#160;* truncate_inode_pages() returns, as there can be a page in the process
&#160; &#160; &#160; &#160; &#160;* of deletion (inside __delete_from_page_cache()) in the specified
diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c
index f3f8101dadc..8fd223a7b1a 100644
--- a/lustre/utils/lfs.c
+++ b/lustre/utils/lfs.c
@@ -10765,8 +10765,8 @@ &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; lfs_swap_layouts(&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; &#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; CMD_HELP;
&#160;
&#160; &#160; &#160; &#160; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; llapi_swap_layouts(argv[1], argv[2], 0, 0,
- &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; SWAP_LAYOUTS_KEEP_MTIME |
- &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; SWAP_LAYOUTS_KEEP_ATIME);
+ &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; /* SWAP_LAYOUTS_KEEP_MTIME |
+ &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; SWAP_LAYOUTS_KEEP_ATIME*/ 0);
&#160;}
&#160;
&#160;&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; ladvise_names[] = LU_LADVISE_NAMES;

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;After a few minutes Lustre panics with:&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;
[ 2104.190146] LustreError: 24712:0:(llite_lib.c:3035:ll_truncate_inode_pages_final()) ASSERTION( nrpages == 0 ) failed: lustre: inode=[0x200000401:0x1:0x0](000000007d0affed) nrpages=1 state 0x5, lli_flags 0x15, see https:&lt;span class=&quot;code-comment&quot;&gt;//jira.whamcloud.com/browse/LU-118
&lt;/span&gt;[ 2104.458673] LustreError: 24712:0:(llite_lib.c:3035:ll_truncate_inode_pages_final()) LBUG
[ 2104.555802] Kernel panic - not syncing: LBUG
[ 2104.606854] CPU: 6 PID: 24712 Comm: bash Kdump: loaded Tainted: G &#160; &#160; &#160; &#160; &#160; OE &#160; &#160;--------- - &#160;- 4.18.0-305.10.2.x6.1.010.21.x86_64 #1
[ 2104.751515] Hardware name: Gigabyte Technology Co., Ltd. P55-US3L/P55-US3L, BIOS FE 03/05/2010
[ 2104.854787] Call Trace:
[ 2104.884121] &#160;dump_stack+0x5c/0x80
[ 2104.923848] &#160;panic+0xe7/0x2a9
[ 2104.959422] &#160;? entry_SYSCALL_64_after_hwframe+0x65/0xca
[ 2105.021930] &#160;lbug_with_loc+0x85/0x90 [libcfs]
[ 2105.074052] &#160;ll_truncate_inode_pages_final+0xd5/0x170 [lustre]
[ 2105.143927] &#160;vvp_prune+0x1c6/0x2a0 [lustre]
[ 2105.193978] &#160;cl_object_prune+0x72/0x140 [obdclass]
[ 2105.251457] &#160;lov_conf_set+0x1c7/0xde0 [lov]
[ 2105.301772] &#160;? batch_send_update_req.constprop.8+0x381/0x8a0 [ptlrpc]
[ 2105.378870] &#160;cl_conf_set+0x7a/0x150 [obdclass]
[ 2105.432215] &#160;ll_layout_conf+0x8b/0x420 [lustre]
[ 2105.486467] &#160;? lock_res_and_lock+0x29/0x50 [ptlrpc]
[ 2105.544846] &#160;? ll_layout_refresh+0x79b/0xa20 [lustre]
[ 2105.605379] &#160;ll_layout_refresh+0x79b/0xa20 [lustre]
[ 2105.663819] &#160;vvp_io_init+0x22a/0x400 [lustre]
[ 2105.716041] &#160;__cl_io_init.isra.13+0x9e/0x170 [obdclass]
[ 2105.778737] &#160;ll_file_io_generic+0x317/0xdf0 [lustre]
[ 2105.838228] &#160;ll_file_write_iter+0x5d4/0x8d0 [lustre]
[ 2105.897596] &#160;? __switch_to_asm+0x35/0x70
[ 2105.944499] &#160;? __switch_to_asm+0x41/0x70
[ 2105.991419] &#160;new_sync_write+0x112/0x160
[ 2106.037378] &#160;vfs_write+0xa5/0x1a0
[ 2106.077099] &#160;ksys_write+0x4f/0xb0
[ 2106.116730] &#160;do_syscall_64+0x5b/0x1a0
[ 2106.160514] &#160;entry_SYSCALL_64_after_hwframe+0x65/0xca
[ 2106.220935] RIP: 0033:0x7f25853f5ba0
[ 2106.263778] Code: 73 01 c3 48 8b 0d d0 72 2d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 1d d4 2d 00 00 75 10 b8 01 00 00 00 0f 05 &amp;lt;48&amp;gt; 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 7e cc 01 00 48 89 04 24
[ 2106.489251] RSP: 002b:00007ffdb6797928 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[ 2106.580144] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f25853f5ba0
[ 2106.665733] RDX: 0000000000000001 RSI: 00007f2585d19000 RDI: 0000000000000001
[ 2106.751223] RBP: 00007f2585d19000 R08: 00007f2585d06740 R09: 00007f25853532cd
[ 2106.836919] R10: 00007f2585d06740 R11: 0000000000000246 R12: 00007f25856ce400
[ 2106.922614] R13: 0000000000000001 R14: 0000000000000000 R15: 00000000026364c2
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;As I wrote in the gerrit review, non-zero page count after truncate is likely the result of&lt;br/&gt;
a read/write/fault running in parallel with truncate. Most obviously, in a write test tiny&lt;br/&gt;
writes add pages to the page cache even though they cannot initialize and run I/O on them.&lt;/p&gt;

&lt;p&gt;It seems, one of the possible solutions is to follow the approach from 9c453ba6d9. Make sure truncates are wrapped with trunc_sem in exclusive mode and reads, writes and faults including their fast paths are wrapped with trunc sem in shared mode.&lt;/p&gt;</comment>
                            <comment id="395290" author="bobijam" created="Mon, 4 Dec 2023 04:26:32 +0000"  >&lt;p&gt;Hi Andrew,&lt;/p&gt;

&lt;p&gt;Is it possibly better to loose the assertion condition to (LASSERTF(nrpages == 0 || nrpages == 1, ...)? I don&apos;t know whether this window would allow more than 1 page be inserted in the page cache, but just observed that all these cases shows only 1 page is in the page cache after tripping the assertion failure.&lt;/p&gt;</comment>
                            <comment id="395329" author="gerrit" created="Mon, 4 Dec 2023 12:33:46 +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/+/53316&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53316&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: page in cache after truncate_inode_pages()&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: e67690e9da79362787c7bf959823fcfe0604dcd8&lt;/p&gt;</comment>
                            <comment id="398053" author="panda" created="Tue, 26 Dec 2023 16:58:55 +0000"  >&lt;p&gt;@bobijam,&lt;/p&gt;

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

&lt;p&gt;I think there can be any number of pages, since you can have any number of parallel read requests, each of them can add a new cache page.&lt;/p&gt;</comment>
                            <comment id="398054" author="gerrit" created="Tue, 26 Dec 2023 17:03:19 +0000"  >&lt;p&gt;&quot;Andrew Perepechko &amp;lt;andrew.perepechko@hpe.com&amp;gt;&quot; uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/c/fs/lustre-release/+/53554&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53554&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: tolerate fresh page cache pages after truncate&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: e9aade50eee736299d08405c1c9e3fee5b5fa8f7&lt;/p&gt;</comment>
                            <comment id="400721" author="gerrit" created="Tue, 23 Jan 2024 05:31:56 +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/+/53554/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/c/fs/lustre-release/+/53554/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-16637&quot; title=&quot;ll_truncate_inode_pages_final() ASSERTION( nrpages == 0 ) failed: ... nrpages=1&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-16637&quot;&gt;&lt;del&gt;LU-16637&lt;/del&gt;&lt;/a&gt; llite: tolerate fresh page cache pages after truncate&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 7bb1e211d217d5a82ac2d5e4edad5ae018090761&lt;/p&gt;</comment>
                            <comment id="400795" author="pjones" created="Tue, 23 Jan 2024 13:32:13 +0000"  >&lt;p&gt;All patches merged for 2.16&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="76968">LU-16958</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="50643" name="8f66968d.diff.zip" size="1474" author="panda" created="Mon, 16 Oct 2023 07:53:57 +0000"/>
                            <attachment id="50642" name="e08812ca.diff.zip" size="1359" author="panda" created="Mon, 16 Oct 2023 07:53:44 +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|i03g5b:</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>