kpartx: compare image filenames with backing files
authorYuval Turgeman <yturgema@redhat.com>
Mon, 16 Jul 2018 12:52:13 +0000 (15:52 +0300)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 7 Aug 2018 13:28:04 +0000 (15:28 +0200)
commitc1adcc5ba452bb1252c97c8066e340433976c23e
treee005c82a41e0abd1b8afcd37c5c7c6c52bbf7088
parent8082592e5817be5d54b423bd507bcddea605a667
kpartx: compare image filenames with backing files

When running `kpartx -d`, find_loop_by_file tries to compare the image's
realpath with the output from loopinfo.lo_name, which may hold only the
basename of the image, making kpartx exit without finding the loopdev
for the image.

In case the original comparison fails, this patch will check the image's
realpath with the loop device's backing_file so that find_loop_by_file
will return the correct value.

Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
kpartx/lopart.c