From: Hanna Reitz <hreitz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
afrosi@redhat.com, "Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-block@nongnu.org, "Max Reitz" <mreitz@redhat.com>
Subject: Re: [PATCH] raw-format: drop WRITE and RESIZE child perms when possible
Date: Thu, 19 Aug 2021 15:37:56 +0200 [thread overview]
Message-ID: <c4ad5127-1c4c-7c92-3098-c36002d99f6f@redhat.com> (raw)
In-Reply-To: <20210726122839.822900-1-stefanha@redhat.com>
On 26.07.21 14:28, Stefan Hajnoczi wrote:
> The following command-line fails due to a permissions conflict:
>
> $ qemu-storage-daemon \
> --blockdev driver=nvme,node-name=nvme0,device=0000:08:00.0,namespace=1 \
> --blockdev driver=raw,node-name=l1-1,file=nvme0,offset=0,size=1073741824 \
> --blockdev driver=raw,node-name=l1-2,file=nvme0,offset=1073741824,size=1073741824 \
> --nbd-server addr.type=unix,addr.path=/tmp/nbd.sock,max-connections=2 \
> --export type=nbd,id=nbd-l1-1,node-name=l1-1,name=l1-1,writable=on \
> --export type=nbd,id=nbd-l1-2,node-name=l1-2,name=l1-2,writable=on
>
> qemu-storage-daemon: --export type=nbd,id=nbd-l1-1,node-name=l1-1,name=l1-1,writable=on: Permission conflict on node 'nvme0': permissions 'resize' are both required by node 'l1-1' (uses node 'nvme0' as 'file' child) and unshared by node 'l1-2' (uses node 'nvme0' as 'file' child).
>
> The problem is that block/raw-format.c relies on bdrv_default_perms() to
> set permissions on the nvme node. The default permissions add RESIZE in
> anticipation of a format driver like qcow2 that needs to grow the image
> file. This fails because RESIZE is unshared, so we cannot get the RESIZE
> permission.
>
> Max Reitz pointed out that block/crypto.c already handles this case by
> implementing a custom ->bdrv_child_perm() function that adjusts the
> result of bdrv_default_perms().
>
> This patch takes the same approach in block/raw-format.c so that RESIZE
> is only required if it's actually necessary (e.g. the parent is qcow2).
>
> Cc: Max Reitz <mreitz@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> This is not a bug fix, so I didn't mark it for QEMU 6.1. It's new
> behavior that hasn't been supported before. I want to split an NVMe
> drive using the raw format's offset=/size= feature.
> ---
> block/raw-format.c | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
Thanks, applied to my block-next branch:
https://github.com/XanClic/qemu/commits/block-next
Hanna
prev parent reply other threads:[~2021-08-19 13:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 12:28 [PATCH] raw-format: drop WRITE and RESIZE child perms when possible Stefan Hajnoczi
2021-07-26 14:41 ` Vladimir Sementsov-Ogievskiy
2021-07-26 15:42 ` Kevin Wolf
2021-07-26 15:59 ` Stefan Hajnoczi
2021-08-19 13:37 ` Hanna Reitz [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=c4ad5127-1c4c-7c92-3098-c36002d99f6f@redhat.com \
--to=hreitz@redhat.com \
--cc=afrosi@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=philmd@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).