mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 00:10:04 +01:00
Abort online reencryption for misconfigured devices.
Hard abort is justified here. The online reencryption on data devices that do not support O_DIRECT io flag is dangerous and leads to data corruption. This should be impossible to hit due to a patch that handles it in initialization phase. Better safe than sorry.
This commit is contained in:
committed by
Milan Broz
parent
51920e0c8b
commit
f05d78de7c
@@ -4230,9 +4230,14 @@ int crypt_reencrypt_run(
|
||||
|
||||
log_dbg(cd, "Resuming LUKS2 reencryption.");
|
||||
|
||||
if (rh->online && reencrypt_init_device_stack(cd, rh)) {
|
||||
log_err(cd, _("Failed to initialize reencryption device stack."));
|
||||
return -EINVAL;
|
||||
if (rh->online) {
|
||||
/* This is last resort to avoid data corruption. Abort is justified here. */
|
||||
assert(device_direct_io(crypt_data_device(cd)));
|
||||
|
||||
if (reencrypt_init_device_stack(cd, rh)) {
|
||||
log_err(cd, _("Failed to initialize reencryption device stack."));
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
log_dbg(cd, "Progress %" PRIu64 ", device_size %" PRIu64, rh->progress, rh->device_size);
|
||||
|
||||
Reference in New Issue
Block a user