All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] fixes for kpartx -d
@ 2017-05-05 22:05 Martin Wilck
  2017-05-05 22:05 ` [PATCH 01/10] kpartx: test-kpartx: new unit test program Martin Wilck
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Martin Wilck @ 2017-05-05 22:05 UTC (permalink / raw)
  To: Christophe Varoqui, Hannes Reinecke, Benjamin Marzinski; +Cc: dm-devel

Working on a bug report about kpartx not properly removing
partitions for loop devices, I realized a number of glitches
and improperly handled corner cases in the kpartx code for
deleting partitions. Some mappings are not deleted although
they should be, and others are deleted although that is clearly
wrong.

This patch series fixes the issues I found. The series starts
with a test program demonstrating the problems. The program
succeeds only after all patches of this series are applied.

Here is my summary of what I think how kpartx should behave:

  1) kpartx should delete all mappings it created beforehand.
  2) kpartx should handle partitions on dm devices and other devices
     (e.g. loop devices) equally well.
  3) kpartx should only delete "partitions", which are single-target
     linear mappings into a block device. Other maps should not be touched.
  4) kpartx should only delete mappings it created itself beforehand.
     In particular, it shouldn't delete LVM LVs, even if they are fully
     contained in the block device at hand and thus look like partitions
     in the first place. (For historical compatibility reasons, allow
     such mappings to be deleted with the -f/--force flag).
  5) DM map names may be changed, thus kpartx shouldn't rely on them to
     check whether a mapping is a partition of a particular device. It is
     legal for a partition of /dev/loop0 to be named "loop0".

One patch has an obvious libdevmapper equivalent and is therefore
included although this series is otherwise focused only on kpartx.

Feedback is welcome.

Martin Wilck (10):
  kpartx: test-kpartx: new unit test program
  kpartx: avoid ioctl error for loop devices
  kpartx: remove is_loop_device
  kpartx: dm_remove_partmaps: support non-dm devices
  kpartx: dm_devn: return error for non-existent device
  kpartx: don't treat multi-linear mappings as partitions
  libmultipath: don't treat multi-linear mappings as partitions
  kpartx: use partition UUID for non-DM devices
  kpartx: use absolute path for regular files
  kpartx: find_loop_by_file: use sysfs

 kpartx/devmapper.c       |  39 +++++---
 kpartx/devmapper.h       |   2 +-
 kpartx/kpartx.c          |  42 +++++++-
 kpartx/lopart.c          |  73 ++++++--------
 kpartx/lopart.h          |   1 -
 kpartx/test-kpartx       | 253 +++++++++++++++++++++++++++++++++++++++++++++++
 libmultipath/devmapper.c |  15 +--
 7 files changed, 356 insertions(+), 69 deletions(-)
 create mode 100755 kpartx/test-kpartx

-- 
2.12.2

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-05-11  9:33 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 22:05 [PATCH 00/10] fixes for kpartx -d Martin Wilck
2017-05-05 22:05 ` [PATCH 01/10] kpartx: test-kpartx: new unit test program Martin Wilck
2017-05-05 22:05 ` [PATCH 02/10] kpartx: avoid ioctl error for loop devices Martin Wilck
2017-05-08 20:46   ` Benjamin Marzinski
2017-05-11  9:33     ` Martin Wilck
2017-05-05 22:05 ` [PATCH 03/10] kpartx: remove is_loop_device Martin Wilck
2017-05-05 22:05 ` [PATCH 04/10] kpartx: dm_remove_partmaps: support non-dm devices Martin Wilck
2017-05-05 22:05 ` [PATCH 05/10] kpartx: dm_devn: return error for non-existent device Martin Wilck
2017-05-05 22:05 ` [PATCH 06/10] kpartx: don't treat multi-linear mappings as partitions Martin Wilck
2017-05-05 22:05 ` [PATCH 07/10] libmultipath: " Martin Wilck
2017-05-05 22:05 ` [PATCH 08/10] kpartx: use partition UUID for non-DM devices Martin Wilck
2017-05-05 22:30   ` Alasdair G Kergon
2017-05-08  8:01     ` Martin Wilck
2017-05-05 22:05 ` [PATCH 09/10] kpartx: use absolute path for regular files Martin Wilck
2017-05-05 22:05 ` [PATCH 10/10] kpartx: find_loop_by_file: use sysfs Martin Wilck
2017-05-05 22:18 ` [PATCH 00/10] fixes for kpartx -d Alasdair G Kergon
2017-05-05 22:30   ` Martin Wilck
2017-05-05 22:36     ` Martin Wilck
2017-05-08  6:33     ` Hannes Reinecke
2017-05-08  7:47       ` Martin Wilck
2017-05-08  7:54         ` Martin Wilck
2017-05-08 22:21 ` Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.