kpartx -d fails with image paths longer than 63 characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
multipath-tools (Ubuntu) |
Fix Released
|
Undecided
|
Mathieu Trudel-Lapierre | ||
Precise |
Won't Fix
|
Medium
|
Mathieu Trudel-Lapierre | ||
Trusty |
In Progress
|
Medium
|
Mathieu Trudel-Lapierre | ||
Utopic |
Won't Fix
|
Undecided
|
Unassigned | ||
Vivid |
Won't Fix
|
Medium
|
Mathieu Trudel-Lapierre |
Bug Description
[Impact]
Users of kpartx to load disk images, possibly multiple images with the same file name (but in different paths).
[Test case]
See below, also see https:/
[Regression potential]
This changes makes the matching for loaded images more robust, and so has a very limited risk of regression. Since there is a call to stat() introduced, one may notice a slowdown if the stat() call blocks for a reason, and the operation will fail if the stat() call fails for any reason, since the device and inode are now required.
---
$ apt-show-versions multipath-tools
multipath-
Reproduce:
Mount an image from a path longer than 63 chars succeeds:
$ sudo kpartx -av asfd1asdf2asdf3
add map loop0p1 (252:0): 0 409600 linear /dev/loop0 2048
add map loop0p2 (252:1): 0 2 linear /dev/loop0 411648
add map loop0p5 : 0 819200 linear /dev/loop0 413696
add map loop0p6 : 0 819200 linear /dev/loop0 1234944
add map loop0p7 : 0 819200 linear /dev/loop0 2056192
add map loop0p8 : 0 1316864 linear /dev/loop0 2877440
but dismounting fails:
$ sudo kpartx -dv asfd1asdf2asdf3
strace shows that the parameter on the dismount appears to get cut at 63 chars:
ioctl(3, DM_LIST_VERSIONS, 0x15b89b0) = 0
stat("asfd1asdf
stat("/dev/loop0", {st_mode=
open("/dev/loop0", O_RDONLY) = 4
ioctl(4, LOOP_GET_STATUS, {number=0, offset=0, flags=0, name="asfd1asdf
close(4) = 0
stat("/dev/loop1", {st_mode=
open("/dev/loop1", O_RDONLY) = 4
ioctl(4, LOOP_GET_STATUS, {number=0, offset=0, flags=0, name="asfd1asdf
if the path is 63 chars or less, the dismount also succeeds.
This is quickly becomes an issue if you want to use full disk paths in your shell scripts.
Related branches
- Mathieu Trudel-Lapierre: Disapprove
- Chris J Arges: Needs Resubmitting
-
Diff: 59 lines (+39/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/1003-Fixing-the-find_loop_by_file-function-to-properly.patch (+30/-0)
debian/patches/series (+1/-0)
Changed in multipath-tools (Ubuntu Utopic): | |
status: | New → Won't Fix |
Changed in multipath-tools (Ubuntu Vivid): | |
status: | New → In Progress |
Changed in multipath-tools (Ubuntu Trusty): | |
status: | New → In Progress |
Changed in multipath-tools (Ubuntu Precise): | |
status: | New → In Progress |
importance: | Undecided → Medium |
Changed in multipath-tools (Ubuntu Trusty): | |
importance: | Undecided → Medium |
Changed in multipath-tools (Ubuntu Vivid): | |
importance: | Undecided → Medium |
Changed in multipath-tools (Ubuntu Precise): | |
assignee: | nobody → Mathieu Trudel-Lapierre (mathieu-tl) |
Changed in multipath-tools (Ubuntu Trusty): | |
assignee: | nobody → Mathieu Trudel-Lapierre (mathieu-tl) |
Changed in multipath-tools (Ubuntu Vivid): | |
assignee: | nobody → Mathieu Trudel-Lapierre (mathieu-tl) |
description: | updated |
Status changed to 'Confirmed' because the bug affects multiple users.