From: Michael McMaster <michael@codesrc.com>
To: linux-btrfs@vger.kernel.org
Subject: Patch for resolving loop devices
Date: Tue, 11 Dec 2012 21:16:53 +1000 [thread overview]
Message-ID: <50C71625.1010003@codesrc.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 712 bytes --]
I experienced an error where mkfs.btrfs failed when an unrelated
cryptoloop device was mounted.
$ sudo /tmp/btrfs-progs/mkfs.btrfs /dev/mapper/mydisk
WARNING! - Btrfs v0.20-rc1-37-g91d9eec-dirty IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
error checking /dev/mapper/mydisk mount status
$ sudo losetup -a
/dev/loop0: [0014]:71314 (/home/michael/loopfile), encryption aes (type 18)
I found that resolve_loop_device() method in utils.c was returning "aes"
as the associated file, instead of /home/michael/loopfile. This
eventually causes the realpath() call in is_same_blk_file() to fail. The
attached patch fixes this problem.
Regards,
Michael McMaster
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: utils.c.patch --]
[-- Type: text/x-patch; name="utils.c.patch", Size: 636 bytes --]
--- utils.c.orig 2012-12-11 21:00:07.000000000 +1000
+++ utils.c 2012-12-11 21:00:26.000000000 +1000
@@ -653,16 +653,16 @@
{
int loop_fd;
int ret_ioctl;
- struct loop_info loopinfo;
+ struct loop_info64 loopinfo;
if ((loop_fd = open(loop_dev, O_RDONLY)) < 0)
return -errno;
- ret_ioctl = ioctl(loop_fd, LOOP_GET_STATUS, &loopinfo);
+ ret_ioctl = ioctl(loop_fd, LOOP_GET_STATUS64, &loopinfo);
close(loop_fd);
if (ret_ioctl == 0) {
- strncpy(loop_file, loopinfo.lo_name, max_len);
+ strncpy(loop_file, loopinfo.lo_file_name, max_len);
if (max_len > 0)
loop_file[max_len-1] = 0;
} else
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]
reply other threads:[~2012-12-11 11:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=50C71625.1010003@codesrc.com \
--to=michael@codesrc.com \
--cc=linux-btrfs@vger.kernel.org \
/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.