diff mbox

[02/10] kpartx: avoid ioctl error for loop devices

Message ID 20170505220559.7248-3-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Martin Wilck May 5, 2017, 10:05 p.m. UTC
Commit 3d709241 causes kpartx to attempt a dm ioctl on a loop
device. This causes an error message
"device-mapper: table ioctl on loop4 failed: No such device or address".

Fixes: 3d709241 "kpartx: sanitize delete partitions"
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 kpartx/kpartx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Benjamin Marzinski May 8, 2017, 8:46 p.m. UTC | #1
dm_no_partitions() checks if features includes "no_partitions", but the
upstream kernel doesn't allow that feature.  The patch to add it got
NAKed when Hannes posted it, IIRC. That's why I went the route of using
udev flags to avoid running kpartx.  Unless SUSE (or some other distro)
is using the "no_partitions" patch in their kernel, we can pull the
dm_no_partitions code completely.

If you're still using it, I'm fine with this patch.
-Ben

On Sat, May 06, 2017 at 12:05:51AM +0200, Martin Wilck wrote:
> Commit 3d709241 causes kpartx to attempt a dm ioctl on a loop
> device. This causes an error message
> "device-mapper: table ioctl on loop4 failed: No such device or address".
> 
> Fixes: 3d709241 "kpartx: sanitize delete partitions"
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  kpartx/kpartx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
> index 58e60ffe..e9b09492 100644
> --- a/kpartx/kpartx.c
> +++ b/kpartx/kpartx.c
> @@ -362,7 +362,7 @@ main(int argc, char **argv){
>  
>  	if (!mapname)
>  		mapname = device + off;
> -	if (!force_devmap &&
> +	else if (!force_devmap &&
>  		 dm_no_partitions(mapname)) {
>  		/* Feature 'no_partitions' is set, return */
>  		return 0;
> -- 
> 2.12.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Martin Wilck May 11, 2017, 9:33 a.m. UTC | #2
On Mon, 2017-05-08 at 15:46 -0500, Benjamin Marzinski wrote:
> dm_no_partitions() checks if features includes "no_partitions", but
> the
> upstream kernel doesn't allow that feature.  The patch to add it got
> NAKed when Hannes posted it, IIRC. That's why I went the route of
> using
> udev flags to avoid running kpartx.  Unless SUSE (or some other
> distro)
> is using the "no_partitions" patch in their kernel, we can pull the
> dm_no_partitions code completely.
> 
> If you're still using it, I'm fine with this patch.

The SUSE kernel supports this feature. But after discussing with
Hannes, I see no problem with removing it from upstream multipath-tools 
and making it a SUSE-specific feature in our code base.

Martin
diff mbox

Patch

diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 58e60ffe..e9b09492 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -362,7 +362,7 @@  main(int argc, char **argv){
 
 	if (!mapname)
 		mapname = device + off;
-	if (!force_devmap &&
+	else if (!force_devmap &&
 		 dm_no_partitions(mapname)) {
 		/* Feature 'no_partitions' is set, return */
 		return 0;