OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
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.1 1/2] fs/fuse kio: don't spin on an empty iter in do_sockio_sendmsg()
Date: Thu, 01 Oct 2026 11:23:41 +0800	[thread overview]
Message-ID: <20261001-sockio-sendmsg-empty-iter-v1-1-b876f4fbb9c7@virtuozzo.com> (raw)
In-Reply-To: <20261001-sockio-sendmsg-empty-iter-v1-0-b876f4fbb9c7@virtuozzo.com>

If msg->get_iter() ever returns an empty iterator, do_sockio_sendmsg()
spins forever. Restore the old do_send_one_seg() behavior: warn and
fail the msg.

https://virtuozzo.atlassian.net/browse/VSTOR-142167

Fixes: 32b44dc7ba67 ("fs/fuse kio: refactor transmit path in pcs_sockio_send()")
Signed-off-by: Liu Kui <kui.liu@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_sock_io.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_sock_io.c b/fs/fuse/kio/pcs/pcs_sock_io.c
index 2da6d51c898b..b4a2ceeb331c 100644
--- a/fs/fuse/kio/pcs/pcs_sock_io.c
+++ b/fs/fuse/kio/pcs/pcs_sock_io.c
@@ -307,6 +307,11 @@ static int do_sockio_sendmsg(struct pcs_sockio *sio, struct pcs_msg *msg)
 		if (!iov_iter_count(it)) {
 			/* Current iter is exhausted, init new one */
 			msg->get_iter(msg, sio->write_offset, it, WRITE);
+			/* An empty iter here would spin this loop forever */
+			if (WARN_ON(!iov_iter_count(it))) {
+				clear_and_wake_up_bit(PCS_MSG_BUSY, &msg->flags);
+				return -PCS_ERR_NET_ABORT;
+			}
 		}
 
 		BUG_ON(iov_iter_count(it) > left);

-- 
Git-155)

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-10-01  3:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  3:23 [Devel] [PATCH hci-8.1 0/2] fs/fuse kio: two fixes for the sockio transmit refactor Liu Kui
2026-10-01  3:23 ` Liu Kui [this message]
2026-10-01  3:26   ` [Devel] [PATCH hci-8.1 1/2] fs/fuse kio: don't spin on an empty iter in do_sockio_sendmsg() no-reply
2026-10-01  3:23 ` [Devel] [PATCH hci-8.1 2/2] fs/fuse kio: check every touched page in iov_iter_sendpages_ok() Liu Kui
2026-10-01  3:26   ` no-reply
2026-10-01 12:05 ` [Devel] [PATCH hci-8.1 0/2] fs/fuse kio: two fixes for the sockio transmit refactor 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=20261001-sockio-sendmsg-empty-iter-v1-1-b876f4fbb9c7@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