qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH v2 2/2] lockable: replaced locks with lock guard macros where


From: Paolo Bonzini
Subject: Re: [PATCH v2 2/2] lockable: replaced locks with lock guard macros where appropriate
Date: Fri, 20 Mar 2020 13:06:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 20/03/20 00:34, address@hidden wrote:
> index 682abd8e09..89f8a656a4 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -1086,7 +1086,7 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
>      acb->task->expxferlen = acb->ioh->dxfer_len;
>  
>      data.size = 0;
> -    qemu_mutex_lock(&iscsilun->mutex);
> +    QEMU_LOCK_GUARD(&iscsilun->mutex);
>      if (acb->task->xfer_dir == SCSI_XFER_WRITE) {
>          if (acb->ioh->iovec_count == 0) {
>              data.data = acb->ioh->dxferp;
> @@ -1102,7 +1102,6 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
>                                   iscsi_aio_ioctl_cb,
>                                   (data.size > 0) ? &data : NULL,
>                                   acb) != 0) {
> -        qemu_mutex_unlock(&iscsilun->mutex);
>          scsi_free_scsi_task(acb->task);
>          qemu_aio_unref(acb);
>          return NULL;

Not exactly the same, should be okay but it also should be noted in the
changelog.

>  void cpu_list_remove(CPUState *cpu)
>  {
> -    qemu_mutex_lock(&qemu_cpu_list_lock);
> +    QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
>      if (!QTAILQ_IN_USE(cpu, node)) {
>          /* there is nothing to undo since cpu_exec_init() hasn't been called 
> */
>          qemu_mutex_unlock(&qemu_cpu_list_lock);

Missed unlock.

> 
> @@ -667,14 +668,13 @@ int qemu_vfio_dma_reset_temporary(QEMUVFIOState *s)
>          .size = QEMU_VFIO_IOVA_MAX - s->high_water_mark,
>      };
>      trace_qemu_vfio_dma_reset_temporary(s);
> -    qemu_mutex_lock(&s->lock);
> +    QEMU_LOCK_GUARD(&s->lock);
>      if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) {
>          error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno));
>          qemu_mutex_unlock(&s->lock);
>          return -errno;
>      }
>      s->high_water_mark = QEMU_VFIO_IOVA_MAX;
> -    qemu_mutex_unlock(&s->lock);
>      return 0;

Missed unlock.

Otherwise looks good.

Paolo




reply via email to

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