qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH Update] sheepdog: don't update inode when create


From: MORITA Kazutaka
Subject: Re: [Qemu-devel] [PATCH Update] sheepdog: don't update inode when create_and_write fails
Date: Mon, 17 Dec 2012 12:43:04 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/23.2 Mule/6.0 (HANACHIRUSATO)

At Sat, 15 Dec 2012 17:59:12 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <address@hidden>
> 
> For the error case such as SD_RES_NO_SPACE, we shouldn't update the inode 
> bitmap
> to avoid the scenario that the object is allocated but wasn't created at the
> server side. This will result in VM's IO error on the failed object.
> 
> Cc: MORITA Kazutaka <address@hidden>
> Cc: Kevin Wolf <address@hidden>
> Signed-off-by: Liu Yuan <address@hidden>
> ---
>  Update
>   - update the coding style and passed checkpath
> 
>  block/sheepdog.c |   12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index a48f58c..6116316 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -697,6 +697,12 @@ static void coroutine_fn aio_read_response(void *opaque)
>  
>      acb = aio_req->aiocb;
>  
> +    if (rsp.result != SD_RES_SUCCESS) {
> +        acb->ret = -EIO;
> +        error_report("%s", sd_strerror(rsp.result));
> +        goto err;
> +    }
> +
>      switch (acb->aiocb_type) {
>      case AIOCB_WRITE_UDATA:
>          /* this coroutine context is no longer suitable for co_recv
> @@ -736,11 +742,7 @@ static void coroutine_fn aio_read_response(void *opaque)
>          break;
>      }
>  
> -    if (rsp.result != SD_RES_SUCCESS) {
> -        acb->ret = -EIO;
> -        error_report("%s", sd_strerror(rsp.result));
> -    }
> -
> +err:
>      free_aio_req(s, aio_req);
>      if (!acb->nr_pending) {
>          /*

send_pending_req() needs to be called even in error case.  Rather than
moving the error check, I think it looks better to update
s->inode.data_vdi_id only when rsp.result is SD_RES_SUCCESS.

Thanks,

Kazutaka



reply via email to

[Prev in Thread] Current Thread [Next in Thread]