Revert "Bug 30332 — udisks does not tear down LUKS devices when the slave is forcibly...
authorDavid Zeuthen <davidz@redhat.com>
Fri, 26 Aug 2011 17:09:41 +0000 (13:09 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 26 Aug 2011 17:09:41 +0000 (13:09 -0400)
This reverts commit 16529b69f7b1ab33e2b92f99cc3bef17d6f20a25.

src/device.c

index 3602f0f..0bb6ec5 100644 (file)
@@ -11772,25 +11772,32 @@ force_removal (Device *device,
         }
     }
 
-  if (device->priv->id_usage != NULL && device->priv->luks_holder != NULL && strcmp (device->priv->id_usage, "crypto") == 0)
+  if (device->priv->id_usage != NULL && strcmp (device->priv->id_usage, "crypto") == 0)
     {
-      Device *d;
+      GList *devices;
+      GList *l;
 
       /* look for cleartext device  */
-      d = daemon_local_find_by_object_path (device->priv->daemon, device->priv->luks_holder);
-      if (strcmp (d->priv->object_path, device->priv->luks_holder) == 0)
+      devices = daemon_local_get_all_devices (device->priv->daemon);
+      for (l = devices; l != NULL; l = l->next)
         {
-          /* Check whether it is set up by us */
-          if (d->priv->dm_name != NULL && g_str_has_prefix (d->priv->dm_name, "udisks-luks-uuid-"))
+          Device *d = DEVICE (l->data);
+          if (d->priv->device_is_luks_cleartext && d->priv->luks_cleartext_slave != NULL
+              && strcmp (d->priv->luks_cleartext_slave, device->priv->object_path) == 0)
             {
 
-              g_print ("**** NOTE: Force luks teardown device %s (cleartext %s)\n",
-                       device->priv->device_file,
-                       d->priv->device_file);
+              /* Check whether it is set up by us */
+              if (d->priv->dm_name != NULL && g_str_has_prefix (d->priv->dm_name, "udisks-luks-uuid-"))
+                {
+
+                  g_print ("**** NOTE: Force luks teardown device %s (cleartext %s)\n",
+                           device->priv->device_file,
+                           d->priv->device_file);
 
-              /* Gotcha */
-              force_luks_teardown (device, d, callback, user_data);
-              goto pending;
+                  /* Gotcha */
+                  force_luks_teardown (device, d, callback, user_data);
+                  goto pending;
+                }
             }
         }
     }