Browse code

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>

Vivek Goyal authored on 2015/04/03 05:47:14
Showing 1 changed files
... ...
@@ -1245,7 +1245,7 @@ func (devices *DeviceSet) removeDevice(devname string) error {
1245 1245
 	logrus.Debugf("[devmapper] removeDevice START(%s)", devname)
1246 1246
 	defer logrus.Debugf("[devmapper] removeDevice END(%s)", devname)
1247 1247
 
1248
-	for i := 0; i < 2000; i++ {
1248
+	for i := 0; i < 200; i++ {
1249 1249
 		err = devicemapper.RemoveDevice(devname)
1250 1250
 		if err == nil {
1251 1251
 			break
... ...
@@ -1257,7 +1257,7 @@ func (devices *DeviceSet) removeDevice(devname string) error {
1257 1257
 		// If we see EBUSY it may be a transient error,
1258 1258
 		// sleep a bit a retry a few times.
1259 1259
 		devices.Unlock()
1260
-		time.Sleep(10 * time.Millisecond)
1260
+		time.Sleep(100 * time.Millisecond)
1261 1261
 		devices.Lock()
1262 1262
 	}
1263 1263