All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Hannes Reinecke <hare@suse.de>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com
Subject: [PATCH v2 06/12] kpartx: dm_devn: return error for non-existent device
Date: Mon, 15 May 2017 17:37:16 +0200	[thread overview]
Message-ID: <20170515153722.11508-7-mwilck@suse.com> (raw)
In-Reply-To: <20170515153722.11508-1-mwilck@suse.com>

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@suse.com>
---
 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

  parent reply	other threads:[~2017-05-15 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 15:37 [PATCH v2 00/12] fixes for kpartx -d Martin Wilck
2017-05-15 15:37 ` [PATCH v2 01/12] kpartx: test-kpartx: new unit test program Martin Wilck
2017-05-15 15:37 ` [PATCH v2 02/12] kpartx: remove "no_partitions" support Martin Wilck
2017-05-15 15:37 ` [PATCH v2 03/12] kpartx: remove is_loop_device Martin Wilck
2017-05-15 15:37 ` [PATCH v2 04/12] kpartx: relax and improve UUID check in dm_compare_uuid Martin Wilck
2017-05-15 15:37 ` [PATCH v2 05/12] kpartx: dm_remove_partmaps: support non-dm devices Martin Wilck
2017-05-15 15:37 ` Martin Wilck [this message]
2017-05-15 15:37 ` [PATCH v2 07/12] kpartx: don't treat multi-linear mappings as partitions Martin Wilck
2017-05-15 15:37 ` [PATCH v2 08/12] libmultipath: " Martin Wilck
2017-05-15 15:37 ` [PATCH v2 09/12] kpartx: use partition UUID for non-DM devices Martin Wilck
2017-05-15 15:37 ` [PATCH v2 10/12] kpartx: use absolute path for regular files Martin Wilck
2017-05-15 15:37 ` [PATCH v2 11/12] kpartx: find_loop_by_file: use sysfs Martin Wilck
2017-05-15 15:37 ` [PATCH v2 12/12] kpartx: include sys/sysmacros.h Martin Wilck
2017-05-17 17:06 ` [PATCH v2 00/12] fixes for kpartx -d Benjamin Marzinski
2017-05-17 22:25   ` Christophe Varoqui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170515153722.11508-7-mwilck@suse.com \
    --to=mwilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.