From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Liu Kui <kui.liu@virtuozzo.com>
Cc: azaitsev@virtuozzo.com, devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1] fs/fuse kio: build the rdma sgl from folios
Date: Wed, 18 Nov 2026 11:33:32 +0100 [thread overview]
Message-ID: <179499801218.182218.1887587386561945529.b4-review@b4> (raw)
In-Reply-To: <20261118-b4-vstor-155302-sgl-folio-v1-1-30d40962e230@virtuozzo.com>
I won't apply this version, please send v2 with the changes below.
- Take only bvec iterators: for anything else return before the
allocation, so the caller falls back to the copy path.
- Count the extra entries per segment longer than max_seg, without the
"len > it.nr_segs * PAGE_SIZE" shortcut.
- Fix the comments that say "one entry per folio" and "we can't
undercount".
- Message: Fixes: ed62e3c51fa2 ("fs/fuse kio: teach pcs_umem about
hugepage-backed mappings") instead of "the umem hugepage work", and
"Feature: vStorage" as the other pcs commits have.
On Wed, 18 Nov 2026 13:01:15 +0800, Liu Kui wrote:
> + /* a segment never spans folios */
> + len = iov_iter_single_seg_count(&it);
> if (len > end_offset - msg_offset)
> len = end_offset - msg_offset;
>
> - sg_set_page(sg, sbuf->pages[sbuf->pg_cnt++], len, off);
> + /* find the page under the current position, no reference is taken */
> + got = iov_iter_extract_pages(&it, &pp, 1, 1, 0, &off);
This holds for the bvec builders, not for ITER_KVEC, which
iov_iter_extract_pages() accepts. A CS FIEMAP reply read over RDMA
goes rio_submit_rdma_read() -> pcs_rdma_rw_init_from_msg() ->
fiemap_get_iter(), a kvec over the kvmalloc(PCS_FIEMAP_BUFSIZE)
buffer. When kvmalloc() falls back to vmalloc, the extraction returns
the first page only, sg_set_folio() describes the whole reply as
physically contiguous from it, and the RDMA read writes into whatever
pages follow. The old code did not handle kvec either (the -EFAULT of
iov_iter_get_pages2() went into a size_t), but it crashed; now the
memory is silently corrupted.
> + if (len > it.nr_segs * PAGE_SIZE && unlikely(len > max_seg))
> + sbuf->sg_cnt += DIV_ROUND_UP(len, max_seg);
The check compares the total length, so one long segment among many
short ones is missed: with the 64K default max_seg, one 96K hugepage
segment plus enough short segments allocates one entry too few, the
fill loop hits WARN_ON_ONCE() (a panic with panic_on_warn) and falls
back. "if (len > max_seg) sg_cnt += len / max_seg" is a true upper
bound.
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-11-18 10:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 5:01 Liu Kui
2026-11-18 10:33 ` Konstantin Khorenko [this message]
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=179499801218.182218.1887587386561945529.b4-review@b4 \
--to=khorenko@virtuozzo.com \
--cc=azaitsev@virtuozzo.com \
--cc=devel@openvz.org \
--cc=kui.liu@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