]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: add debug message for private DM device skip
authorKarel Zak <kzak@redhat.com>
Mon, 16 Mar 2026 10:43:19 +0000 (11:43 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Mar 2026 10:43:19 +0000 (11:43 +0100)
Add a DBG() trace and set errno = EINVAL when
blkid_new_probe_from_filename() skips a private device-mapper
device, to aid troubleshooting and distinguish from I/O errors.

Addresses: https://github.com/util-linux/util-linux/pull/4120
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/probe.c

index d47c22c720433d0826835f11b6260f30833147b8..fba7eb1240afb68be5ac5b7808229d9fb6963681 100644 (file)
@@ -224,8 +224,11 @@ blkid_probe blkid_new_probe_from_filename(const char *filename)
         * DM_DEVICE_REMOVE would otherwise see EBUSY.
         */
        if (stat(filename, &sb) == 0 && S_ISBLK(sb.st_mode) &&
-           sysfs_devno_is_dm_private(sb.st_rdev, NULL))
+           sysfs_devno_is_dm_private(sb.st_rdev, NULL)) {
+               DBG(LOWPROBE, ul_debug("ignore private device mapper device"));
+               errno = EINVAL;
                return NULL;
+       }
 
        fd = open(filename, O_RDONLY | O_CLOEXEC | O_NONBLOCK);
        if (fd < 0)