Detect unsupported zoned devices for LUKS header device.

Zoned device cannot be written with direct-io
and cannot be used for LUKS header logic without
significant changes. Do not allow to use them for LUKS header
but allow it for data device, as dm-crypt supports it.

Fixes: #877
This commit is contained in:
Milan Broz
2024-04-26 11:24:15 +02:00
parent 40e5c7d095
commit 410a586284
5 changed files with 68 additions and 0 deletions

View File

@@ -1007,6 +1007,22 @@ int device_is_dax(struct device *device)
return crypt_dev_is_dax(major(st.st_rdev), minor(st.st_rdev));
}
int device_is_zoned(struct device *device)
{
struct stat st;
if (!device)
return -EINVAL;
if (stat(device_path(device), &st) < 0)
return -EINVAL;
if (!S_ISBLK(st.st_mode))
return 0;
return crypt_dev_is_zoned(major(st.st_rdev), minor(st.st_rdev));
}
size_t device_alignment(struct device *device)
{
int devfd;