Skip to content

Commit

Permalink
PCI: Fix /sys warning when sriov enabled and card is hot removed
Browse files Browse the repository at this point in the history
sysfs is a bit stricter now and emits warnings in more cases.

For SRIOV hotplug, we are calling pci_stop_dev() for each VF first
(after we update pci_stop_bus_devices) which remove each VF subdir.  So
double check the VF dir in /sys before trying to remove the physfn link.

Signed-of-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Yinghai Lu authored and Jesse Barnes committed Feb 17, 2012
1 parent ad71c96 commit 09cedbe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/pci/iov.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,13 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)

sprintf(buf, "virtfn%u", id);
sysfs_remove_link(&dev->dev.kobj, buf);
sysfs_remove_link(&virtfn->dev.kobj, "physfn");
/*
* pci_stop_dev() could have been called for this virtfn already,
* so the directory for the virtfn may have been removed before.
* Double check to avoid spurious sysfs warnings.
*/
if (virtfn->dev.kobj.sd)
sysfs_remove_link(&virtfn->dev.kobj, "physfn");

mutex_lock(&iov->dev->sriov->lock);
pci_remove_bus_device(virtfn);
Expand Down

0 comments on commit 09cedbe

Please sign in to comment.