qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/2] virtio-blk: Release s->rq queue at syste


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH v2 1/2] virtio-blk: Release s->rq queue at system_reset
Date: Tue, 2 Aug 2016 15:31:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 08/02/16 15:00, Fam Zheng wrote:
> At system_reset, there is no point in retrying the queued request,
> because the driver that issued the request won't be around any more.
> 
> Analyzed-by: Laszlo Ersek <address@hidden>
> Reported-by: Laszlo Ersek <address@hidden>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
>  hw/block/virtio-blk.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index 475a822..12587d9 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -654,6 +654,7 @@ static void virtio_blk_reset(VirtIODevice *vdev)
>  {
>      VirtIOBlock *s = VIRTIO_BLK(vdev);
>      AioContext *ctx;
> +    VirtIOBlockReq *req;
>  
>      /*
>       * This should cancel pending requests, but can't do nicely until there
> @@ -662,6 +663,11 @@ static void virtio_blk_reset(VirtIODevice *vdev)
>      ctx = blk_get_aio_context(s->blk);
>      aio_context_acquire(ctx);
>      blk_drain(s->blk);
> +    while (s->rq) {
> +        req = s->rq;
> +        s->rq = req->next;
> +        virtio_blk_free_request(req);
> +    }
>  
>      if (s->dataplane) {
>          virtio_blk_data_plane_stop(s->dataplane);
> 

I'd prefer if Paolo's remark (about blk_drain()'s ability to produce
more failed requests, stashed in s->rq) were captured in either the
commit message, or in a code comment. Something like:

  /* We drop queued requests after blk_drain() because blk_drain()
   * itself can produce them. */

What do you think? It's your call. I certainly lacked that bit of
information.

Reviewed-by: Laszlo Ersek <address@hidden>

Thanks!
Laszlo



reply via email to

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