Skip to content

Commit

Permalink
uevent:Revert "device: check for existing device PCI path before wait…
Browse files Browse the repository at this point in the history
…ing"

We should not check for the sysfs path assciated with the PCI address
as the device node may still not be created. Only a uevent with a device
name associated indicates that the device is ready.

This change was also causing the sandbox lock to be not released causing
the uevent listening loop to be locked permanently.

This reverts commit 7caf1c8.

Fixes kata-containers#379

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde authored and bergwolf committed Sep 20, 2018
1 parent aa81883 commit 4163b8b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func getPCIDeviceName(s *sandbox, pciID string) (string, error) {

fieldLogger := agentLog.WithField("pciID", pciID)

s.Lock()
// Check if the PCI identifier is in PCI device map.
s.Lock()
for key, value := range s.pciDeviceMap {
if strings.Contains(key, pciAddr) {
devName = value
Expand All @@ -122,15 +122,6 @@ func getPCIDeviceName(s *sandbox, pciID string) (string, error) {
}
}

// Check if the PCI path is present before we setup the pci device map.
_, err = os.Stat(filepath.Join(rootBusPath, pciAddr))
if err == nil {
// Found pci path. It's there before we wait for the device map.
// We cannot find the name for it.
fieldLogger.Info("Device found on pci device path")
return "", nil
}

// If device is not found in the device map, hotplug event has not
// been received yet, create and add channel to the watchers map.
// The key of the watchers map is the device we are interested in.
Expand Down Expand Up @@ -169,9 +160,6 @@ func virtioBlkDeviceHandler(device pb.Device, spec *pb.Spec, s *sandbox) error {
if err != nil {
return err
}
if devPath == "" {
return fmt.Errorf("cannot find device name for virtio block device")
}
device.VmPath = devPath

return updateSpecDeviceList(device, spec)
Expand Down

0 comments on commit 4163b8b

Please sign in to comment.