<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I don't think this is necessary,&nbsp; vStorage doesn't do invalidate_file on a directory, if we want to guard against mistake from user space</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
it's better to add following check:</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
index ea158367a1ef..f2c6b9e13052 100644</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--- a/fs/fuse/inode.c</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
+++ b/fs/fuse/inode.c</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
@@ -667,6 +667,9 @@ int fuse_invalidate_files(struct fuse_dev *fud, u64 nodeid)</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
&nbsp; &nbsp; &nbsp; &nbsp; if (!inode)</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -ENOENT;</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
+ &nbsp; &nbsp; &nbsp; if (!S_ISREG(inode.i_mode))</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -EOPNOTSUPP;</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
+</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
&nbsp; &nbsp; &nbsp; &nbsp; fi = get_fuse_inode(inode);</div>
<div id="appendonsend"></div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg">
<div style="direction: ltr; font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<b>From:</b>&nbsp;Konstantin Khorenko &lt;khorenko@virtuozzo.com&gt;<br>
<b>Sent:</b>&nbsp;06 July 2026 20:38<br>
<b>To:</b>&nbsp;Alexey Kuznetsov &lt;kuznet@virtuozzo.com&gt;; Kui Liu &lt;kui.liu@virtuozzo.com&gt;<br>
<b>Cc:</b>&nbsp;OpenVZ devel list &lt;devel@openvz.org&gt;<br>
<b>Subject:</b>&nbsp;Re: [PATCH vz10 02/24] fuse: don't wake page_waitq for non-regular inodes in the invalidate worker</div>
<div style="direction: ltr;">&nbsp;</div>
</div>
<div style="font-size: 11pt;">Guys, please, review the patch.<br>
<br>
--<br>
Best regards,<br>
<br>
Konstantin Khorenko,<br>
Virtuozzo Linux Kernel Team<br>
<br>
On 7/6/26 12:59, Konstantin Khorenko wrote:<br>
&gt; fi-&gt;page_waitq lives in an anonymous union in struct fuse_inode that is only valid for regular files; for a directory the same storage holds the readdir cache (fi-&gt;rdc, including rdc.lock). fuse_inval_files_work(), handling FUSE_NOTIFY_INVAL_FILES, called
 wake_up(&amp;fi-&gt;page_waitq) for whatever inode the notification targeted -- including directories such as the mount root. Waking page_waitq on a directory walks readdir-cache fields as a wait-queue list.<br>
&gt;<br>
&gt; On a production kernel this stays silent until the directory has been readdir'd (page_waitq.head overlaps rdc.iversion/rdc.lock); once readdir has cached data an INVAL_FILES for that directory walks rdc.iversion as a list pointer -&gt; GPF, with rdc.mtime acting
 as the 'lock' -&gt; lockup. On a lockdep kernel (64-byte spinlock_t) page_waitq.head.next overlaps rdc.lock.dep_map.name exactly, so it faults on the first directory INVAL_FILES, dereferencing the &quot;&amp;fi-&gt;rdc.lock&quot; rodata string as a wait_queue_entry (GPF at a
 non-canonical ASCII address in the fuse_inval_files_work worker).<br>
&gt;<br>
&gt; All page_waitq waiters (fuse_release, fuse_wait_on_page_writeback, fuse_set_nowrite) and wakers are regular files, so guard the worker's wake_up() with S_ISREG(). fuse_init_file_inode() already initialises page_waitq for every regular-file inode, so no alloc-time
 init is needed.<br>
&gt;<br>
&gt; Fixes: 2604b00b9f44 (&quot;fuse: skip waiting for fuse writeback&quot;)<br>
&gt; Feature: vStorage<br>
&gt; <a href="https://virtuozzo.atlassian.net/browse/VSTOR-137234" id="OWAa5f69b28-1501-2d0d-9d08-6e1514fdd932" class="OWAAutoLink" data-auth="NotApplicable">
https://virtuozzo.atlassian.net/browse/VSTOR-137234</a><br>
&gt; Signed-off-by: Konstantin Khorenko &lt;khorenko@virtuozzo.com&gt;<br>
&gt; ---<br>
&gt;&nbsp; fs/fuse/inode.c | 11 ++++++++++-<br>
&gt;&nbsp; 1 file changed, 10 insertions(+), 1 deletion(-)<br>
&gt;<br>
&gt; diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c<br>
&gt; index ea158367a1ef..26c0014ccf0f 100644<br>
&gt; --- a/fs/fuse/inode.c<br>
&gt; +++ b/fs/fuse/inode.c<br>
&gt; @@ -632,7 +632,16 @@ static void fuse_inval_files_work(struct work_struct *w)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fuse_revoke_readpages(ff);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spin_unlock(&amp;fi-&gt;lock);<br>
&gt;&nbsp;<br>
&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wake_up(&amp;fi-&gt;page_waitq); /* readpage[s] can wait on fuse wb */<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * page_waitq lives in a union in struct fuse_inode that is only<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * valid for regular files; on a directory those bytes are the<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * readdir cache (fi-&gt;rdc, incl. rdc.lock), so waking it up walks<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * readdir-cache fields as a waitqueue list. All page_waitq<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * waiters (readpage[s] waiting on fuse writeback) are regular<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * files, so only wake it for those.<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (S_ISREG(fi-&gt;inode.i_mode))<br>
&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wake_up(&amp;fi-&gt;page_waitq); /* readpage[s] can wait on fuse wb */<br>
&gt;&nbsp;<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; truncate_pagecache_range(&amp;fi-&gt;inode, 0, -1);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fuse_invalidate_attr(&amp;fi-&gt;inode);<br>
<br>
</div>
</body>
</html>