<div dir="ltr">The set is merged, thanks.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 17, 2017 at 7:06 PM, Benjamin Marzinski <span dir="ltr"><<a href="mailto:bmarzins@redhat.com" target="_blank">bmarzins@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, May 15, 2017 at 05:37:10PM +0200, Martin Wilck wrote:<br>
<br>
ACK for the set<br>
<br>
-Ben<br>
<div class="HOEnZb"><div class="h5"><br>
> Working on a bug report about kpartx not properly removing<br>
> partitions for loop devices, I realized a number of glitches<br>
> and improperly handled corner cases in the kpartx code for<br>
> deleting partitions. Some mappings are not deleted although<br>
> they should be, and others are deleted although that is clearly<br>
> wrong.<br>
><br>
> This patch series fixes the issues I found. The series starts<br>
> with a test program demonstrating the problems. The program<br>
> succeeds only after all patches of this series are applied.<br>
><br>
> Here is my summary of what I think how kpartx should behave:<br>
><br>
>   1) kpartx should delete all mappings it created beforehand.<br>
>   2) kpartx should handle partitions on dm devices and other devices<br>
>      (e.g. loop devices) equally well.<br>
>   3) kpartx should only delete "partitions", which are single-target<br>
>      linear mappings into a block device. Other maps should not be touched.<br>
>   4) kpartx should only delete mappings it created itself beforehand.<br>
>      In particular, it shouldn't delete LVM LVs, even if they are fully<br>
>      contained in the block device at hand and thus look like partitions<br>
>      in the first place. (For historical compatibility reasons, allow<br>
>      such mappings to be deleted with the -f/--force flag).<br>
>   5) DM map names may be changed, thus kpartx shouldn't rely on them to<br>
>      check whether a mapping is a partition of a particular device. It is<br>
>      legal for a partition of /dev/loop0 to be named "loop0".<br>
><br>
> One patch has an obvious libdevmapper equivalent and is therefore<br>
> included (08/12) although this series is otherwise focused only on kpartx.<br>
> Patch 04/12 would also have a libdevmapper equivalent, but I haven't<br>
> included it because it would conflict with Ben's previously posted<br>
> patch "libmultipath: fix partition detection".<br>
><br>
> The patches are based on Christophe's tree; Christophe, if you prefer,<br>
> I can rebase them on top of Ben's late submissions.<br>
><br>
> Feedback is welcome.<br>
><br>
> Changes wrt v1:<br>
> - Test program (01/12): improved cleanup, and used "kpartx -s" rather than waiting.<br>
> - At Ben's suggestion, removed "no_partitions" support rather than fixing it.<br>
> - Previous 04/12 split into two patches (04+05/12), improving and separating<br>
>   out the part that would similarly apply to libmultipath (see above).<br>
> - New UUID format in patch 09/12 since the previous one wasn't well-received;<br>
>   the "-kpartx-" part was superfluous, as partition UUIDs start with "part%s-" anyway.<br>
> - Added the trivial fix 12/12.<br>
><br>
> Martin Wilck (12):<br>
>   kpartx: test-kpartx: new unit test program<br>
>   kpartx: remove "no_partitions" support<br>
>   kpartx: remove is_loop_device<br>
>   kpartx: relax and improve UUID check in dm_compare_uuid<br>
>   kpartx: dm_remove_partmaps: support non-dm devices<br>
>   kpartx: dm_devn: return error for non-existent device<br>
>   kpartx: don't treat multi-linear mappings as partitions<br>
>   libmultipath: don't treat multi-linear mappings as partitions<br>
>   kpartx: use partition UUID for non-DM devices<br>
>   kpartx: use absolute path for regular files<br>
>   kpartx: find_loop_by_file: use sysfs<br>
>   kpartx: include sys/sysmacros.h<br>
><br>
>  kpartx/devmapper.c       |  80 ++++++---------<br>
>  kpartx/devmapper.h       |   2 +-<br>
>  kpartx/kpartx.c          |  50 ++++++++--<br>
>  kpartx/lopart.c          |  75 ++++++--------<br>
>  kpartx/lopart.h          |   1 -<br>
>  kpartx/sysmacros.h       |   9 --<br>
>  kpartx/test-kpartx       | 254 ++++++++++++++++++++++++++++++<wbr>+++++++++++++++++<br>
>  libmultipath/devmapper.c |  15 +--<br>
>  8 files changed, 371 insertions(+), 115 deletions(-)<br>
>  delete mode 100644 kpartx/sysmacros.h<br>
>  create mode 100755 kpartx/test-kpartx<br>
><br>
> --<br>
> 2.12.2<br>
</div></div></blockquote></div><br></div>