1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-23 13:57:47 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2019-12-10 13:28:16 +01:00
parent 338f4df54b
commit df0bc5081c
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.169 -
=====================================
Enhance error messages for device creation.
Version 1.02.167 - 30th November 2019
=====================================

View File

@ -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 ? ":" : "",