[Bug 313385] Re: losetup 32bit offset limit, hangs on retry, remains defunct
Phillip Susi
psusi at ubuntu.com
Thu Oct 10 02:04:06 UTC 2013
It looks like this was fixed some time ago.
** Changed in: util-linux (Ubuntu)
Status: New => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/313385
Title:
losetup 32bit offset limit, hangs on retry, remains defunct
Status in “util-linux” package in Ubuntu:
Fix Released
Bug description:
Binary package hint: util-linux
i made a dd image of my laptop drive and try to work with it (mount,
resizing etc).
# losetup -a
/dev/loop0: [fe01]:29253634 (/image.dd)
# fdisk -lu /dev/loop0
Disk /dev/loop0: 60.0 GB, 60011642880 bytes
240 heads, 63 sectors/track, 7752 cylinders, total 117210240 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x46514650
Device Boot Start End Blocks Id System
/dev/loop0p1 * 63 8814959 4407448+ b W95 FAT32
/dev/loop0p2 8814960 117210239 54197640 f W95 Ext'd (LBA)
/dev/loop0p5 8815023 117210239 54197608+ 7 HPFS/NTFS
the first partition is about 4,5GB, the rest is a logical partition.
i first tried to use http://vytautas.jakutis.lt/node/26 but that did not work and i did not look into it, because i knew of the offset method as described here http://www.fluidsignal.com/en/publications/knowledge/20080923090245 .
so... i tried to use the losetup -o option to create loop devices for the partitions.
offset = start block * 512
offset p1 = 63 * 512 = 32256
=> losetup -fo 32256 /dev/loop0
this worked ok (can't redo atm, see below)
offset p5 = 4513291776
this is > 2^32.
if i try to use that offset, it seems to work ok the first time (it returns instantly), but does not create a new loop device.
if you try it again, it hangs with consuming 100% cpu time of one core.
i straced it afterwards:
<libc stuff, locale stuff>
stat("/dev", {st_mode=S_IFDIR|0755, st_size=14560, ...}) = 0
stat("/dev/loop", 0x7fff3d71f7e0) = -1 ENOENT (No such file or directory)
stat("/dev/loop0", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 0), ...}) = 0
open("/dev/loop0", O_RDONLY) = 3
ioctl(3, 0x4c03, 0x7fff3d71f6f0) = 0
close(3) = 0
stat("/dev/loop1", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 1), ...}) = 0
open("/dev/loop1", O_RDONLY) = 3
ioctl(3, 0x4c03, 0x7fff3d71f6f0) = -1 EOVERFLOW (Value too large for defined data type)
close(3) = 0
open("/dev/loop0", O_RDWR) = 3
open("/dev/loop1", O_RDWR) = 4
readlink("/dev", 0x7fff3d71d620, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/loop0", 0x7fff3d71d620, 4096) = -1 EINVAL (Invalid argument)
ioctl(4, 0x4c00, 0x3) = -1 EBUSY (Device or resource busy)
close(4) = 0
close(3) = 0
here it loops:
stat("/dev", {st_mode=S_IFDIR|0755, st_size=14560, ...}) = 0
stat("/dev/loop", 0x7fff3d71f7e0) = -1 ENOENT (No such file or directory)
stat("/dev/loop0", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 0), ...}) = 0
open("/dev/loop0", O_RDONLY) = 3
ioctl(3, 0x4c03, 0x7fff3d71f6f0) = 0
close(3) = 0
stat("/dev/loop1", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 1), ...}) = 0
open("/dev/loop1", O_RDONLY) = 3
ioctl(3, 0x4c03, 0x7fff3d71f6f0) = -1 EOVERFLOW (Value too large for defined data type)
close(3) = 0
open("/dev/loop0", O_RDWR) = 3
open("/dev/loop1", O_RDWR) = 4
readlink("/dev", 0x7fff3d71d620, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/loop0", 0x7fff3d71d620, 4096) = -1 EINVAL (Invalid argument)
ioctl(4, 0x4c00, 0x3) = -1 EBUSY (Device or resource busy)
close(4) = 0
close(3) = 0
rinse repeat
i searched for help and found http://www.linuxforums.org/forum/redhat-fedora-linux-help/111777-losetup-offset-there-limit-overflow.html
that indicates, that there was a bug and it was fixed before 2.13-pre7.
i use util-linux 2.14-1ubuntu2
but maybe its an amd64 bug, since im running 64bit ubuntu 8.10.
after trying a too big offset, it is broken until reboot:
i cant use a small offset.
i cant detach the whole disk image.
i cant rmmod loop.
after reboot:
# ll
total 58662416
drwxr-xr-x 2 root root 4096 2009-01-03 05:27 d
-rwxr--r-- 1 ameno ameno 60011642880 2009-01-02 18:29 file.dd
# losetup -a
# losetup -f file.dd
# losetup -fo 32256 /dev/loop0
# losetup -a
/dev/loop0: [fe01]:29253634 (/platz/vbox/file.dd)
/dev/loop1: [000e]:6209 (/dev/loop0), offset 32256
# mount /dev/loop1 d
# ll d
total 410040
-rwxr-xr-x 1 root root 150528 2005-09-09 01:28 arcldr.exe
-rwxr-xr-x 1 root root 170 2008-03-24 15:00 boot.ini
drwxr-xr-x 6 root root 4096 2005-09-09 01:33 Documents and Settings
-rwxr-xr-x 1 root root 0 2005-09-09 01:28 io.sys
-rwxr-xr-x 1 root root 0 2005-09-09 01:28 msdos.sys
-rwxr-xr-x 1 root root 34724 2005-09-09 01:28 ntdetect.com
-rwxr-xr-x 1 root root 214432 2005-09-09 01:28 ntldr
-rwxr-xr-x 1 root root 419430400 2008-12-04 03:33 pagefile.sys
drwxr-xr-x 35 root root 4096 2005-09-09 01:33 Program Files
drwxr-xr-x 3 root root 12288 2005-09-09 01:45 Recycled
drwxr-xr-x 12 root root 4096 2007-11-15 20:07 WinAVR
drwxr-xr-x 51 root root 16384 2005-09-09 01:45 winnt
# umount d
# losetup -d /dev/loop1
# losetup -a
/dev/loop0: [fe01]:29253634 (/platz/vbox/file.dd)
# strace losetup -fo 4513291776 /dev/loop0
...
stat("/dev", {st_mode=S_IFDIR|0755, st_size=14560, ...}) = 0
stat("/dev/loop", 0x7fff1fb64c30) = -1 ENOENT (No such file or directory)
stat("/dev/loop0", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 0), ...}) = 0
open("/dev/loop0", O_RDONLY) = 3
ioctl(3, 0x4c03, 0x7fff1fb64b40) = 0
close(3) = 0
stat("/dev/loop1", {st_mode=S_IFBLK|0660, st_rdev=makedev(7, 1), ...}) = 0
open("/dev/loop1", O_RDONLY) = 3
ioctl(3, 0x4c03, 0x7fff1fb64b40) = -1 ENXIO (No such device or address)
close(3) = 0
open("/dev/loop0", O_RDWR) = 3
open("/dev/loop1", O_RDWR) = 4
readlink("/dev", 0x7fff1fb62a70, 4096) = -1 EINVAL (Invalid argument)
readlink("/dev/loop0", 0x7fff1fb62a70, 4096) = -1 EINVAL (Invalid argument)
ioctl(4, 0x4c00, 0x3) = 0
close(3) = 0
ioctl(4, 0x4c04, 0x7fff1fb64b40) = 0
close(4)...
# losetup -a
/dev/loop0: [fe01]:29253634 (/platz/vbox/file.dd)
#losetup -d /dev/loop0
ioctl: LOOP_CLR_FD: Device or resource busy
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/313385/+subscriptions
More information about the foundations-bugs
mailing list