]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: protect deactivate with activate lock 6926/head
authorLoic Dachary <ldachary@redhat.com>
Fri, 18 Dec 2015 23:53:03 +0000 (00:53 +0100)
committerLoic Dachary <ldachary@redhat.com>
Mon, 21 Dec 2015 10:37:37 +0000 (11:37 +0100)
When ceph-disk prepares the disk, it triggers udev events and each of
them ceph-disk activate. If systemctl stop ceph-osd@2 happens while
there still are ceph-disk activate in flight, the systemctl stop may be
cancelled by the systemctl enable issued by one of the pending ceph-disk
activate.

This only matters in a test environment where disks are destroyed
shortly after they are activated.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/ceph-disk

index 62b57a04557abd8de1dac25ec77cd0bedb5fd1e1..05c1a89d412fc0e8e9e251c20afbe4710b1cac81 100755 (executable)
@@ -2664,6 +2664,13 @@ def _remove_osd_directory_files(mounted_path, cluster):
 
 
 def main_deactivate(args):
+    activate_lock.acquire()  # noqa
+    try:
+        main_deactivate_locked(args)
+    finally:
+        activate_lock.release()  # noqa
+
+def main_deactivate_locked(args):
     osd_id = args.deactivate_by_id
     path = args.path
     target_dev = None
@@ -2725,8 +2732,6 @@ def main_deactivate(args):
     if dmcrypt:
         dmcrypt_unmap(part_uuid)
 
-    return
-
 ###########################
 
 def _remove_from_crush_map(cluster, osd_id):