pkg/devicemapper: defer udev wait during removal

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: cef27e1d6c0bd302e1c58e9478a0fba99fd3a2d0
Component: engine
This commit is contained in:
Vincent Batts
2014-11-14 15:17:33 -05:00
parent 4798207faf
commit b34358b506
@@ -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