Disable reencryption for DAX devices.

Device-mapper is not capable to stack DAX/non-DAX devices
in mapping table, so online reencryption cannot work.

Fixes: #760
This commit is contained in:
Milan Broz
2023-03-18 14:02:56 +01:00
parent e4c2aa64b5
commit a617c23ccc

View File

@@ -3852,6 +3852,11 @@ int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
if (params && (params->flags & CRYPT_REENCRYPT_INITIALIZE_ONLY) && (params->flags & CRYPT_REENCRYPT_RESUME_ONLY))
return -EINVAL;
if (device_is_dax(crypt_data_device(cd)) > 0) {
log_err(cd, _("Reencryption is not supported for DAX (persistent memory) devices."));
return -EINVAL;
}
r = keyring_get_passphrase(passphrase_description, &passphrase, &passphrase_size);
if (r < 0) {
log_err(cd, _("Failed to read passphrase from keyring (error %d)."), r);
@@ -3881,6 +3886,11 @@ int crypt_reencrypt_init_by_passphrase(struct crypt_device *cd,
if (params && (params->flags & CRYPT_REENCRYPT_INITIALIZE_ONLY) && (params->flags & CRYPT_REENCRYPT_RESUME_ONLY))
return -EINVAL;
if (device_is_dax(crypt_data_device(cd)) > 0) {
log_err(cd, _("Reencryption is not supported for DAX (persistent memory) devices."));
return -EINVAL;
}
return reencrypt_init_by_passphrase(cd, name, passphrase, passphrase_size, keyslot_old, keyslot_new, cipher, cipher_mode, params);
}