From: Alex Williamson Date: Mon, 27 Jul 2020 19:43:38 +0000 (-0600) Subject: vfio/pci: Hold igate across releasing eventfd contexts X-Git-Tag: v5.9-rc1~50^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=924b51abf961f1d888143fcfa3d63c92dc517679;p=thirdparty%2Flinux.git vfio/pci: Hold igate across releasing eventfd contexts No need to release and immediately re-acquire igate while clearing out the eventfd ctxs. Reviewed-by: Cornelia Huck Signed-off-by: Alex Williamson --- diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index b0258b79bb5bc..dabca0450e6dc 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -523,14 +523,12 @@ static void vfio_pci_release(void *device_data) vfio_pci_vf_token_user_add(vdev, -1); vfio_spapr_pci_eeh_release(vdev->pdev); vfio_pci_disable(vdev); + mutex_lock(&vdev->igate); if (vdev->err_trigger) { eventfd_ctx_put(vdev->err_trigger); vdev->err_trigger = NULL; } - mutex_unlock(&vdev->igate); - - mutex_lock(&vdev->igate); if (vdev->req_trigger) { eventfd_ctx_put(vdev->req_trigger); vdev->req_trigger = NULL;