From: Zdenek Kabelac Date: Tue, 10 Dec 2019 12:28:16 +0000 (+0100) Subject: libdm: support device RELOAD with maj:min and devname set X-Git-Tag: v2_03_08~62 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=df0bc5081c1b84c2ae7c8d8dc92305f90f161683;p=lvm2.git 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. --- diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index b64a9a221..a1e233e67 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.169 - ===================================== + Enhance error messages for device creation. Version 1.02.167 - 30th November 2019 ===================================== 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 ? ":" : "",