]> sourceware.org Git - lvm2.git/commitdiff
libdm: support device RELOAD with maj:min and devname set
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 10 Dec 2019 12:28:16 +0000 (13:28 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 10 Dec 2019 14:42:59 +0000 (15:42 +0100)
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.

WHATS_NEW_DM
libdm/ioctl/libdm-iface.c

index b64a9a2213aee442e03c1f15e065eb7222bf0cc0..a1e233e67ebdc58623f2af98003e33539cd20b8d 100644 (file)
@@ -1,5 +1,6 @@
 Version 1.02.169 - 
 =====================================
+  Enhance error messages for device creation.
 
 Version 1.02.167 - 30th November 2019
 =====================================
index dd46b674a620970980262c4f89192e23a51fc302..ae44abfc9db3bdd6624b85a38b51db775b20249f 100644 (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 ? ":" : "",
This page took 0.049526 seconds and 5 git commands to generate.