531551
diff -up util-linux-2.23.2/fdisks/fdisk.c.kzak util-linux-2.23.2/fdisks/fdisk.c
531551
--- util-linux-2.23.2/fdisks/fdisk.c.kzak	2015-07-02 12:37:24.465906322 +0200
531551
+++ util-linux-2.23.2/fdisks/fdisk.c	2015-07-02 12:37:57.870673753 +0200
531551
@@ -34,6 +34,7 @@
531551
 #include "canonicalize.h"
531551
 #include "strutils.h"
531551
 #include "closestream.h"
531551
+#include "sysfs.h"
531551
 
531551
 #include "fdisksunlabel.h"
531551
 #include "fdisksgilabel.h"
531551
diff -up util-linux-2.23.2/include/sysfs.h.kzak util-linux-2.23.2/include/sysfs.h
531551
--- util-linux-2.23.2/include/sysfs.h.kzak	2015-07-02 12:12:50.408196320 +0200
531551
+++ util-linux-2.23.2/include/sysfs.h	2015-07-02 12:13:09.708061372 +0200
531551
@@ -74,6 +74,8 @@ extern int sysfs_devno_to_wholedisk(dev_
531551
             size_t len, dev_t *diskdevno);
531551
 extern int sysfs_devno_is_wholedisk(dev_t devno);
531551
 
531551
+extern int sysfs_devno_is_lvm_private(dev_t devno);
531551
+
531551
 extern int sysfs_scsi_get_hctl(struct sysfs_cxt *cxt, int *h,
531551
 			       int *c, int *t, int *l);
