[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] udev_settle after format teardown to avoid EBUSY on device teardown. (#492670)



---
 storage/devices.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 79a4bd5..f5f1200 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -524,6 +524,7 @@ class StorageDevice(Device):
 
         if self.status and self.format.exists:
             self.format.teardown()
+            udev_settle(timeout=10)
 
         if recursive:
             self.teardownParents(recursive=recursive)
@@ -1450,10 +1451,11 @@ class LUKSDevice(DMCryptDevice):
 
         if self.status and self.format.exists:
             self.format.teardown()
-            udev_settle()
+            udev_settle(timeout=10)
 
         if self.slave.format.exists:
             self.slave.format.teardown()
+            udev_settle(timeout=10)
 
         if recursive:
             self.teardownParents(recursive=recursive)
@@ -1461,6 +1463,7 @@ class LUKSDevice(DMCryptDevice):
     def destroy(self):
         log_method_call(self, self.name, status=self.status)
         self.format.teardown()
+        udev_settle(timeout=10)
         self.teardown()
 
     @property
@@ -1955,6 +1958,7 @@ class LVMLogicalVolumeDevice(DMDevice):
 
         if self.status and self.format.exists:
             self.format.teardown()
+            udev_settle(timeout=10)
 
         if self.status:
             lvm.lvdeactivate(self.vg.name, self._name)
@@ -2003,6 +2007,7 @@ class LVMLogicalVolumeDevice(DMDevice):
             raise DeviceError("device has not been created")
 
         self.format.teardown()
+        udev_settle(timeout=10)
         lvm.lvresize(self.vg.name, self._name, self.size)
 
 
@@ -2316,6 +2321,7 @@ class MDRaidArrayDevice(StorageDevice):
 
         if self.status and self.format.exists:
             self.format.teardown()
+            udev_settle(timeout=10)
 
         if self.status:
             mdraid.mddeactivate(self.path)
@@ -2466,6 +2472,7 @@ class DMRaidArrayDevice(DiskDevice):
 
         if self.format.exists:
             self.format.teardown()
+            udev_settle(timeout=10)
 
         # This call already checks if the set is not active.
         self._raidSet.deactivate()
-- 
1.6.0.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]