For non-existent maps (ENXIO from ioctl()), dm_task_run and dm_task_get_info return success. We need to check info.exists. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- kpartx/devmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c index b7a7390c..6cee120d 100644 --- a/kpartx/devmapper.c +++ b/kpartx/devmapper.c @@ -295,7 +295,7 @@ dm_devn (const char * mapname, int *major, int *minor) if (!dm_task_run(dmt)) goto out; - if (!dm_task_get_info(dmt, &info)) + if (!dm_task_get_info(dmt, &info) || info.exists == 0) goto out; *major = info.major; -- 2.12.2 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel