Le 2016-01-20 09:53, Christophe Varoqui a écrit :
> Applied,
> thanks.
> 

This patch apparently breaks the use of loopback-mounted files if you
try to use them directly with kpartx -av.

For instance:
qemu-img create foo.img 20M
sgdisk -n 1 foo.img
kpartx -av foo.img


Fails with the following error:
device-mapper: reload ioctl on loop0p1 failed: No such device
create/reload failed on loop0p1
add map loop0p1 (0:0): 0 4192256 linear 0:0 2048


This can be fixed by stat()'ing the loop device again after picking it:

--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -322,6 +322,11 @@ main(int argc, char **argv){
                        loopcreated = 1;
                }
                device = loopdev;
+
+               if (stat(device, &buf)) {
+                       printf("failed to stat() %s\n", device);
+                       exit (1);
+               }
        }

        off = find_devname_offset(device);




-- 
Mathieu Trudel-Lapierre <[email protected]>
Freenode: cyphermox, Jabber: [email protected]
4096R/65B58DA1 818A D123 0992 275B 23C2  CF89 C67B B4D6 65B5 8DA1

Attachment: signature.asc
Description: OpenPGP digital signature

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to