From: Josh Durgin <josh.durgin@inktank.com>
To: Jun Li <junmuzi@gmail.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, juli@redhat.com, famz@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] rbd: print a clear error message when write beyond EOF
Date: Wed, 10 Dec 2014 13:48:12 -0800 [thread overview]
Message-ID: <5488BF9C.7080402@inktank.com> (raw)
In-Reply-To: <1418226457-22239-1-git-send-email-junmuzi@gmail.com>
On 12/10/2014 07:47 AM, Jun Li wrote:
> Currently, as rbd driver do not support dynamic growth when write beyond EOF,
> so just print a clear error message.
>
> Signed-off-by: Jun Li <junmuzi@gmail.com>
> ---
> block/rbd.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/block/rbd.c b/block/rbd.c
> index 5b5a64a..65b01f0 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -693,6 +693,20 @@ static BlockAIOCB *qemu_rbd_aio_writev(BlockDriverState *bs,
> BlockCompletionFunc *cb,
> void *opaque)
> {
> + BDRVRBDState *s = bs->opaque;
> + uint64_t total_size;
> + int64_t off, size;
> +
> + off = sector_num * BDRV_SECTOR_SIZE;
> + size = nb_sectors * BDRV_SECTOR_SIZE;
> + rbd_get_size(s->image, &total_size);
> +
> + if (off + size > total_size) {
> + fprintf(stdout, "Image formats that grow on demand"
> + "are not supported on rbd.\n");
> + return NULL;
> + }
> +
> return rbd_start_aio(bs, sector_num, qiov, nb_sectors, cb, opaque,
> RBD_AIO_WRITE);
> }
>
This is one of the checks librbd does itself, so we could just look for
an EINVAL from rbd_aio_{read,write,discard} in rbd_start_aio()
to avoid duplicating the check. An out of bounds i/o is the only way
EINVAL can be returned from these functions in librbd.
Josh
next prev parent reply other threads:[~2014-12-10 21:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 15:47 [Qemu-devel] [PATCH] rbd: print a clear error message when write beyond EOF Jun Li
2014-12-10 21:48 ` Josh Durgin [this message]
2014-12-11 3:20 ` Jun Li
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=5488BF9C.7080402@inktank.com \
--to=josh.durgin@inktank.com \
--cc=famz@redhat.com \
--cc=juli@redhat.com \
--cc=junmuzi@gmail.com \
--cc=kwolf@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.