> From: Anthony DeRossi <ajderossi@xxxxxxxxx> > Sent: Thursday, October 27, 2022 3:43 AM > > -static bool vfio_pci_dev_set_needs_reset(struct vfio_device_set *dev_set) > +static bool vfio_pci_core_needs_reset(struct vfio_pci_core_device *vdev) > { > + struct vfio_device_set *dev_set = vdev->vdev.dev_set; > struct vfio_pci_core_device *cur; > bool needs_reset = false; > > + if (vdev->vdev.open_count > 1) > + return false; WARN_ON() > + > list_for_each_entry(cur, &dev_set->device_list, vdev.dev_set_list) { > - /* No VFIO device in the set can have an open device FD */ > - if (cur->vdev.open_count) > + /* Only the VFIO device being reset can have an open FD */ > + if (cur != vdev && cur->vdev.open_count) > return false; not caused by this patch but while at it... open_count is defined not for driver use: /* Members below here are private, not for driver use */ unsigned int index; struct device device; /* device.kref covers object life circle */ refcount_t refcount; /* user count on registered device*/ unsigned int open_count; struct completion comp; struct list_head group_next; struct list_head iommu_entry; prefer to a wrapper or move it to the public section of vfio_device.