From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
To: dm-devel@redhat.com
Subject: [PATCH] Fix loopback file with kpartx -av
Date: Tue, 2 Feb 2016 16:37:51 -0500 [thread overview]
Message-ID: <56B121AF.6090100@canonical.com> (raw)
In-Reply-To: <CABr-GnfeNpQPcuoRSLHTA5q8E3OF8as1zOTY7SP=bwMwtC=MFQ@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1158 bytes --]
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@canonical.com>
Freenode: cyphermox, Jabber: mathieu.tl@gmail.com
4096R/65B58DA1 818A D123 0992 275B 23C2 CF89 C67B B4D6 65B5 8DA1
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2016-02-02 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 13:52 [PATCH V2] kpartx: support device names with spaces Mauricio Faria de Oliveira
2016-01-20 14:53 ` Christophe Varoqui
2016-01-20 17:35 ` Mauricio Faria de Oliveira
2016-02-02 21:37 ` Mathieu Trudel-Lapierre [this message]
2016-02-03 8:27 ` [PATCH] Fix loopback file with kpartx -av 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=56B121AF.6090100@canonical.com \
--to=mathieu.trudel-lapierre@canonical.com \
--cc=dm-devel@redhat.com \
/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.