[dm-devel] [PATCH 05/10] kpartx: dm_devn: return error for non-existent device
Martin Wilck
mwilck at suse.com
Fri May 5 22:05:54 UTC 2017
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 at suse.com>
---
kpartx/devmapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
index 8f48a705..d6ccd000 100644
--- a/kpartx/devmapper.c
+++ b/kpartx/devmapper.c
@@ -293,7 +293,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
More information about the dm-devel
mailing list