From: David Zeuthen Date: Fri, 26 Aug 2011 17:09:41 +0000 (-0400) Subject: Revert "Bug 30332 — udisks does not tear down LUKS devices when the slave is forcibly... X-Git-Tag: upstream/2.1.2~485 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9ee5856395d885bbf76489b7ba8aa9b652a4b6b;p=platform%2Fupstream%2Fudisks2.git Revert "Bug 30332 — udisks does not tear down LUKS devices when the slave is forcibly removed" This reverts commit 16529b69f7b1ab33e2b92f99cc3bef17d6f20a25. --- diff --git a/src/device.c b/src/device.c index 3602f0f..0bb6ec5 100644 --- a/src/device.c +++ b/src/device.c @@ -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; + } } } }