[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 7/8] VirtIOBlock: protect rq with its own lock
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 7/8] VirtIOBlock: protect rq with its own lock |
Date: |
Tue, 5 Jul 2022 15:45:02 +0100 |
On Thu, Jun 09, 2022 at 10:37:26AM -0400, Emanuele Giuseppe Esposito wrote:
> @@ -946,17 +955,20 @@ static void virtio_blk_reset(VirtIODevice *vdev)
> * stops all Iothreads.
> */
> blk_drain(s->blk);
> + aio_context_release(ctx);
>
> /* We drop queued requests after blk_drain() because blk_drain() itself
> can
> * produce them. */
> + qemu_mutex_lock(&s->req_mutex);
> while (s->rq) {
> req = s->rq;
> s->rq = req->next;
> + qemu_mutex_unlock(&s->req_mutex);
> virtqueue_detach_element(req->vq, &req->elem, 0);
> virtio_blk_free_request(req);
> + qemu_mutex_lock(&s->req_mutex);
Why is req_mutex dropped temporarily? At this point we don't really need
the req_mutex (all I/O should be stopped and drained), but maybe we
should do:
WITH_QEMU_MUTEX(&s->req_mutex) {
req = s->rq;
s->rq = NULL;
}
...process req list...
Otherwise:
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature
- Re: [PATCH 7/8] VirtIOBlock: protect rq with its own lock,
Stefan Hajnoczi <=