summaryrefslogtreecommitdiff
path: root/libdm/ioctl
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2019-12-10 13:28:16 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2019-12-10 15:42:59 +0100
commitdf0bc5081c1b84c2ae7c8d8dc92305f90f161683 (patch)
treedfc3f545a20bbba1755d6e65a012120f171773a4 /libdm/ioctl
parent338f4df54ba19244c4cf51c9ad6461ef5613ed5f (diff)
downloadlvm2-df0bc5081c1b84c2ae7c8d8dc92305f90f161683.tar.gz
libdm: support device RELOAD with maj:min and devname set
When devices are created - we were not giving meaning error messages when the failure happened on 'reload' part of creation. With this patch we are now able to report both name and major:minor. Enhancment is most visible with 'crypto' devices, which are using 'secure' memory erase bit.
Diffstat (limited to 'libdm/ioctl')
-rw-r--r--libdm/ioctl/libdm-iface.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index dd46b674a..ae44abfc9 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1238,8 +1238,12 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
}
/* FIXME Until resume ioctl supplies name, use dev_name for readahead */
- if (DEV_NAME(dmt) && (dmt->type != DM_DEVICE_RESUME || dmt->minor < 0 ||
- dmt->major < 0))
+ if (DEV_NAME(dmt) &&
+ (((dmt->type != DM_DEVICE_RESUME) &&
+ (dmt->type != DM_DEVICE_RELOAD)) ||
+ (dmt->minor < 0) || (dmt->major < 0)))
+ /* When RESUME or RELOAD sets maj:min and dev_name, use just maj:min,
+ * passed dev_name is useful for better error/debug messages */
strncpy(dmi->name, DEV_NAME(dmt), sizeof(dmi->name));
if (DEV_UUID(dmt))
@@ -1904,7 +1908,8 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
log_verbose("device-mapper: %s ioctl on %s %s%s%.0d%s%.0d%s%s "
"failed: %s",
_cmd_data_v4[dmt->type].name,
- dmi->name, dmi->uuid,
+ dmi->name[0] ? dmi->name : DEV_NAME(dmt) ? : "",
+ dmi->uuid[0] ? dmi->uuid : DEV_UUID(dmt) ? : "",
dmt->major > 0 ? "(" : "",
dmt->major > 0 ? dmt->major : 0,
dmt->major > 0 ? ":" : "",
@@ -1916,7 +1921,8 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
log_error("device-mapper: %s ioctl on %s %s%s%.0d%s%.0d%s%s "
"failed: %s",
_cmd_data_v4[dmt->type].name,
- dmi->name, dmi->uuid,
+ dmi->name[0] ? dmi->name : DEV_NAME(dmt) ? : "",
+ dmi->uuid[0] ? dmi->uuid : DEV_UUID(dmt) ? : "",
dmt->major > 0 ? "(" : "",
dmt->major > 0 ? dmt->major : 0,
dmt->major > 0 ? ":" : "",