From: Miklos Szeredi <mszeredi@redhat.com>
To: fuse-devel@lists.linux.dev, virtualization@lists.linux.dev
Cc: Li Wang <liwang@kylinos.cn>,
German Maglione <gmaglione@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 1/5] virtiofs: fix DAX range leak on unmount
Date: Thu, 26 Nov 2026 15:47:14 +0100 [thread overview]
Message-ID: <20261126144719.232329-1-mszeredi@redhat.com> (raw)
generic_shutdown_super() clears SB_ACTIVE before calling evict_inodes(),
so at unmount time fuse_evict_inode() skipped fuse_vdax_inode_cleanup()
for every remaining inode. The DAX ranges owned by those inodes stay on
fc->vdax->busy_ranges instead of being returned to the free pool, and
fuse_vdax_conn_free() only frees free_ranges before kfree()ing the
connection, so the busy fuse_dax_mapping objects are leaked. Nothing
warns about it: fuse_free_inode() kfree()s fi->vdax without checking
that the interval tree is empty.
Call fuse_vdax_inode_cleanup() regardless of SB_ACTIVE. That is what
virtio_fs_conn_destroy() has always assumed ("Soon evict_inodes() will
be called which will free all memory ranges belonging to all inodes").
Unlike the FORGET in the same block, which is pointless once DESTROY has
been sent, the DAX cleanup is the only thing there that owns memory.
On a full unmount virtio_fs_conn_destroy() has already run by the time
evict_inodes() is called, so the FUSE_REMOVEMAPPING requests sent by
fuse_vdax_inode_cleanup() fail with -ENOTCONN, which
inode_reclaim_dmap_range() ignores. On a submount unmount the
connection is still alive and those requests are both valid and needed.
Fixes: c2d0ad00d948 ("virtiofs: implement dax read/write operations")
Cc: <stable@vger.kernel.org>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-3b38f8c0-5e4a-4c21-87a6-4f96cc3cf147
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
fs/fuse/inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 20fbc99f3590..344fcb55a64b 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -150,11 +150,16 @@ static void fuse_evict_inode(struct inode *inode)
truncate_inode_pages_final(&inode->i_data);
clear_inode(inode);
+ /*
+ * Must be done unconditionally: the DAX ranges owned by this inode
+ * are freed nowhere else, so skipping this on an inactive
+ * superblock would leak them.
+ */
+ if (FUSE_IS_VDAX(inode))
+ fuse_vdax_inode_cleanup(inode);
if (inode->i_sb->s_flags & SB_ACTIVE) {
struct fuse_conn *fc = get_fuse_conn(inode);
- if (FUSE_IS_VDAX(inode))
- fuse_vdax_inode_cleanup(inode);
if (fi->nlookup) {
fuse_chan_queue_forget(fc->chan, fi->forget, fi->nodeid,
fi->nlookup);
--
2.56.1
next reply other threads:[~2026-11-26 14:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 14:47 Miklos Szeredi [this message]
2026-11-26 14:47 ` [PATCH 2/5] virtiofs: don't abort DAX removemapping on allocation failure Miklos Szeredi
2026-11-26 14:47 ` [PATCH 3/5] virtiofs: retry request submission from the worker on -ENOMEM Miklos Szeredi
2026-11-26 14:47 ` [PATCH 4/5] virtiofs: abort the connection if the server fails to unmap a DAX range Miklos Szeredi
2026-11-26 14:47 ` [PATCH 5/5] virtiofs: fix forget leak on submount unmount Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126144719.232329-1-mszeredi@redhat.com \
--to=mszeredi@redhat.com \
--cc=fuse-devel@lists.linux.dev \
--cc=gmaglione@redhat.com \
--cc=liwang@kylinos.cn \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox