Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Fix iNotifyWatch timeout (#1058)
Browse files Browse the repository at this point in the history
* Fix issue with iNotify

Start watching BEFORE we send attach request to the server ,to prevent a race when linux discovers new device before we start watching for it.
  • Loading branch information
pdhamdhere authored and Mark Sterin committed Mar 21, 2017
1 parent 74c8772 commit ea01371
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions vmdk_plugin/drivers/vmdk/vmdk_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ func (d *VolumeDriver) Create(r volume.Request) volume.Response {
log.WithFields(log.Fields{"name": r.Name,
"fstype": r.Options["fstype"]}).Info("Attaching volume and creating filesystem ")

watcher, skipInotify := fs.DevAttachWaitPrep(r.Name, watchPath)

dev, errAttach := d.ops.Attach(r.Name, nil)
if errAttach != nil {
log.WithFields(log.Fields{"name": r.Name,
Expand All @@ -260,8 +262,6 @@ func (d *VolumeDriver) Create(r volume.Request) volume.Response {
return volume.Response{Err: errAttach.Error()}
}

watcher, skipInotify := fs.DevAttachWaitPrep(r.Name, watchPath)

device, errGetDevicePath := fs.GetDevicePath(dev)
if errGetDevicePath != nil {
log.WithFields(log.Fields{"name": r.Name,
Expand Down
2 changes: 1 addition & 1 deletion vmdk_plugin/utils/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
pciAddrLen = 10 // Length of PCI dev addr
diskPathByDevID = "/dev/disk/by-id/wwn-0x" // Path for devices named by ID
scsiHostPath = "/sys/class/scsi_host/" // Path for scsi hosts
devWaitTimeout = 1 * time.Second // give it plenty of time to sense the attached disk
devWaitTimeout = 10 * time.Second // give it plenty of time to sense the attached disk
bdevPath = "/sys/block/"
deleteFile = "/device/delete"
watchPath = "/dev/disk/by-id"
Expand Down

0 comments on commit ea01371

Please sign in to comment.