| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
All is already covered by losetup and mount. The test program has
never been used in our regression tests.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Fixed unsuccessful attempt to find unused loop devices if 0-7
devices already used and /dev/loop directory exists.
|
|
|
|
|
|
|
|
|
| |
loopback lib clears the existing FD unconditionally at error in
loopcxt_setup_device(). This is done even after EBUSY, thus the second call
actually clears the previous setup wrongly.
Author: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
|
|
|
|
|
| |
Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On system with /dev/lop-control the udevd creates /dev/loopN nodes.
It seems better to wait a moment after unsuccessful open(/dev/loopN)
and try it to open again.
The problem is pretty visible on systems where udevd also modifies
permission for loopN devices, then open() fails with EACCES when
losetup executed by non-root user (but user who is in "disk" group).
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1045432
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Kernel aligns the device size, but the offset where the device starts
is not required to be aligned.
# losetup --offset 32 -f file.img
is just fine, the final size of the look device will be (in sectors)
(backing_file_size - offset) >> 9
so we have to do the same in userspace when we check for successful
set capacity ioctl.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now we use LOOP_CTL_GET_FREE ioctl to ask for free device, for example
losetup -f foo.img
Unfortunately, losetup(8) allows to ask for specified device
losetup /dev/loop100 foo.img
and in this case we assume that the device already exists in the
system. This is incorrect, we should be able to use loop-control
LOOP_CTL_ADD ioctl to ask for the specified device.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
References: https://bugs.archlinux.org/task/36189
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The loopcxt_check_size() is workaround for kernels < v3.9, kernel has
been fixed by commit 541c742a7559eb65f0e36d3e2338c2ca532a3e61.
The function sets loopdev size according to backing file size. The
problem is that the backing file could be a block device where
stat.st_size is zero, so we have to use blkdev_get_size() for block
devices.
Addresses: https://bugs.archlinux.org/task/35193
Reported-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I recently tried to mount an hfsplus file system from an image file with
a partition table by using the loop offset and sizelimit options to specify
the location of the file system.
hfsplus stores some metadata at a set offset from the end of the partition,
so it's sensitive to the device size reported by the kernel.
It worked with this:
But failed with this:
/dev/loop0: [0089]:2 (<imagefile>), offset 32768, sizelimit 102400000
/dev/loop1: [0089]:2 (<imagefile>), offset 32768, sizelimit 102400000
/proc/partitions shows the correct number of blocks to match the sizelimit.
But if I set a breakpoint in mount before the mount syscall, I could see:
102400000
102432768
The kernel loop driver will set the gendisk capacity of the device at
LOOP_SET_STATUS64 but won't sync it to the block device until one of two
conditions are met: All open file descriptors referring to the device are
closed (and it will sync when re-opened) or if the LOOP_SET_CAPACITY ioctl
is called to sync it. Since mount opens the device and passes it directly
to the mount syscall after LOOP_SET_STATUS64 without closing and reopening
it, the sizelimit argument is effectively ignroed. The capacity needs to
be synced immediately for it to work as expected.
This patch adds the LOOP_SET_CAPACITY call to loopctx_setup_device since
the device isn't yet released to the user, so it's safe to sync the capacity
immediately.
[kzak@redhat.com: - port to the current git HEAD,
- use uint64_t]
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
We use the code from include/ and lib/ on many places, so use public
domain if possible or LGPL for code copied from libs.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The current loopdev code prefers /sys to get information about
loop devices. The old methods like scan /dev are fallback solution
only. Unfortunately, the code does not check if /sys is mounted.
Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
kernel cryptoloop is deprecated since ages and support for cryptoloop
in util-linux is incomplete/broken.
- no password hashing
- last 8 bit of key are always set to zero
- no binary keys possible (stops reading key at \n and \0)
In the past some Distros added the above features with patches. So
remove cryptoloop support from util-linux completely to make sure
people won't try using it.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Missing semicolon made test_loop_info() to return function
loopcxt_enable_debug() return value, which happen to be void. I
suspect the loopcxt_enable_debug() was usually not executed, while it
should be.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
| |
Reported-by: Sergei Antonov <saproj@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
# ll ~/xxx2
-rw-r--r-- 1 root root 500 Jun 12 14:30 /root/xxx2
old version:
# losetup -a
new version:
# losetup -a
/dev/loop0: [2052]:535312 (/root/xxx2)
The new version scans /sys/block/loopN, kernel >= 2.6.37 is required
otherwise fallback to the original not-so-smart /proc/partitions scan.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=730266
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
- improve loop_info usage (don't call ioctl more than once)
- add functions to get devno and inode of the backing file
- add function for compare any file with backing file by devno + inode
or by filename
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
Found by clang.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
Should say "failed to find" instead of "failed to found".
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|