From 53198bdea94e610e1e0378e3aff56e8d9f45ac09 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Thu, 22 Aug 2024 13:39:06 +0200 Subject: [PATCH 01/10] 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: 0f51b5bacbf7 (Do not run sector read check on suspended device.) --- lib/utils_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils_device.c b/lib/utils_device.c index 3e2ac4f3..eccaf048 100644 --- a/lib/utils_device.c +++ b/lib/utils_device.c @@ -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) { -- 2.46.0