Re: [PATCH] Fix loopback file with kpartx -av

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commited,
Thanks.

On Tue, Feb 2, 2016 at 10:37 PM, Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@xxxxxxxxxxxxx> wrote:
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 <mathieu.trudel-lapierre@xxxxxxxxxxxxx>
Freenode: cyphermox, Jabber: mathieu.tl@xxxxxxxxx
4096R/65B58DA1 818A D123 0992 275B 23C2  CF89 C67B B4D6 65B5 8DA1


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux