From: Liu Kui <kui.liu@virtuozzo.com>
To: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: azaitsev@virtuozzo.com, devel@openvz.org,
Liu Kui <kui.liu@virtuozzo.com>
Subject: [Devel] [PATCH hci-8.0 1/2] Revert "fs/fuse: fix fuse file refcount leak on close_wait writeback"
Date: Wed, 23 Sep 2026 20:50:40 +0800 [thread overview]
Message-ID: <20260923-vstor-145614-unify-v1-1-3907084ba107@virtuozzo.com> (raw)
In-Reply-To: <20260923-vstor-145614-unify-v1-0-3907084ba107@virtuozzo.com>
This reverts commit 4c648a077765fdb61aa1298ecb8205b629411fed.
The fix addressed the fuse file refcount leak on close_wait writeback
by moving the wpa's reference acquisition from allocation time back to
submit/promotion time, so that wpas freed without passing through
fuse_writepage_finish() own no reference. Revert it in favor of the
following patch, which fixes the leak while keeping the allocation-time
ownership model of mainline commit 4046d3adcca4 ("fuse: move fuse file
initialization to wpa allocation time") unmodified.
https://virtuozzo.atlassian.net/browse/VSTOR-145614
Signed-off-by: Liu Kui <kui.liu@virtuozzo.com>
---
fs/fuse/file.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 50d3f8186d39..180f60fc539a 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2181,7 +2181,7 @@ static ssize_t fuse_splice_write(struct pipe_inode_info *pipe, struct file *out,
static void fuse_writepage_free(struct fuse_writepage_args *wpa)
{
struct fuse_args_pages *ap = &wpa->ia.ap;
- struct fuse_conn *fc = get_fuse_conn(wpa->inode);
+ struct fuse_conn *fc = wpa->ia.ff->fm->fc;
int i;
if (wpa->bucket)
@@ -2374,7 +2374,6 @@ static void fuse_writepage_end(struct fuse_mount *fm, struct fuse_args *args,
wpa->next = next->next;
next->next = NULL;
- next->ia.ff = fuse_file_get(wpa->ia.ff);
tree_insert(&fi->writepages, next);
/*
@@ -2524,7 +2523,7 @@ static struct fuse_writepage_args *fuse_writepage_args_setup(struct folio *folio
fuse_write_args_fill(&wpa->ia, ff, inode, folio_pos(folio), 0);
wpa->ia.write.in.write_flags |= FUSE_WRITE_CACHE;
wpa->inode = inode;
- wpa->ia.ff = NULL;
+ wpa->ia.ff = ff;
ap = &wpa->ia.ap;
ap->args.in_pages = true;
@@ -2562,7 +2561,6 @@ static int fuse_writepage_locked(struct folio *folio)
if (!wpa)
goto err_writepage_args;
- wpa->ia.ff = ff;
ap = &wpa->ia.ap;
ap->num_pages = 1;
@@ -2630,7 +2628,6 @@ static void fuse_writepages_send(struct fuse_fill_wb_data *data)
int num_pages = wpa->ia.ap.num_pages;
int i;
- wpa->ia.ff = fuse_file_get(data->ff);
spin_lock(&fi->lock);
list_add_tail(&wpa->queue_entry, &fi->queued_writes);
fuse_flush_writepages(inode);
@@ -2794,6 +2791,7 @@ static int fuse_writepages_fill(struct folio *folio,
folio_redirty_for_writepage(wbc, folio);
goto out_unlock;
}
+ fuse_file_get(wpa->ia.ff);
data->max_pages = 1;
ap = &wpa->ia.ap;
--
Git-155)
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-09-23 12:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 12:50 [Devel] [PATCH hci-8.0 0/2] fs/fuse: unify dropping the fuse file reference of a writeback request Liu Kui
2026-09-23 12:50 ` Liu Kui [this message]
2026-09-23 12:50 ` [Devel] [PATCH hci-8.0 2/2] " Liu Kui
2026-09-23 17:26 ` Konstantin Khorenko
2026-09-23 17:01 ` [Devel] [PATCH hci-8.0 0/2] " Konstantin Khorenko
2026-09-23 17:13 ` Konstantin Khorenko
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=20260923-vstor-145614-unify-v1-1-3907084ba107@virtuozzo.com \
--to=kui.liu@virtuozzo.com \
--cc=azaitsev@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
/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