qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Fomichev <dmitry.fomichev@wdc.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	John Snow <jsnow@redhat.com>
Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH v6 4/4] raw: Don't open ZBDs if backend can't handle them
Date: Wed,  4 Sep 2019 17:01:00 -0400	[thread overview]
Message-ID: <20190904210100.10501-5-dmitry.fomichev@wdc.com> (raw)
In-Reply-To: <20190904210100.10501-1-dmitry.fomichev@wdc.com>

Abort opening a zoned device as a raw file in case the chosen
block backend driver lacks proper support for this type of
storage.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
---
 block/file-posix.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/block/file-posix.c b/block/file-posix.c
index c7e1aff6eb..f11d589f90 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2883,6 +2883,20 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
             goto fail;
         }
     }
+
+    /*
+     * If we are opening a zoned block device, check if the backend
+     * driver can properly handle host-managed devices, abort if not.
+     */
+    if (bdrv_is_hm_zoned(bs) &&
+        (shared & BLK_PERM_SUPPORT_HM_ZONED) &&
+        !(perm & BLK_PERM_SUPPORT_HM_ZONED)) {
+        error_setg(errp,
+                   "block backend driver doesn't support host-managed zoned devices");
+        ret = -ENOTSUP;
+        goto fail;
+    }
+
     return 0;
 
 fail:
-- 
2.21.0



  parent reply	other threads:[~2019-09-04 22:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 21:00 [Qemu-devel] [PATCH v6 0/4] virtio/block: handle zoned backing devices Dmitry Fomichev
2019-09-04 21:00 ` [Qemu-devel] [PATCH v6 1/4] block: Add zoned device model property Dmitry Fomichev
2019-09-06  8:11   ` Stefano Garzarella
2019-09-06 16:17     ` Dmitry Fomichev
2019-09-06 21:10       ` Stefano Garzarella
2019-09-06 21:21         ` Dmitry Fomichev
2019-09-04 21:00 ` [Qemu-devel] [PATCH v6 2/4] raw: Recognize zoned backing devices Dmitry Fomichev
2019-09-04 21:00 ` [Qemu-devel] [PATCH v6 3/4] block/ide/scsi: Set BLK_PERM_SUPPORT_HM_ZONED Dmitry Fomichev
2019-09-04 21:01 ` Dmitry Fomichev [this message]
2019-09-05 15:42 ` [Qemu-devel] [PATCH v6 0/4] virtio/block: handle zoned backing devices Stefan Hajnoczi

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=20190904210100.10501-5-dmitry.fomichev@wdc.com \
    --to=dmitry.fomichev@wdc.com \
    --cc=alistair.francis@wdc.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).