summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--storage/devices.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/storage/devices.py b/storage/devices.py
index 02c694581..5bfd31ffd 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2993,6 +2993,9 @@ class OpticalDevice(StorageDevice):
if not self.exists:
raise DeviceError("device has not been created", self.path)
+ #try to umount and close device before ejecting
+ self.teardown()
+
# Make a best effort attempt to do the eject. If it fails, it's not
# critical.
fd = os.open(self.path, os.O_RDONLY | os.O_NONBLOCK)