From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: no-reply@sashiko.virtuozzo.com, andrey.zhadchenko@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com
Subject: Re: [PATCH hci-8.2 v3 4/5] vhost-blk: pause the VM on a request failed with ENOSPC #VSTOR-152175
Date: Tue, 1 Dec 2026 10:14:13 +0100 [thread overview]
Message-ID: <ab028f67-cee2-40ab-9516-ac7cc1310353@virtuozzo.com> (raw)
In-Reply-To: <010701a22f243cea-a121e4cd-5006-4088-ba16-6140a4dd09f4-000000@eu-central-1.amazonses.com>
>> +static void vhost_blk_save_held(VHostBlk *s)
>> +{
>> + g_autofree struct vhost_blk_held_reqs *reqs = vhost_blk_get_held(s);
>> + int i;
>> +
>> + g_free(s->held);
>> + s->held = NULL;
>> + s->nr_held = reqs ? reqs->nr : 0;
> [Severity: Medium]
> Does this lose held requests when VHOST_BLK_GET_HELD_REQS fails?
> vhost_blk_get_held() returns NULL on any ioctl failure, and this line
> treats that the same as an empty list.
>
> The held heads are already consumed from the avail ring, and the kernel
> list is dropped by the following VHOST_RESET_OWNER or the next
> SET_BACKEND. Nothing is saved on the QEMU side, so these requests are
> never resubmitted or completed, and the guest hangs on those descriptors.
> Before this patch such requests were completed with an error. Should the
> failure be distinguished from an empty list?
The ioctl cannot fail here: the buffer is valid, zeroed and sized for
the maximum, and the owner is set. If it did fail, QEMU would know
neither vq nor head, so there would be nothing to recover with.
>> + if (!ioctl(s->vhostfd, VHOST_BLK_RESUBMIT, reqs)) {
>> + break;
>> + }
>> + if (reqs->nr >= nr) {
>> + error_report("vhost-blk: unable to resubmit held requests: %s",
>> + strerror(errno));
>> + break;
>> + }
>> +
>> + done += reqs->nr;
>> + if (errno == ENOMEM) {
>> + continue;
>> + }
> [Severity: Medium]
> Can this loop spin forever? If VHOST_BLK_RESUBMIT keeps failing with
> ENOMEM and reports reqs->nr == 0, then "reqs->nr >= nr" is false,
> "done += reqs->nr" adds nothing, and "continue" reissues the identical
> request.
>
> This runs from vhost_blk_start() on the main loop thread with the BQL
> held (vm-state handler or set_status on DRIVER_OK), so the whole VM and
> QMP would hang under host memory pressure. Would a no-progress check or
> a retry bound help here?
-ENOMEM here comes only from GFP_KERNEL allocations, so it is
transient: each retry sleeps in reclaim and stays killable. Bounding
the retries would drop the held requests and hang the guest I/O for
good, so I'd keep the loop as is.
>> + error_report("vhost-blk: unable to resubmit held request "
>> + "vq %u head %u: %s", s->held[done].vq,
>> + s->held[done].head, strerror(errno));
>> + done++;
>> + }
>> +
>> + g_free(s->held);
>> + s->held = NULL;
>> + s->nr_held = 0;
> [Severity: Low]
> Is the guest request for a skipped head ever completed? When
> VHOST_BLK_RESUBMIT fails for one head with an error other than ENOMEM,
> the head is logged and skipped with done++, and s->held is freed after
> the loop.
>
> The linux-headers comment for VHOST_BLK_RESUBMIT says the kernel does not
> track heads once they have been read out, so no later start can retry
> this one. That guest I/O stays outstanding until the guest times out or
> resets the device.
Right, but only on errors the guest causes itself: a descriptor chain
changed or a head reused while the request was held. The regular kick
path leaves such a head uncompleted too, and -ENOMEM is retried.
next prev parent reply other threads:[~2026-12-01 9:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 9:42 [PATCH hci-8.2 v3 0/5] vhost-blk: support the werror/rerror policies Alexander Ivanov
2026-11-30 9:42 ` [PATCH hci-8.2 v3 1/5] linux-headers: add the vhost-blk held request ioctls #VSTOR-152175 Alexander Ivanov
2026-12-01 0:53 ` no-reply
2026-12-01 9:03 ` Alexander Ivanov
2026-11-30 9:42 ` [PATCH hci-8.2 v3 2/5] vhost-blk: add the werror and rerror properties #VSTOR-152175 Alexander Ivanov
2026-12-01 0:54 ` no-reply
2026-11-30 9:42 ` [PATCH hci-8.2 v3 3/5] vhost-blk: stop vhost on every VM stop #VSTOR-152175 Alexander Ivanov
2026-12-01 0:58 ` no-reply
2026-12-01 9:07 ` Alexander Ivanov
2026-11-30 9:42 ` [PATCH hci-8.2 v3 4/5] vhost-blk: pause the VM on a request failed with ENOSPC #VSTOR-152175 Alexander Ivanov
2026-12-01 1:07 ` no-reply
2026-12-01 9:14 ` Alexander Ivanov [this message]
2026-11-30 9:42 ` [PATCH hci-8.2 v3 5/5] vhost-blk: migrate the held requests #VSTOR-152175 Alexander Ivanov
2026-12-01 1:10 ` no-reply
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=ab028f67-cee2-40ab-9516-ac7cc1310353@virtuozzo.com \
--to=alexander.ivanov@virtuozzo.com \
--cc=andrey.drobyshev@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=no-reply@sashiko.virtuozzo.com \
--cc=svt-core@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 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.