From: Matt Ochs <mochs@nvidia.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Bernd Schubert <bschubert@ddn.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v3] fuse: back uncached readdir buffers with pages
Date: Fri, 22 May 2026 01:32:25 +0000 [thread overview]
Message-ID: <3447B6B6-7D86-4058-ABCF-B093BEB5D391@nvidia.com> (raw)
In-Reply-To: <CAJfpegsJ+ZQW_WteMypErq31hggYsMMkBOPd0o+vifhAS6dPvQ@mail.gmail.com>
Hi Miklos,
> On May 19, 2026, at 10:41, Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Tue, 19 May 2026 at 17:34, Matt Ochs <mochs@nvidia.com> wrote:
>
>> With out_pages but without the byte-size cap, fuse_simple_request()
>> still returned -ENOMEM. Capping the request to 1048576 bytes / 16 pages
>> made the same test pass.
>
> Can you tell why is it failing now?
I tracked down where the remaining -ENOMEM comes from.
For the failing READDIR request, kernel-side instrumentation shows:
READDIR out_size=8126464 num_folios=124 total_sgs=127
copy_args_to_argbuf: num_in=1 num_out=0 len=40
virtqueue_add_sgs: ok
completion: out_error=-12 out_len=16
So the output is page backed, the argbuf only contains the 40-byte input
argument, and the virtqueue submission succeeds. The -ENOMEM is coming back
from virtiofsd.
The remaining failure is the virtiofsd READDIR/READDIRPLUS range check.
Virtiofsd advertises:
max_write = MAX_BUFFER_SIZE
max_pages = ceil(MAX_BUFFER_SIZE / host_page_size)
and then rejects READDIR/READDIRPLUS if the requested size is larger than
MAX_BUFFER_SIZE.
On the failing setup the host is 4K and the guest is 64K. The guest ends up
with fc->max_pages=124 after the virtqueue-size cap, so uncached READDIR asks
for:
124 * 65536 = 8126464 bytes
That exceeds virtiofsd's MAX_BUFFER_SIZE of 1048576 bytes, so virtiofsd
returns ENOMEM before doing the directory read. On a 64K host this is masked
because virtiofsd advertises max_pages=16, keeping the guest request at 1MiB.
Given that, I agree the generic FUSE patch should not include the max_write
cap. I'll send a v4 that only backs uncached readdir with output pages.
For the remaining virtiofsd issue, does capping the local READDIR response
size in virtiofsd sound like the right direction? READDIR can return less
than requested, so treating MAX_BUFFER_SIZE as the maximum chunk to produce
seems preferable to rejecting an otherwise valid request.
-matt
next prev parent reply other threads:[~2026-05-22 1:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 0:47 Matthew R. Ochs
2026-05-19 10:04 ` Miklos Szeredi
2026-05-19 15:34 ` Matt Ochs
2026-05-19 15:41 ` Miklos Szeredi
2026-05-22 1:32 ` Matt Ochs [this message]
2026-06-10 12:22 ` 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=3447B6B6-7D86-4058-ABCF-B093BEB5D391@nvidia.com \
--to=mochs@nvidia.com \
--cc=bschubert@ddn.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®