On Mon, 2017-05-08 at 08:33 +0200, Hannes Reinecke wrote: > On 05/06/2017 12:30 AM, Martin Wilck wrote: > > On Fri, 2017-05-05 at 23:18 +0100, Alasdair G Kergon wrote: > > > On Sat, May 06, 2017 at 12:05:49AM +0200, Martin Wilck wrote: > > > > 3) kpartx should only delete "partitions", which are single- > > > > target > > > > linear mappings into a block device. Other maps should not > > > > be > > > > touched. > > > > > > The prefix on the dm device's uuid should guarantee this: all > > > devices > > > kpartx creates should have the same initial characters (a > > > not-quite-standard form "part" IIRC instead of "KPARTX-") and any > > > devices without those initial characters must be ignored. > > > > This works only for partitions on DM devices, not e.g. for loop > > devices. These devices obviously have no DM UUID; and thus kpartx > > also > > doesn't set an UUID for the partition devices it creates. > > That's the main point of this series. > > > > I beg to differ. > > The main point is to _set_ an UUID for all kpartx-generated devices. > But to make matters consistent I'm siding with Alasdair here, namely > that any kpartx-generated UUID should be starting with 'part-'. > So I'm fine with adding a UUID, but this UUID _must_ start with > 'part-'. Well, not quite. It must start with "part%u-". It does so in my patch set. Like UUIDs created partitions on DM devices, kpartx-generated partitions for non-DM devices start with part$N, where $N is the partition number (without my patch set, these partitions devices have _no UUID_). The full partition UUID for partitions used by my code looks like this (see patch 08/10): {UUID_PREFIX}${MAJOR}:${MINOR}-${NONDM_UUID_SUFFIX}" This format fulfills the constraints of dm_compare_uuid(). The only change I had to introduce for dm_compare_uuid() was to remove the check for "mpath-" (patch 04/10), which was obviously wrong for non-multipath devices. It's correct to have that check in libmultipath/devmapper.c, but not in kpartx/devmapper.c. Moreover, by including $MAJOR:$MINOR of the parent device, this format makes it possible to check whether the given partition device matches the given parent device whose partitions are supposed to be deleted, and with the nontrivial suffix, takes precations against casual UUID conflicts. For DM devices, my patch set introduces no changes (of course). Martin -- Dr. Martin Wilck <mwilck@xxxxxxxx>, Tel. +49 (0)911 74053 2107 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel