1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

devmapper: Retry device removal after 100ms instead of 10ms

Right now we try device removal at the interval of 10ms and keep on trying
till either device is removed or 10 seconds are over. That means if device
is busy, we will try 1000 times in those 10 seconds.

Sounds too high a frequency of deivce removal retrial. All the logs are
filled easily. I think it is a good idea to slow down a bit and retry at
the interval of 100ms instead of 10ms.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Vivek Goyal 2015-04-02 16:47:14 -04:00
parent f74d12012c
commit c737800b7f

View file

@ -1245,7 +1245,7 @@ func (devices *DeviceSet) removeDevice(devname string) error {
logrus.Debugf("[devmapper] removeDevice START(%s)", devname) logrus.Debugf("[devmapper] removeDevice START(%s)", devname)
defer logrus.Debugf("[devmapper] removeDevice END(%s)", devname) defer logrus.Debugf("[devmapper] removeDevice END(%s)", devname)
for i := 0; i < 2000; i++ { for i := 0; i < 200; i++ {
err = devicemapper.RemoveDevice(devname) err = devicemapper.RemoveDevice(devname)
if err == nil { if err == nil {
break break
@ -1257,7 +1257,7 @@ func (devices *DeviceSet) removeDevice(devname string) error {
// If we see EBUSY it may be a transient error, // If we see EBUSY it may be a transient error,
// sleep a bit a retry a few times. // sleep a bit a retry a few times.
devices.Unlock() devices.Unlock()
time.Sleep(10 * time.Millisecond) time.Sleep(100 * time.Millisecond)
devices.Lock() devices.Lock()
} }