mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Do not run sector read check on suspended device.
This can affect status command, but later also device stack with authenticated encryption (*_dif device). Ignoring direct-io should not be problem here. The logic shoudl be simplified in future anyway...
This commit is contained in:
@@ -178,6 +178,7 @@ static int device_ready(struct crypt_device *cd, struct device *device)
|
||||
int devfd = -1, r = 0;
|
||||
struct stat st;
|
||||
size_t tmp_size;
|
||||
const char *dm_name;
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
@@ -188,7 +189,12 @@ static int device_ready(struct crypt_device *cd, struct device *device)
|
||||
device->o_direct = 0;
|
||||
devfd = open(device_path(device), O_RDONLY | O_DIRECT);
|
||||
if (devfd >= 0) {
|
||||
if (device_read_test(devfd) == 0) {
|
||||
/* skip check for suspended DM devices */
|
||||
dm_name = device_dm_name(device);
|
||||
if (dm_name && dm_status_suspended(cd, dm_name)) {
|
||||
close(devfd);
|
||||
devfd = -1;
|
||||
} else if (device_read_test(devfd) == 0) {
|
||||
device->o_direct = 1;
|
||||
} else {
|
||||
close(devfd);
|
||||
|
||||
Reference in New Issue
Block a user