All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: andrey.zhadchenko@virtuozzo.com,
	Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2] drivers/vhost/blk: reject a head that is still in flight
Date: Thu, 29 Oct 2026 13:52:33 +0000	[thread overview]
Message-ID: <010701a187ef0e39-9ebdb65b-5f60-46e0-9a46-ae71a8f62bfa-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261029134822.3367197-1-alexander.ivanov@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] vhost-blk: in-flight head error is logged and signalled twice
--

commit 50430ed7a617303d49fca9a87eb2e315f023f9f7
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

drivers/vhost/blk: reject a head that is still in flight

This patch adds an inflight flag to each vhost_blk_req slot. The flag is set
at bio submission and cleared when completion is handled. If the guest
posts a head whose slot is still in flight, vhost_blk_req_handle() now
returns -EBUSY. The slots are also allocated zeroed.

> diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c
> --- a/drivers/vhost/blk.c
> +++ b/drivers/vhost/blk.c

[ ... ]

> @@ -457,6 +459,11 @@ static int vhost_blk_req_handle(struct vhost_virtqueue *vq,
>  	u8 status;
>  
>  	req		= &blk_vq->req[head];
> +	if (unlikely(req->inflight)) {
> +		vhostblk_vq_err(blk, vq, "Guest reused in-flight head %d", head);
> +		return -EBUSY;
> +	}
> +

[Severity: Low]
Is this error reported twice? vhostblk_vq_err() here already calls
pr_warn_ratelimited() and eventfd_signal() on vq->error_ctx, and then
-EBUSY is returned.

In vhost_blk_handle_guest_kick(), only -EAGAIN and -ENOMEM are special-cased:

	ret = vhost_blk_req_handle(vq, &hdr, head, out, in);
	if (ret == -EAGAIN || ret == -ENOMEM) {
		...
	} else if (ret < 0) {
		vhostblk_vq_err(blk, vq, "Failed to process guest request (head %d) with %d",
				head, ret);
		break;
	}

So -EBUSY reaches the second branch, which calls vhostblk_vq_err() again.
That gives a second warning and a second eventfd_signal() for one guest
misbehaviour.

The commit message says "Log the head and let the caller report the error on
the vq error eventfd". Should the vhostblk_vq_err() in vhost_blk_req_handle()
be a plain log message, such as pr_warn_ratelimited(), so that only the
caller signals the eventfd? Other early errors in this function, such as
-EINVAL, are reported only by the caller.

> [ ... ]

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261029134822.3367197-1-alexander.ivanov@virtuozzo.com?part=1

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

  reply	other threads:[~2026-10-29 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 13:48 Alexander Ivanov
2026-10-29 13:52 ` no-reply [this message]
2026-10-29 13:59   ` Alexander Ivanov
2026-11-02 10:36 ` Konstantin Khorenko
2026-11-02 10:36 ` 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=010701a187ef0e39-9ebdb65b-5f60-46e0-9a46-ae71a8f62bfa-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.