vfio-pci: Use mutex around open, release, and remove

Serializing open/release allows us to fix a refcnt error if we fail
to enable the device and lets us prevent devices from being unbound
or opened, giving us an opportunity to do bus resets on release.  No
restriction added to serialize binding devices to vfio-pci while the
mutex is held though.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
Alex Williamson
2014-08-07 11:12:04 -06:00
parent 9c22e660ce
commit 61d792562b
2 changed files with 24 additions and 13 deletions

View File

@@ -55,7 +55,7 @@ struct vfio_pci_device {
bool bardirty;
bool has_vga;
struct pci_saved_state *pci_saved_state;
atomic_t refcnt;
int refcnt;
struct eventfd_ctx *err_trigger;
};