Skip to contentSkip to conversation

master - devices: handle partscan loop devices

PATCH Zdenek Kabelac 1 participant 1 message Jun 1, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d37a26b680f6c7ca9ec0bb1ce0cca189d19b525f
Commit:        d37a26b680f6c7ca9ec0bb1ce0cca189d19b525f
Parent:        3d333e5a296eba8ba2858ca007699fe70ec8083e
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Jun 1 16:39:47 2016 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Jun 1 17:37:47 2016 +0200

devices: handle partscan loop devices

Treat loop device created with 'losetup -P' as regular partitioned device - so if it has partition table, prevent its usage in commands like 'pvcreate'.

Before 'pvcreate /dev/loop0' could have erased and formated as PV, after this patch, device is filtered out and cannot be used.

---
 WHATS_NEW             |    1 +
 lib/device/dev-type.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 lib/device/dev-type.h |    1 +
 3 files changed, 45 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index 1bad12a..74b5bdb 100644
@@ -1,5 +1,6 @@
 Version 2.02.155 - 
 ================================
+  Automatically filter out partitioned loop devices with partscan (losetup -P).
   Fix lvm devtypes internal error if -S used with field name from pvs/vgs/lvs.
   When reporting Data%,Snap%,Meta%,Cpy%Sync use single ioctl per LV.
   Add lvseg_percent_with_info_and_seg_status() for percent retrieval.
lib/device/dev-type.c +43 -0

67 lines not on this page · raw message

lib/device/dev-type.h +1 -0
index 6438b44..267b79f 100644
@@ -43,6 +43,7 @@ struct dev_types {
 	int emcpower_major;
 	int power2_major;
 	int dasd_major;
+	int loop_major;
 	struct dev_type_def dev_type_array[NUMBER_OF_MAJORS];
 };