2010-05-27 Milan Broz <mbroz@redhat.com>
* Fix luksFormat/luksOpen reading passphrase from stdin and "-" keyfile.
* Add verbose log level and move unlocking message there.
+ * Remove device even if underlying device disappeared.
2010-05-23 Milan Broz <mbroz@redhat.com>
* Fix luksClose operation for stacked DM devices.
{
uint32_t major, minor;
dev_t dev;
- char *result, buf[PATH_MAX + 1];
+ char *result = NULL, buf[PATH_MAX + 1];
if (sscanf(dev_id, "%" PRIu32 ":%" PRIu32, &major, &minor) != 2)
return NULL;
strncpy(buf, DEVICE_DIR, PATH_MAX);
result = __lookup_dev(buf, dev, 0, 4);
- /* If not found, return major:minor */
- return result ?: strdup(dev_id);
+ /* If not found, return NULL */
+ return result;
}
static int _dev_read_ahead(const char *dev, uint32_t *read_ahead)
int r;
r = crypt_init_by_name(&cd, options->name);
- if (r)
- return r;
-
- r = crypt_deactivate(cd, options->name);
+ if (r == 0)
+ r = crypt_deactivate(cd, options->name);
crypt_free(cd);
return r;
char cipherMode[LUKS_CIPHERMODE_L];
char *password=NULL;
unsigned int passwordLen;
- struct crypt_device *cd;
+ struct crypt_device *cd = NULL;
struct crypt_params_luks1 cp = {
.hash = options->hash,
.data_alignment = options->align_payload
r = dm_query_device(name, &device, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
+
+ /* Underlying device disappeared but mapping still active */
+ if (r >= 0 && !device)
+ log_verbose(NULL, _("Underlying device for crypt device %s disappeared.\n"),
+ name);
+
if (r >= 0)
r = crypt_init(cd, device);