[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/8] raw: Reflect read-only protocol layer
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 3/8] raw: Reflect read-only protocol layer |
Date: |
Tue, 7 Nov 2017 12:00:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 07/11/2017 04:02, Eric Blake wrote:
> We forbid operations like a zero-length write zero or a discard
> at the protocol layer when it is marked read-only, but those
> same operations were succeeding at the format layer because the
> raw format was not reflecting the underlying read-only status
> to the block layer, which then took short circuit paths on
> zero-length operations.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> block/raw-format.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/block/raw-format.c b/block/raw-format.c
> index 830243a8e4..717b8eff65 100644
> --- a/block/raw-format.c
> +++ b/block/raw-format.c
> @@ -418,6 +418,12 @@ static int raw_open(BlockDriverState *bs, QDict
> *options, int flags,
> bs->file->bs->supported_write_flags;
> bs->supported_zero_flags = (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
> bs->file->bs->supported_zero_flags;
> + if (bdrv_is_read_only(bs->file->bs)) {
> + ret = bdrv_set_read_only(bs, true, errp);
> + if (ret < 0) {
> + return ret;
> + }
> + }
>
> if (bs->probed && !bdrv_is_read_only(bs)) {
> fprintf(stderr,
>
Kevin, perhaps this should be done straight in block.c?
Thanks,
Paolo
- [Qemu-devel] [PATCH 0/8] various NBD fixes for 2.11, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 1/8] nbd-client: Fix error message typos, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 3/8] raw: Reflect read-only protocol layer, Eric Blake, 2017/11/06
- Re: [Qemu-devel] [PATCH 3/8] raw: Reflect read-only protocol layer,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 2/8] nbd/client: Nicer trace of structured reply, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 5/8] nbd: Fix struct name for structured reads, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 4/8] nbd-client: Honor server read-only advertisement, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 6/8] nbd-client: Short-circuit 0-length operations, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 8/8] nbd/server: Fix structured read of length 0, Eric Blake, 2017/11/06
- [Qemu-devel] [PATCH 7/8] nbd-client: Stricter enforcing of structured reply spec, Eric Blake, 2017/11/06