[dm-devel] [PATCH 02/10] kpartx: avoid ioctl error for loop devices

Benjamin Marzinski bmarzins at redhat.com
Mon May 8 20:46:11 UTC 2017


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 at 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




More information about the dm-devel mailing list