From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Dmitry Fomichev <dmitry.fomichev@wdc.com>,
Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Hannes Reinecke <hare@suse.de>, Sam Li <faithilikerun@gmail.com>
Cc: virtio-dev@lists.oasis-open.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 2/2] virtio-blk: fix ZBD probe in kernels without ZBD support
Date: Wed, 29 Mar 2023 17:20:05 +0900 [thread overview]
Message-ID: <f10dc56d-8114-d6b3-6426-cd943c6aea9b@opensource.wdc.com> (raw)
In-Reply-To: <20230328022928.1003996-3-dmitry.fomichev@wdc.com>
On 3/28/23 11:29, Dmitry Fomichev wrote:
> When the kernel is built without support for zoned block devices,
> virtio-blk probe needs to error out any host-managed device scans
> to prevent such devices from appearing in the system as non-zoned.
> The current virtio-blk code simply bypasses all ZBD checks if
> CONFIG_BLK_DEV_ZONED is not defined and this leads to host-managed
> block devices being presented as non-zoned in the OS. This is one of
> the main problems this patch series is aimed to fix.
>
> In this patch, make VIRTIO_BLK_F_ZONED feature defined even when
> CONFIG_BLK_DEV_ZONED is not. This change makes the code compliant with
> the voted revision of virtio-blk ZBD spec. Modify the probe code to
> look at the situation when VIRTIO_BLK_F_ZONED is negotiated in a kernel
> that is built without ZBD support. In this case, the code checks
> the zoned model of the device and fails the probe is the device
> is host-managed.
>
> The patch also adds the comment to clarify that the call to perform
> the zoned device probe is correctly placed after virtio_device ready().
>
> Fixes: 95bfec41bd3d ("virtio-blk: add support for zoned block devices")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
One nit below, but otherwise looks good to me.
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> -static inline bool virtblk_has_zoned_feature(struct virtio_device *vdev)
> -{
> - return false;
> + u8 model;
> +
> + virtio_cread(vdev, struct virtio_blk_config, zoned.model, &model);
> + if (model == VIRTIO_BLK_Z_HM) {
> + dev_err(&vdev->dev,
> + "zoned devices are not supported by the kernel");
May be simply: "Zoned devices are not supported"
Or: "Support for zoned devices is disabled"
--
Damien Le Moal
Western Digital Research
prev parent reply other threads:[~2023-03-29 8:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 2:29 [PATCH 0/2] virtio-blk: fix a few problems in ZBD-related code Dmitry Fomichev
2023-03-28 2:29 ` [PATCH 1/2] virtio-blk: migrate to the latest patchset version Dmitry Fomichev
2023-03-28 14:51 ` [virtio-dev] " Stefan Hajnoczi
2023-03-29 8:16 ` Damien Le Moal
2023-03-28 2:29 ` [PATCH 2/2] virtio-blk: fix ZBD probe in kernels without ZBD support Dmitry Fomichev
2023-03-28 14:51 ` [virtio-dev] " Stefan Hajnoczi
2023-03-29 8:20 ` Damien Le Moal [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=f10dc56d-8114-d6b3-6426-cd943c6aea9b@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=axboe@kernel.dk \
--cc=dmitry.fomichev@wdc.com \
--cc=faithilikerun@gmail.com \
--cc=hare@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=mst@redhat.com \
--cc=stefanha@gmail.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox