On Thu, Aug 09, 2018 at 07:58:19PM +0200, Lukas Wunner wrote: > On Thu, Aug 09, 2018 at 10:33:56AM -0600, Keith Busch wrote: > > --- a/drivers/pci/pci-sysfs.c > > +++ b/drivers/pci/pci-sysfs.c > > @@ -591,6 +591,7 @@ static ssize_t sriov_numvfs_store(struct device *dev, > > if (num_vfs > pci_sriov_get_totalvfs(pdev)) > > return -ERANGE; > > > > + pci_lock_rescan_remove(); > > device_lock(&pdev->dev); > > Doesn't this obviate the need to hold the device_lock()? What could > otherwise run concurrently that doesn't hold pci_lock_rescan_remove() > and would cause a race condition? The device_lock is still needed to protect against concurrent pci_reset_function.