Comment 3 for bug 1469143

Simo Punnonen (simo-punnonen) wrote :

If i understand correctly, the fix is to compare only the first 63 chars of the path.

With kpartx the precise file path matters in resolving the correct loop device, the suggested solution has the following consequence:

Assuming all loop devices are available, these commands succeed and mount their respective images to /dev/loop0 and /dev/loop1

$ sudo kpartx -av asfd1asdf2asdf3asdf4asdf5asdf6asfd7asdf8asdf9asf10asdf11asdf12asdf13/disk.img
$ sudo kpartx -av asfd1asdf2asdf3asdf4asdf5asdf6asfd7asdf8asdf9asf10asdf11asdf12asdf14/disk.img

Now, if i issue the following command:
$ sudo kpartx -dv asfd1asdf2asdf3asdf4asdf5asdf6asfd7asdf8asdf9asf10asdf11asdf12asdf14/disk.img

With the fix, if you only match the first 63 characters on dismount you likely end up dismounting the wrong one (probably loop0 as it's the first hit as the loops are iterated), as only the part of the path exceeding 63 chars is significant.

Probably something more elegant is required to fix this problem.