531551
 extern char *sysfs_scsi_host_strdup_attribute(struct sysfs_cxt *cxt,
531551
diff -up util-linux-2.23.2/libblkid/src/blkidP.h.kzak util-linux-2.23.2/libblkid/src/blkidP.h
531551
--- util-linux-2.23.2/libblkid/src/blkidP.h.kzak	2015-07-02 12:18:27.349840375 +0200
531551
+++ util-linux-2.23.2/libblkid/src/blkidP.h	2015-07-02 12:19:07.797557558 +0200
531551
@@ -221,6 +221,7 @@ struct blkid_struct_probe
531551
 #define BLKID_FL_PRIVATE_FD	(1 << 1)	/* see blkid_new_probe_from_filename() */
531551
 #define BLKID_FL_TINY_DEV	(1 << 2)	/* <= 1.47MiB (floppy or so) */
531551
 #define BLKID_FL_CDROM_DEV	(1 << 3)	/* is a CD/DVD drive */
531551
+#define BLKID_FL_NOSCAN_DEV	(1 << 4)        /* do not scan this device */
531551
 
531551
 /* private per-probing flags */
531551
 #define BLKID_PROBE_FL_IGNORE_PT (1 << 1)	/* ignore partition table */
531551
diff -up util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak util-linux-2.23.2/libblkid/src/partitions/partitions.c
531551
--- util-linux-2.23.2/libblkid/src/partitions/partitions.c.kzak	2015-07-02 12:19:11.669530485 +0200
531551
+++ util-linux-2.23.2/libblkid/src/partitions/partitions.c	2015-07-02 12:28:24.166667964 +0200
531551
@@ -537,6 +537,8 @@ static int idinfo_probe(blkid_probe pr,
531551
 
531551
 	if (pr->size <= 0 || (id->minsz && id->minsz > pr->size))
531551
 		goto nothing;	/* the device is too small */
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		goto nothing;
531551
 
531551
 	rc = blkid_probe_get_idmag(pr, id, &off, &mag;;
531551
 	if (rc != BLKID_PROBE_OK)
531551
@@ -576,8 +578,12 @@ static int partitions_probe(blkid_probe
531551
 
531551
 	if (!pr || chn->idx < -1)
531551
 		return -EINVAL;
531551
+
531551
 	blkid_probe_chain_reset_vals(pr, chn);
531551
 
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return BLKID_PROBE_NONE;
531551
+
531551
 	if (chn->binary)
531551
 		partitions_init_data(chn);
531551
 
531551
@@ -653,6 +659,8 @@ int blkid_partitions_do_subprobe(blkid_p
531551
 
531551
 	if (!pr || !parent || !parent->size)
531551
 		return -EINVAL;
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return BLKID_PROBE_NONE;
531551
 
531551
 	/* range defined by parent */
531551
 	sz = ((blkid_loff_t) parent->size) << 9;
531551
@@ -707,6 +715,9 @@ static int blkid_partitions_probe_partit
531551
 	blkid_partition par;
531551
 	dev_t devno;
531551
 
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		goto nothing;
531551
+
531551
 	devno = blkid_probe_get_devno(pr);
531551
 	if (!devno)
531551
 		goto nothing;
531551
@@ -779,7 +790,7 @@ nothing:
531551
 int blkid_probe_is_covered_by_pt(blkid_probe pr,
531551
 				 blkid_loff_t offset, blkid_loff_t size)
531551
 {
531551
-	blkid_probe prc;
531551
+	blkid_probe prc = NULL;
531551
 	blkid_partlist ls = NULL;
531551
 	blkid_loff_t start, end;
531551
 	int nparts, i, rc = 0;
531551
@@ -788,6 +799,9 @@ int blkid_probe_is_covered_by_pt(blkid_p
531551
 		"=> checking if off=%jd size=%jd covered by PT",
531551
 		offset, size));
531551
 
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		goto done;
531551
+
531551
 	prc = blkid_clone_probe(pr);
531551
 	if (!prc)
531551
 		goto done;
531551
diff -up util-linux-2.23.2/libblkid/src/probe.c.kzak util-linux-2.23.2/libblkid/src/probe.c
531551
--- util-linux-2.23.2/libblkid/src/probe.c.kzak	2015-07-02 12:13:48.823787869 +0200
531551
+++ util-linux-2.23.2/libblkid/src/probe.c	2015-07-02 12:38:20.110518915 +0200
531551
@@ -110,6 +110,7 @@
531551
 
531551
 #include "blkidP.h"
531551
 #include "all-io.h"
531551
+#include "sysfs.h"
531551
 
531551
 /* chains */
531551
 extern const struct blkid_chaindrv superblocks_drv;
531551
@@ -714,8 +715,13 @@ int blkid_probe_set_device(blkid_probe p
531551
 	if (pr->size <= 1440 * 1024 && !S_ISCHR(sb.st_mode))
531551
 		pr->flags |= BLKID_FL_TINY_DEV;
531551
 
531551
+	if (S_ISBLK(sb.st_mode) && sysfs_devno_is_lvm_private(sb.st_rdev)) {
531551
+		DBG(LOWPROBE, blkid_debug("ignore private LVM device"));
531551
+		pr->flags |= BLKID_FL_NOSCAN_DEV;
531551
+        }
531551
+
531551
 #ifdef CDROM_GET_CAPABILITY
531551
-	if (S_ISBLK(sb.st_mode) &&
531551
+	else if (S_ISBLK(sb.st_mode) &&
531551
 	    !blkid_probe_is_tiny(pr) &&
531551
 	    blkid_probe_is_wholedisk(pr) &&
531551
 	    ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0)
531551
@@ -892,6 +898,9 @@ int blkid_do_probe(blkid_probe pr)
531551
 	if (!pr)
531551
 		return -1;
531551
 
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return 1;
531551
+
531551
 	do {
531551
 		struct blkid_chain *chn = pr->cur_chain;
531551
 
531551
@@ -1143,6 +1152,8 @@ int blkid_do_safeprobe(blkid_probe pr)
531551
 
531551
 	if (!pr)
531551
 		return -1;
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return 1;
531551
 
531551
 	blkid_probe_start(pr);
531551
 
531551
@@ -1197,6 +1208,8 @@ int blkid_do_fullprobe(blkid_probe pr)
531551
 
531551
 	if (!pr)
531551
 		return -1;
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return 1;
531551
 
531551
 	blkid_probe_start(pr);
531551
 
531551
diff -up util-linux-2.23.2/libblkid/src/superblocks/superblocks.c.kzak util-linux-2.23.2/libblkid/src/superblocks/superblocks.c
531551
--- util-linux-2.23.2/libblkid/src/superblocks/superblocks.c.kzak	2015-07-02 12:29:32.370193121 +0200
531551
+++ util-linux-2.23.2/libblkid/src/superblocks/superblocks.c	2015-07-02 12:31:06.897535008 +0200
531551
@@ -338,6 +338,9 @@ static int superblocks_probe(blkid_probe
531551
 
531551
 	if (!pr || chn->idx < -1)
531551
 		return -EINVAL;
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		goto nothing;
531551
+
531551
 	blkid_probe_chain_reset_vals(pr, chn);
531551
 
531551
 	DBG(LOWPROBE, blkid_debug("--> starting probing loop [SUBLKS idx=%d]",
531551
@@ -453,6 +456,9 @@ static int superblocks_safeprobe(blkid_p
531551
 	int intol = 0;
531551
 	int rc;
531551
 
531551
+	if (pr->flags & BLKID_FL_NOSCAN_DEV)
531551
+		return 1;				/* nothing */
531551
+
531551
 	while ((rc = superblocks_probe(pr, chn)) == 0) {
531551
 
531551
 		if (blkid_probe_is_tiny(pr) && !count)
531551
diff -up util-linux-2.23.2/libblkid/src/verify.c.kzak util-linux-2.23.2/libblkid/src/verify.c
531551
--- util-linux-2.23.2/libblkid/src/verify.c.kzak	2015-07-02 12:15:51.782928121 +0200
531551
+++ util-linux-2.23.2/libblkid/src/verify.c	2015-07-02 12:16:45.078555470 +0200
531551
@@ -112,6 +112,10 @@ blkid_dev blkid_verify(blkid_cache cache
531551
 		   (unsigned long)diff));
531551
 #endif
531551
 
531551
+	if (sysfs_devno_is_lvm_private(st.st_rdev)) {
531551
+		blkid_free_dev(dev);
531551
+		return NULL;
531551
+	}
531551
 	if (!cache->probe) {
531551
 		cache->probe = blkid_new_probe();
531551
 		if (!cache->probe) {
531551
diff -up util-linux-2.23.2/lib/sysfs.c.kzak util-linux-2.23.2/lib/sysfs.c
531551
--- util-linux-2.23.2/lib/sysfs.c.kzak	2015-07-02 12:12:29.193344657 +0200
531551
+++ util-linux-2.23.2/lib/sysfs.c	2015-07-02 12:12:13.565453930 +0200
531551
@@ -639,6 +639,35 @@ err:
531551
 }
531551
 
531551
 /*
531551
+ * Returns 1 if the device is private LVM device.
531551
+ */
531551
+int sysfs_devno_is_lvm_private(dev_t devno)
531551
+{
531551
+	struct sysfs_cxt cxt = UL_SYSFSCXT_EMPTY;
531551
+	char *uuid = NULL;
531551
+	int rc = 0;
531551
+
531551
+	if (sysfs_init(&cxt, devno, NULL) != 0)
531551
+		return 0;
531551
+
531551
+	uuid = sysfs_strdup(&cxt, "dm/uuid");
531551
+
531551
+	/* Private LVM devices use "LVM-<uuid>-<name>" uuid format (important
531551
+	 * is the "LVM" prefix and "-<name>" postfix).
531551
+	 */
531551
+	if (uuid && strncmp(uuid, "LVM-", 4) == 0) {
531551
+		char *p = strrchr(uuid + 4, '-');
531551
+
531551
+		if (p && *(p + 1))
531551
+			rc = 1;
531551
+	}
531551
+
531551
+	sysfs_deinit(&cxt);
531551
+	free(uuid);
531551
+	return rc;
531551
+}
531551
+
531551
+/*
531551
  * Return 0 or 1, or < 0 in case of error
531551
  */
531551
 int sysfs_devno_is_wholedisk(dev_t devno)
531551
@@ -651,6 +680,9 @@ int sysfs_devno_is_wholedisk(dev_t devno
531551
 	return devno == disk;
531551
 }
531551
 
531551
+
531551
+
531551
+
531551
 int sysfs_scsi_get_hctl(struct sysfs_cxt *cxt, int *h, int *c, int *t, int *l)
531551
 {
531551
 	char buf[PATH_MAX], *hctl;