pkg/devicemapper: defer udev wait during removal

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2014-11-14 14:18:35 -05:00
parent 7f1cdd81f0
commit 3bce14e7d0

View file

@ -307,7 +307,9 @@ func RemoveDevice(name string) error {
if err := task.SetCookie(&cookie, 0); err != nil {
return fmt.Errorf("Can not set cookie: %s", err)
}
defer UdevWait(cookie)
dmSawBusy = false // reset before the task is run
if err = task.Run(); err != nil {
if dmSawBusy {
return ErrBusy
@ -315,8 +317,6 @@ func RemoveDevice(name string) error {
return fmt.Errorf("Error running RemoveDevice %s", err)
}
UdevWait(cookie)
return nil
}
@ -543,7 +543,7 @@ func CreateDevice(poolName string, deviceId *int) error {
return fmt.Errorf("Can't set message %s", err)
}
dmSawExist = false
dmSawExist = false // reset before the task is run
if err := task.Run(); err != nil {
if dmSawExist {
// Already exists, try next id
@ -638,7 +638,7 @@ func CreateSnapDevice(poolName string, deviceId *int, baseName string, baseDevic
return fmt.Errorf("Can't set message %s", err)
}
dmSawExist = false
dmSawExist = false // reset before the task is run
if err := task.Run(); err != nil {
if dmSawExist {
// Already exists, try next id