From: Kevin Wolf <kwolf@redhat.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: Hanna Czenczek <hreitz@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PULL 17/28] fuse: Manually process requests (without libfuse)
Date: Mon, 29 Jun 2026 22:17:08 +0200 [thread overview]
Message-ID: <akLSxINM_Udwi4SL@redhat.com> (raw)
In-Reply-To: <526e49ea-03a7-460f-9974-976abf83c6b2@proxmox.com>
Am 29.06.2026 um 15:19 hat Fiona Ebner geschrieben:
> Am 12.05.26 um 5:23 PM schrieb Fiona Ebner:
> > Hi Hanna,
> >
> > Am 08.05.26 um 3:11 PM schrieb Hanna Czenczek:
> >> On 08.05.26 15:06, Hanna Czenczek wrote:
> >>> On 08.05.26 13:55, Fiona Ebner wrote:
> >>>> Dear maintainers,
> >>>>
> >>>> Am 10.03.26 um 6:37 PM schrieb Kevin Wolf:
> >>>>> From: Hanna Czenczek <hreitz@redhat.com>
> >>>>>
> >>>>> Manually read requests from the /dev/fuse FD and process them, without
> >>>>> using libfuse. This allows us to safely add parallel request
> >>>>> processing
> >>>>> in coroutines later, without having to worry about libfuse internals.
> >>>>> (Technically, we already have exactly that problem with
> >>>>> read_from_fuse_export()/read_from_fuse_fd() nesting.)
> >>>>>
> >>>>> We will continue to use libfuse for mounting the filesystem;
> >>>>> fusermount3
> >>>>> is a effectively a helper program of libfuse, so it should know best
> >>>>> how
> >>>>> to interact with it. (Doing it manually without libfuse, while doable,
> >>>>> is a bit of a pain, and it is not clear to me how stable the "protocol"
> >>>>> actually is.)
> >>>>>
> >>>>> Take this opportunity of quite a major rewrite to update the Copyright
> >>>>> line with corrected information that has surfaced in the meantime.
> >>>>
> >>>> a colleague ran into another issue with a fuse export, this time in
> >>>> combination with virt-fw-vars and bisecting points to this patch.
> >>>> Before commit a94a1d7699 ("fuse: Manually process requests (without
> >>>> libfuse)") the reproducer [0] completes successfully, after that
> >>>> commit it hangs at [1]. The issue is still present with current
> >>>> master. I can dig into the details next week.
> >>>
> >>> On my system, virt-fw-vars opens the file with O_TRUNC (after “INFO:
> >>> writing raw edk2 varstore...”). It then tries to write to the file,
> >>> but this returns a short write because the export is not marked as
> >>> growable, and for some reason, the write is infinitely retried instead
> >>> of aborting on ret=0 (which should indicate ENOSPC for writes).
> >>>
> >>> Using growable=true makes it work. (For me :))
> >>>
> >>> For some reason, before said commit, libfuse just did not pass that
> >>> truncate on. I’ll look into why exactly, but so far I would say the
> >>> FUSE export behavior is as I would expect it.
> >>
> >> Ah, I see. libfuse sets FUSE_CAP_ATOMIC_O_TRUNC, which has O_TRUNC be
> >> passed on as an open option, but the old export code just ignored all
> >> open options.
> >>
> >> The new code does not set that option, so O_TRUNC is executed as an
> >> explicit truncate by the kernel, which then *is* executed.
> >
> > thank you for digging into it!
> >
> >> I’m not entirely sure how we should handle it. There is a case to be
> >> made that with growable=off, it may make sense to ignore O_TRUNC (which
> >> requires turning on FUSE_CAP_ATOMIC_O_TRUNC again and then continue to
> >> ignore it). But on the other hand, O_TRUNC is O_TRUNC, and growable=off
> >> does not explicitly mean “please behave as much as a block device as
> >> possible”.
> >>
> >> What do you suggest?
> >
> > It turns out that the missing FUSE_ATOMIC_O_TRUNC flag also regresses
> > exports from block devices, making open() with O_TRUNC fail with
> > EOPNOTSUPP [0], which worked before. Intuitively to me, growable=off
> > feels like it should imply "shrinkable=off" as well.
> >
> > My suggestions would be one of the following, with a preference for 2.:
> >
> > 1. Always set FUSE_ATOMIC_O_TRUNC
> >
> > Most backwards compatible. There is the issue that O_TRUNC does not
> > apply when it's actually a file, which is surprising.
> >
> > 2. Set FUSE_ATOMIC_O_TRUNC if growable=off
> >
> > Feels natural to me. People using growable=on with block device based
> > exports are still affected by the change in behavior.
> >
> > 3. Set FUSE_ATOMIC_O_TRUNC if driver not file-based
> >
> > What should be the exact condition to consider the driver
> > not file-based? Here, O_TRUNC for a growable=off file-based export
> > does apply, which feels surprising to me. Continues breaking the use
> > I reported this issue for, requiring using growable=on in such cases.
> >
> > 4. Set FUSE_ATOMIC_O_TRUNC if growable=off or if driver not file-based
> >
> > Similar to 2., but reduces cases affected by the change in behavior.
>
> Should I go for approach number 2 or do you prefer another one?
Hanna is away for the next two weeks.
I think intuitively, I would expect growable=off to imply more or less
block-device-like semantics, i.e. truncating works, but doesn't do
anything. I think this is what you suggest as option 2, so I'm fine with
that.
Using growable=on on a node that isn't resizeable feels like a user
error, I wouldn't see it as a big problem.
Kevin
next prev parent reply other threads:[~2026-06-29 20:18 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 16:25 [PULL 00/28] Block layer patches Kevin Wolf
2026-03-10 16:25 ` [PULL 01/28] fuse: Copy write buffer content before polling Kevin Wolf
2026-03-10 16:25 ` [PULL 02/28] fuse: Ensure init clean-up even with error_fatal Kevin Wolf
2026-03-10 16:25 ` [PULL 03/28] fuse: Remove superfluous empty line Kevin Wolf
2026-03-10 16:25 ` [PULL 04/28] fuse: Explicitly set inode ID to 1 Kevin Wolf
2026-03-10 16:25 ` [PULL 05/28] fuse: Change setup_... to mount_fuse_export() Kevin Wolf
2026-03-10 16:26 ` [PULL 06/28] fuse: Destroy session on mount_fuse_export() fail Kevin Wolf
2026-03-10 16:26 ` [PULL 07/28] fuse: Fix mount options Kevin Wolf
2026-03-10 16:26 ` [PULL 08/28] fuse: Set direct_io and parallel_direct_writes Kevin Wolf
2026-04-30 13:07 ` Fiona Ebner
2026-05-05 9:03 ` Fiona Ebner
2026-05-05 11:01 ` Fiona Ebner
2026-05-05 13:21 ` Hanna Czenczek
2026-03-10 16:26 ` [PULL 09/28] fuse: Introduce fuse_{at,de}tach_handlers() Kevin Wolf
2026-03-10 16:26 ` [PULL 10/28] fuse: Introduce fuse_{inc,dec}_in_flight() Kevin Wolf
2026-03-10 16:26 ` [PULL 11/28] fuse: Add halted flag Kevin Wolf
2026-03-10 16:26 ` [PULL 12/28] fuse: fuse_{read,write}: Rename length to blk_len Kevin Wolf
2026-03-10 16:26 ` [PULL 13/28] iotests/308: Use conv=notrunc to test growability Kevin Wolf
2026-03-10 16:26 ` [PULL 14/28] fuse: Explicitly handle non-grow post-EOF accesses Kevin Wolf
2026-03-10 16:26 ` [PULL 15/28] block: Move qemu_fcntl_addfl() into osdep.c Kevin Wolf
2026-03-10 16:26 ` [PULL 16/28] fuse: Drop permission changes in fuse_do_truncate Kevin Wolf
2026-03-10 16:26 ` [PULL 17/28] fuse: Manually process requests (without libfuse) Kevin Wolf
2026-05-08 11:55 ` Fiona Ebner
2026-05-08 13:06 ` Hanna Czenczek
2026-05-08 13:13 ` Hanna Czenczek
2026-05-12 15:14 ` Fiona Ebner
2026-06-29 13:19 ` Fiona Ebner
2026-06-29 20:17 ` Kevin Wolf [this message]
2026-03-10 16:26 ` [PULL 18/28] fuse: Reduce max read size Kevin Wolf
2026-03-10 16:26 ` [PULL 19/28] fuse: Process requests in coroutines Kevin Wolf
2026-03-10 16:26 ` [PULL 20/28] block/export: Add multi-threading interface Kevin Wolf
2026-03-10 16:26 ` [PULL 21/28] iotests/307: Test multi-thread export interface Kevin Wolf
2026-03-10 16:26 ` [PULL 22/28] fuse: Make shared export state atomic Kevin Wolf
2026-03-10 16:26 ` [PULL 23/28] fuse: Implement multi-threading Kevin Wolf
2026-03-10 16:26 ` [PULL 24/28] qapi/block-export: Document FUSE's multi-threading Kevin Wolf
2026-03-10 16:26 ` [PULL 25/28] iotests/308: Add multi-threading sanity test Kevin Wolf
2026-03-10 16:26 ` [PULL 26/28] block/nfs: add support for libnfs v6 Kevin Wolf
2026-03-12 9:41 ` Peter Maydell
2026-03-12 16:12 ` Kevin Wolf
2026-03-12 16:19 ` Peter Maydell
2026-03-12 16:47 ` Kevin Wolf
2026-03-20 9:50 ` Peter Maydell
2026-04-09 9:48 ` Peter Maydell
2026-04-09 13:29 ` Kevin Wolf
2026-03-10 16:26 ` [PULL 27/28] qapi: block: Refactor HTTP(s) common arguments Kevin Wolf
2026-03-10 16:26 ` [PULL 28/28] block/curl: add support for S3 presigned URLs Kevin Wolf
2026-03-11 10:43 ` [PULL 00/28] Block layer patches Peter Maydell
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=akLSxINM_Udwi4SL@redhat.com \
--to=kwolf@redhat.com \
--cc=f.ebner@proxmox.com \
--cc=hreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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