From: sashiko-bot@kernel.org
To: "Alberto Faria" <afaria@redhat.com>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v2 1/2] virtio_blk: add fua write support
Date: Wed, 25 Nov 2026 08:09:48 +0000 [thread overview]
Message-ID: <sashiko-outbox-232866@kernel.org> (raw)
In-Reply-To: <20261125075408.226762-2-afaria@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] virtio_blk: missing VIRTIO_BLK_F_REQ_FLAGS check in
virtblk_setup_cmd()
--
commit f7bfe54853bedaa1afa630f98325bb99ee3bb7cb
Author: Alberto Faria <afaria@redhat.com>
virtio_blk: add fua write support
This commit adds UAPI definitions for virtio-blk request flags and
VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA, and teaches virtio_blk to advertise and
handle REQ_FUA writes.
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 2b462005cdb68..b91d7dbd25cfd 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -248,7 +248,10 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
> return BLK_STS_NOTSUPP;
>
> /* Set fields for all request types */
> - vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
> + if (virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS))
> + vbr->out_hdr.flags = 0;
> + else
> + vbr->out_hdr.ioprio = cpu_to_virtio32(vdev, req_get_ioprio(req));
>
> switch (req_op(req)) {
> case REQ_OP_READ:
> @@ -258,6 +261,10 @@ static blk_status_t virtblk_setup_cmd(struct virtio_device *vdev,
> case REQ_OP_WRITE:
> type = VIRTIO_BLK_T_OUT;
> sector = blk_rq_pos(req);
> + if ((req->cmd_flags & REQ_FUA) &&
> + virtio_has_feature(vdev, VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA))
> + vbr->out_hdr.flags |= cpu_to_virtio32(vdev,
> + BIT(VIRTIO_BLK_REQ_FLAG_OUT_FUA));
> break;
[Severity: Medium]
Should REQ_OP_WRITE also check VIRTIO_BLK_F_REQ_FLAGS before touching
vbr->out_hdr.flags, or should virtio_blk clear
VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA in a .validate callback when
VIRTIO_BLK_F_REQ_FLAGS is not offered?
Unlike virtblk_probe() and cache_type_store(), which check both features,
virtblk_setup_cmd() only checks VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA here. If
VIRTIO_BLK_F_REQ_FLAGS is not negotiated (for example, when filtered out
via debugfs_filter_features), virtio_blk accepts
VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA without its prerequisite feature and can
fail feature negotiation with spec-compliant devices, or overwrite
vbr->out_hdr.ioprio in the union if a REQ_FUA write reaches the queue.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125075408.226762-1-afaria@redhat.com?part=1
next prev parent reply other threads:[~2026-11-25 8:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 7:54 [PATCH v2 0/2] virtio_blk: add FUA write support Alberto Faria
2026-11-25 7:54 ` [PATCH v2 1/2] virtio_blk: add fua " Alberto Faria
2026-11-25 8:09 ` sashiko-bot [this message]
2026-11-25 7:54 ` [PATCH v2 2/2] vdpa_sim_blk: add support for FUA writes Alberto Faria
2026-11-25 8:05 ` sashiko-bot
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=sashiko-outbox-232866@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=afaria@redhat.com \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/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