Do not handle device as suspended on error.

Consider device is suspended only if dm_status_suspended return code
is true.

This function returned -EEXIST for dm devices with target types unknown
to libcryptsetup (for example dm-cache) and turned off O_DIRECT flag
for devices unexpectedly.

Turned out ignoring direct-io was a problem after all :).

Fixes: 0f51b5bacb (Do not run sector read check on suspended device.)
This commit is contained in:
Ondrej Kozina
2024-08-22 13:39:06 +02:00
committed by Milan Broz
parent 297a80098b
commit 7d7b3d87c2

View File

@@ -178,7 +178,7 @@ static int device_ready(struct crypt_device *cd, struct device *device)
if (devfd >= 0) {
/* skip check for suspended DM devices */
dm_name = device_dm_name(device);
if (dm_name && dm_status_suspended(cd, dm_name)) {
if (dm_name && dm_status_suspended(cd, dm_name) > 0) {
close(devfd);
devfd = -1;
} else if (device_read_test(devfd) == 0) {