From: Marcin Krol <hawk@tld-linux.org>
Date: Tue, 20 Feb 2018 10:45:59 +0000 (+0000)
Subject: - updated to 2.02.177, partial PLD merge
X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=8780299f67c78624188b5a2a8d85e69e6724be4a;p=packages%2Flvm2.git

- updated to 2.02.177, partial PLD merge
---

diff --git a/device-mapper-dmsetup-deps-export.patch b/device-mapper-dmsetup-deps-export.patch
index fbf59e3..9a8e021 100644
--- a/device-mapper-dmsetup-deps-export.patch
+++ b/device-mapper-dmsetup-deps-export.patch
@@ -1,14 +1,7 @@
----
- tools/dmsetup.c |   23 +++++++++++++++++++++++
- 1 file changed, 23 insertions(+)
-
-Index: LVM2.2.02.98/tools/dmsetup.c
-===================================================================
---- LVM2.2.02.98.orig/tools/dmsetup.c
-+++ LVM2.2.02.98/tools/dmsetup.c
-@@ -1717,10 +1717,11 @@ static int _export(CMD_ARGS)
- 	char *target_type = NULL;
- 	char *params;
+diff -urp LVM2.2.02.177.orig/tools/dmsetup.c LVM2.2.02.177/tools/dmsetup.c
+--- LVM2.2.02.177.orig/tools/dmsetup.c	2018-01-26 15:22:40.000000000 +0000
++++ LVM2.2.02.177/tools/dmsetup.c	2018-01-26 16:41:10.574224457 +0000
+@@ -2583,6 +2583,7 @@ static int _export(CMD_ARGS)
  	const char *name = NULL;
  	const char *uuid = NULL;
  	struct dm_info info;
@@ -16,11 +9,7 @@ Index: LVM2.2.02.98/tools/dmsetup.c
  
  	if (names)
  		name = names->name;
- 	else if (argc == 2)
- 		name = argv[1];
-@@ -1786,10 +1787,32 @@ static int _export(CMD_ARGS)
- 				printf(",%s", target_type);
- 		}
+@@ -2652,6 +2653,28 @@ static int _export(CMD_ARGS)
  		printf("\n");
  	}
  
@@ -49,5 +38,3 @@ Index: LVM2.2.02.98/tools/dmsetup.c
  	r = 1;
        out:
  	if (dmt)
- 		dm_task_destroy(dmt);
- 	return r;
diff --git a/device-mapper-dmsetup-export.patch b/device-mapper-dmsetup-export.patch
index 029e8fa..9a50b7e 100644
--- a/device-mapper-dmsetup-export.patch
+++ b/device-mapper-dmsetup-export.patch
@@ -1,11 +1,7 @@
----
- man/dmsetup.8.in |    7 ++++
- tools/dmsetup.c  |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 95 insertions(+)
-
---- LVM2.2.02.149/man/dmsetup.8.in.orig	2016-04-05 22:16:49.848604442 +0200
-+++ LVM2.2.02.149/man/dmsetup.8.in	2016-04-06 15:59:35.582595117 +0200
-@@ -48,6 +48,14 @@
+diff -urp LVM2.2.02.177.orig/man/dmsetup.8_main LVM2.2.02.177/man/dmsetup.8_main
+--- LVM2.2.02.177.orig/man/dmsetup.8_main	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/man/dmsetup.8_main	2018-01-26 15:24:01.378500379 +0000
+@@ -59,6 +59,14 @@ dmsetup \(em low level logical volume ma
  .
  .HP
  .B dmsetup
@@ -19,8 +15,8 @@
 +.B dmsetup
  .de CMD_HELP
  .  BR help
- .  RB [ \-c | \-C | \-\-columns ]
-@@ -629,6 +637,9 @@
+ .  RB [ -c | -C | --columns ]
+@@ -651,6 +659,9 @@ device. Device names on output can be cu
  \fBdevname\fP (map name for device-mapper devices, equal to blkdevname otherwise).
  .
  .HP
@@ -30,9 +26,10 @@
  .CMD_HELP
  .br
  Outputs a summary of the commands available, optionally including
---- LVM2.2.02.130/tools/dmsetup.c.orig	2015-09-09 18:44:39.471523160 +0200
-+++ LVM2.2.02.130/tools/dmsetup.c	2015-09-09 18:48:33.918179988 +0200
-@@ -2189,6 +2189,93 @@
+diff -urp LVM2.2.02.177.orig/tools/dmsetup.c LVM2.2.02.177/tools/dmsetup.c
+--- LVM2.2.02.177.orig/tools/dmsetup.c	2018-01-26 15:13:17.000000000 +0000
++++ LVM2.2.02.177/tools/dmsetup.c	2018-01-26 15:22:40.528505198 +0000
+@@ -2572,6 +2572,93 @@ out:
  	return r;
  }
  
@@ -126,11 +123,11 @@
  /* Show target names and their version numbers */
  static int _targets(CMD_ARGS)
  {
-@@ -5139,6 +5226,7 @@
- 	{"stats", "<command> [<options>] [<devices>]", 1, -1, 1, 1, _stats},
- 	{"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
- 	{"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
+@@ -6247,6 +6334,7 @@ static struct command _dmsetup_commands[
+ 	{"stats", "<command> [<options>] [<device>...]", 1, -1, 1, 1, _stats},
+ 	{"status", "[<device>...] [--noflush] [--target <target_type>]", 0, -1, 2, 0, _status},
+ 	{"table", "[<device>...] [--concise] [--target <target_type>] [--showkeys]", 0, -1, 2, 0, _status},
 +	{"export", "[<device>]", 0, 1, 1, 0, _export},
  	{"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
- 	{"mknodes", "[<device>]", 0, -1, 1, 0, _mknodes},
- 	{"mangle", "[<device>]", 0, -1, 1, 0, _mangle},
+ 	{"mknodes", "[<device>...]", 0, -1, 1, 0, _mknodes},
+ 	{"mangle", "[<device>...]", 0, -1, 1, 0, _mangle},
diff --git a/dl-dlsym.patch b/dl-dlsym.patch
index db4c9cc..c4bcd92 100644
--- a/dl-dlsym.patch
+++ b/dl-dlsym.patch
@@ -1,6 +1,7 @@
---- LVM2.2.02.72/lib/commands/toolcontext.c~	2010-07-29 13:21:40.000000000 +0300
-+++ LVM2.2.02.72/lib/commands/toolcontext.c	2010-07-29 13:21:42.552959287 +0300
-@@ -876,6 +876,7 @@
+diff -urp LVM2.2.02.177.orig/lib/commands/toolcontext.c LVM2.2.02.177/lib/commands/toolcontext.c
+--- LVM2.2.02.177.orig/lib/commands/toolcontext.c	2018-01-26 15:13:17.000000000 +0000
++++ LVM2.2.02.177/lib/commands/toolcontext.c	2018-01-26 16:38:04.214235565 +0000
+@@ -1455,6 +1455,7 @@ int lvm_register_segtype(struct segtype_
  	return 1;
  }
  
@@ -8,7 +9,7 @@
  static int _init_single_segtype(struct cmd_context *cmd,
  				struct segtype_library *seglib)
  {
-@@ -893,6 +894,7 @@
+@@ -1472,6 +1473,7 @@ static int _init_single_segtype(struct c
  
  	return lvm_register_segtype(seglib, segtype);
  }
diff --git a/lvm2-clvmd_cmd_timeout.patch b/lvm2-clvmd_cmd_timeout.patch
index ba2b6f8..d1d6e0d 100644
--- a/lvm2-clvmd_cmd_timeout.patch
+++ b/lvm2-clvmd_cmd_timeout.patch
@@ -1,25 +1,7 @@
-commit 8b6c9bb794361c75b0aa96bede8a3f71d1dd663e
-Author: Jacek Konieczny <jajcus@jajcus.net>
-Date:   Wed Dec 12 11:59:42 2012 +0100
-
-    clvmd: command timeout handling fix
-    
-    clvmd would wait for select() to time-out before processing command
-    time-outs. The select timeout would be set to the cmd_timeout ('-t'
-    command-line option) value, which is 60 seconds by default.
-    
-    Normally the select() call is woken up more frequently, so the command
-    time-outs are never processed. This causes LVM tools wait forever on
-    cluster locking for operations started during temporary cluster
-    problems.
-    
-    Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
-
-diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
-index eb0bffd..2b5d753 100644
---- a/daemons/clvmd/clvmd.c
-+++ b/daemons/clvmd/clvmd.c
-@@ -939,8 +939,8 @@ static void main_loop(int local_sock, int cmd_timeout)
+diff -urp LVM2.2.02.177.orig/daemons/clvmd/clvmd.c LVM2.2.02.177/daemons/clvmd/clvmd.c
+--- LVM2.2.02.177.orig/daemons/clvmd/clvmd.c	2017-12-18 20:44:34.000000000 +0000
++++ LVM2.2.02.177/daemons/clvmd/clvmd.c	2018-01-26 16:40:07.504228217 +0000
+@@ -992,8 +992,8 @@ static void main_loop(int cmd_timeout)
  			}
  		}
  
@@ -29,4 +11,4 @@ index eb0bffd..2b5d753 100644
 +		if (select_status >= 0) {
  			time_t the_time = time(NULL);
  
- 			for (thisfd = &local_client_head; thisfd != NULL;
+ 			for (thisfd = &local_client_head; thisfd; thisfd = thisfd->next) {
diff --git a/lvm2-diet.patch b/lvm2-diet.patch
index cece1b8..3859bbf 100644
--- a/lvm2-diet.patch
+++ b/lvm2-diet.patch
@@ -1,6 +1,7 @@
---- LVM2.2.02.45/lib/commands/toolcontext.c	2009-02-22 22:14:38.000000000 +0100
-+++ LVM2.2.02.45-diet/lib/commands/toolcontext.c	2009-03-18 12:18:23.000000000 +0100
-@@ -1006,10 +1006,10 @@
+diff -urp LVM2.2.02.177.orig/lib/commands/toolcontext.c LVM2.2.02.177/lib/commands/toolcontext.c
+--- LVM2.2.02.177.orig/lib/commands/toolcontext.c	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/lib/commands/toolcontext.c	2018-01-26 15:13:17.915538732 +0000
+@@ -1840,10 +1840,10 @@ struct cmd_context *create_toolcontext(u
  #ifdef M_MMAP_MAX
  	mallopt(M_MMAP_MAX, 0);
  #endif
@@ -13,62 +14,45 @@
  #ifdef INTL_PACKAGE
  	bindtextdomain(INTL_PACKAGE, LOCALEDIR);
  #endif
---- LVM2.2.02.45/libdm/libdevmapper.h	2008-11-04 16:07:45.000000000 +0100
-+++ LVM2.2.02.45-diet/libdm/libdevmapper.h	2009-03-18 12:17:27.000000000 +0100
-@@ -160,6 +160,10 @@
- /*
-  * Control read_ahead.
-  */
-+#ifdef __dietlibc__
-+# define UINT32_MAX             (4294967295U)
-+#endif
-+
- #define DM_READ_AHEAD_AUTO UINT32_MAX	/* Use kernel default readahead */
- #define DM_READ_AHEAD_NONE 0		/* Disable readahead */
- 
---- LVM2.2.02.45/lib/config/config.c	2008-11-03 23:14:27.000000000 +0100
-+++ LVM2.2.02.45-diet/lib/config/config.c	2009-03-18 12:22:31.000000000 +0100
-@@ -28,6 +28,10 @@
- #include <ctype.h>
- #include <assert.h>
+diff -urp LVM2.2.02.177.orig/lib/config/config.c LVM2.2.02.177/lib/config/config.c
+--- LVM2.2.02.177.orig/lib/config/config.c	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/lib/config/config.c	2018-01-26 15:13:17.917538732 +0000
+@@ -43,6 +43,10 @@ static const char *_config_source_names[
+ 	[CONFIG_FILE_SPECIAL] = "special purpose"
+ };
  
 +#ifdef __dietlibc__
 +typedef char* caddr_t __attribute_dontuse__;
 +#endif
 +
  struct config_file {
- 	time_t timestamp;
  	off_t st_size;
---- LVM2.2.02.45/lib/misc/lib.h	2008-11-03 19:59:58.000000000 +0100
-+++ LVM2.2.02.45-diet/lib/misc/lib.h	2009-03-18 12:24:30.000000000 +0100
-@@ -45,4 +45,20 @@
- #include <unistd.h>
- #include <sys/stat.h>
+ 	char *filename;
+diff -urp LVM2.2.02.177.orig/lib/metadata/pv.c LVM2.2.02.177/lib/metadata/pv.c
+--- LVM2.2.02.177.orig/lib/metadata/pv.c	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/lib/metadata/pv.c	2018-01-26 15:13:17.919538732 +0000
+@@ -17,6 +17,12 @@
+ #include "metadata.h"
+ #include "lvmcache.h"
  
 +#ifdef __dietlibc__
-+# include <strings.h>
-+# include <limits.h>
-+# if __WORDSIZE == 64
-+#  define INT64_C(c)    c ## L
-+# else
-+#  define INT64_C(c)    c ## LL
-+# endif
-+# define UINT32_C(c)    c ## U
-+# if __WORDSIZE == 64
-+#  define UINT64_C(c)   c ## UL
-+# else
-+#  define UINT64_C(c)   c ## ULL
++# ifndef UINT64_MAX
++#  define UINT64_MAX             __UINT64_MAX__
 +# endif
 +#endif
 +
- #endif
---- LVM2.2.02.45/tools/tools.h	2008-11-04 15:57:06.000000000 +0100
-+++ LVM2.2.02.45-diet/tools/tools.h	2009-03-18 12:24:58.000000000 +0100
-@@ -55,6 +55,21 @@
- #include <stdarg.h>
- #include <sys/types.h>
+ /*
+  * FIXME: Check for valid handle before dereferencing field or log error?
+  */
+diff -urp LVM2.2.02.177.orig/lib/misc/lib.h LVM2.2.02.177/lib/misc/lib.h
+--- LVM2.2.02.177.orig/lib/misc/lib.h	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/lib/misc/lib.h	2018-01-26 15:13:17.917538732 +0000
+@@ -94,4 +94,20 @@
+ 
+ #include <unistd.h>
  
 +#ifdef __dietlibc__
++# include <strings.h>
 +# include <limits.h>
 +# if __WORDSIZE == 64
 +#  define INT64_C(c)    c ## L
@@ -83,14 +67,13 @@
 +# endif
 +#endif
 +
- #define CMD_LEN 256
- #define MAX_ARGS 64
- 
---- LVM2.2.02.45/lib/report/report.c	2009-02-09 10:45:49.000000000 +0100
-+++ LVM2.2.02.45-diet/lib/report/report.c	2009-03-18 12:45:23.000000000 +0100
-@@ -24,6 +24,11 @@
- #include "str_list.h"
- #include "lvmcache.h"
+ #endif
+diff -urp LVM2.2.02.177.orig/lib/report/report.c LVM2.2.02.177/lib/report/report.c
+--- LVM2.2.02.177.orig/lib/report/report.c	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/lib/report/report.c	2018-01-26 15:13:17.918538732 +0000
+@@ -29,6 +29,11 @@
+ #include <float.h> /* DBL_MAX */
+ #include <time.h>
  
 +#ifdef __dietlibc__
 +#define __UINT64_C(c) c ## ULL
@@ -99,12 +82,27 @@
 +
  struct lvm_report_object {
  	struct volume_group *vg;
- 	struct logical_volume *lv;
---- LVM2.2.02.45/tools/dmsetup.c	2008-10-30 18:52:06.000000000 +0100
-+++ LVM2.2.02.45-diet/tools/dmsetup.c	2009-03-18 12:47:46.000000000 +0100
-@@ -40,6 +40,23 @@
- #include <fcntl.h>
- #include <sys/stat.h>
+ 	struct lv_with_info_and_seg_status *lvdm;
+diff -urp LVM2.2.02.177.orig/libdm/libdevmapper.h LVM2.2.02.177/libdm/libdevmapper.h
+--- LVM2.2.02.177.orig/libdm/libdevmapper.h	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/libdm/libdevmapper.h	2018-01-26 15:13:17.916538732 +0000
+@@ -251,6 +251,10 @@ int dm_task_set_add_node(struct dm_task
+ /*
+  * Control read_ahead.
+  */
++#ifdef __dietlibc__
++# define UINT32_MAX             (4294967295U)
++#endif
++
+ #define DM_READ_AHEAD_AUTO UINT32_MAX	/* Use kernel default readahead */
+ #define DM_READ_AHEAD_NONE 0		/* Disable readahead */
+ 
+diff -urp LVM2.2.02.177.orig/tools/dmsetup.c LVM2.2.02.177/tools/dmsetup.c
+--- LVM2.2.02.177.orig/tools/dmsetup.c	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/tools/dmsetup.c	2018-01-26 15:13:17.919538732 +0000
+@@ -37,6 +37,23 @@
+ #  include <libudev.h>
+ #endif
  
 +#ifdef __dietlibc__
 +# include <limits.h>
@@ -125,15 +123,17 @@
 +
  /* FIXME Unused so far */
  #undef HAVE_SYS_STATVFS_H
-
---- LVM2.2.02.149/tools/Makefile.in.orig	2016-04-05 22:05:48.151965546 +0200
-+++ LVM2.2.02.149/tools/Makefile.in	2016-04-05 22:16:22.108605605 +0200
-@@ -128,12 +128,12 @@
+ 
+diff -urp LVM2.2.02.177.orig/tools/Makefile.in LVM2.2.02.177/tools/Makefile.in
+--- LVM2.2.02.177.orig/tools/Makefile.in	2018-01-26 15:12:22.000000000 +0000
++++ LVM2.2.02.177/tools/Makefile.in	2018-01-26 15:17:46.765522708 +0000
+@@ -126,12 +126,13 @@ device-mapper: $(TARGETS_DM)
  CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
  
  dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
--	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) -L$(top_builddir)/libdm \
-+	$(CC) $(CFLAGS) -L$(interfacebuilddir) -L$(top_builddir)/libdm $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) \
+-	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
++	$(CC) $(CFLAGS) -L$(interfacebuilddir) -L$(top_builddir)/libdm \
++	      $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
  	      -o $@ dmsetup.o -ldevmapper $(LIBS)
  
  dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
@@ -144,16 +144,16 @@
  
  all: device-mapper
  
-@@ -141,7 +141,7 @@
- CFLAGS_lvmcmdline.o += $(VALGRIND_CFLAGS)
+@@ -140,7 +141,7 @@ CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
+ INCLUDES += -I$(top_builddir)/tools
  
  lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
 -	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
 +	$(CC) $(CFLAGS) -L$(interfacebuilddir) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
- 		$(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic
+ 		$(LVMLIBS) $(READLINE_LIBS) $(LIBS)
  
- ifeq ("@BUILD_LVMETAD@", "yes")
-@@ -150,7 +150,7 @@
+ DEFS_man-generator.o += -DMAN_PAGE_GENERATOR
+@@ -157,7 +158,7 @@ endif
  
  lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
  	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
@@ -162,18 +162,28 @@
  
  liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
  	cat $(top_builddir)/lib/liblvm-internal.a > $@
---- LVM2.2.02.75/lib/metadata/pv.c.orig	2010-09-30 22:47:18.000000000 +0200
-+++ LVM2.2.02.75/lib/metadata/pv.c	2010-11-06 12:05:40.672884033 +0100
-@@ -17,6 +17,12 @@
- #include "metadata.h"
- #include "lvmcache.h"
+diff -urp LVM2.2.02.177.orig/tools/tools.h LVM2.2.02.177/tools/tools.h
+--- LVM2.2.02.177.orig/tools/tools.h	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/tools/tools.h	2018-01-26 15:13:17.917538732 +0000
+@@ -47,6 +47,21 @@
+ #include <ctype.h>
+ #include <sys/types.h>
  
 +#ifdef __dietlibc__
-+# ifndef UINT64_MAX
-+#  define UINT64_MAX             __UINT64_MAX__
++# include <limits.h>
++# if __WORDSIZE == 64
++#  define INT64_C(c)    c ## L
++# else
++#  define INT64_C(c)    c ## LL
++# endif
++# define UINT32_C(c)    c ## U
++# if __WORDSIZE == 64
++#  define UINT64_C(c)   c ## UL
++# else
++#  define UINT64_C(c)   c ## ULL
 +# endif
 +#endif
 +
- /*
-  * FIXME: Check for valid handle before dereferencing field or log error?
-  */
+ #define CMD_LEN 256
+ #define MAX_ARGS 64
+ 
diff --git a/lvm2-run-dir.patch b/lvm2-run-dir.patch
index 02aa77f..516c5af 100644
--- a/lvm2-run-dir.patch
+++ b/lvm2-run-dir.patch
@@ -1,7 +1,7 @@
-diff -ur LVM2.2.02.132.orig/configure.in LVM2.2.02.132/configure.in
---- LVM2.2.02.132.orig/configure.in	2015-10-08 12:26:23.000000000 +0000
-+++ LVM2.2.02.132/configure.in	2015-10-08 12:42:41.249042000 +0000
-@@ -707,8 +707,7 @@
+diff -urp LVM2.2.02.177.orig/configure.in LVM2.2.02.177/configure.in
+--- LVM2.2.02.177.orig/configure.in	2017-12-18 20:44:34.000000000 +0000
++++ LVM2.2.02.177/configure.in	2018-01-26 16:41:52.154221979 +0000
+@@ -706,8 +706,7 @@ pkg_config_init() {
  
  ################################################################################
  AC_MSG_CHECKING(for default run directory)
diff --git a/lvm2-selinux.patch b/lvm2-selinux.patch
index fe6afbd..0e53e8e 100644
--- a/lvm2-selinux.patch
+++ b/lvm2-selinux.patch
@@ -1,12 +1,13 @@
---- LVM2.2.02.28/tools/Makefile.in~	2007-08-20 23:55:30.000000000 +0300
-+++ LVM2.2.02.28/tools/Makefile.in	2007-10-31 19:45:05.169858091 +0200
-@@ -92,6 +92,9 @@
- endif
+diff -urp LVM2.2.02.177.orig/tools/Makefile.in LVM2.2.02.177/tools/Makefile.in
+--- LVM2.2.02.177.orig/tools/Makefile.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/tools/Makefile.in	2018-01-26 15:12:22.687542024 +0000
+@@ -97,6 +97,9 @@ endif
  
- LVMLIBS += -ldevmapper
+ LVMLIBS = $(LVMINTERNAL_LIBS) -ldevmapper
+ LIB_VERSION = $(LIB_VERSION_LVM)
 +ifneq ("@STATIC_LINK@", "yes")
 +  LVMLIBS += -lselinux -lsepol
 +endif
  
- DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
- 
+ CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \
+ 	liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \
diff --git a/lvm2-thin.patch b/lvm2-thin.patch
new file mode 100644
index 0000000..ce2e788
--- /dev/null
+++ b/lvm2-thin.patch
@@ -0,0 +1,56 @@
+--- LVM2.2.02.149/configure.in.orig	2016-04-06 16:05:03.799248008 +0200
++++ LVM2.2.02.149/configure.in	2016-04-06 20:23:12.388598015 +0200
+@@ -463,7 +463,7 @@
+ AC_ARG_ENABLE(thin_check_needs_check,
+ 	      AC_HELP_STRING([--disable-thin_check_needs_check],
+ 			     [required if thin_check version is < 0.3.0]),
+-	      THIN_CHECK_NEEDS_CHECK=$enableval, THIN_CHECK_NEEDS_CHECK=yes)
++	      THIN_CHECK_NEEDS_CHECK=$enableval, THIN_CHECK_NEEDS_CHECK=autodetect)
+ 
+ # Test if necessary thin tools are available
+ # if not - use plain defaults and warn user
+@@ -478,7 +478,7 @@
+ 			THIN_CONFIGURE_WARN=y
+ 		fi
+ 	fi
+-	if test "$THIN_CHECK_NEEDS_CHECK" = yes; then
++	if test "$THIN_CHECK_NEEDS_CHECK" = autodetect; then
+ 		THIN_CHECK_VSN=`"$THIN_CHECK_CMD" -V 2>/dev/null`
+ 		THIN_CHECK_VSN_MAJOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}'`
+ 		THIN_CHECK_VSN_MINOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}'`
+@@ -491,6 +491,8 @@
+ 			AC_MSG_WARN([$THIN_CHECK_CMD: Old version "$THIN_CHECK_VSN" found])
+ 			THIN_CHECK_VERSION_WARN=y
+ 			THIN_CHECK_NEEDS_CHECK=no
++		else
++			THIN_CHECK_NEEDS_CHECK=yes
+ 		fi
+ 	fi
+ 	# Empty means a config way to ignore thin dumping
+@@ -577,7 +579,7 @@
+ AC_ARG_ENABLE(cache_check_needs_check,
+ 	      AC_HELP_STRING([--disable-cache_check_needs_check],
+ 			     [required if cache_check version is < 0.5]),
+-	      CACHE_CHECK_NEEDS_CHECK=$enableval, CACHE_CHECK_NEEDS_CHECK=yes)
++	      CACHE_CHECK_NEEDS_CHECK=$enableval, CACHE_CHECK_NEEDS_CHECK=autodetect)
+ 
+ # Test if necessary cache tools are available
+ # if not - use plain defaults and warn user
+@@ -592,7 +594,7 @@
+ 			CACHE_CONFIGURE_WARN=y
+ 		fi
+ 	fi
+-	if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
++	if test "$CACHE_CHECK_NEEDS_CHECK" = autodetect; then
+ 		$CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
+ 		read -r CACHE_CHECK_VSN < conftest.tmp
+ 		IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
+@@ -612,6 +614,8 @@
+ 				CACHE_CHECK_VERSION_WARN=y
+ 				CACHE_CHECK_NEEDS_CHECK=no
+ 			fi
++		else
++				CACHE_CHECK_NEEDS_CHECK=yes
+ 		fi
+ 	fi
+ 	# Empty means a config way to ignore cache dumping
diff --git a/lvm2-tld_init.patch b/lvm2-tld_init.patch
index d8ee8b6..66326de 100644
--- a/lvm2-tld_init.patch
+++ b/lvm2-tld_init.patch
@@ -1,52 +1,61 @@
-diff -ur LVM2.2.02.162.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.162/scripts/blk_availability_init_red_hat.in
---- LVM2.2.02.162.orig/scripts/blk_availability_init_red_hat.in	2016-07-28 18:50:18.000000000 +0000
-+++ LVM2.2.02.162/scripts/blk_availability_init_red_hat.in	2016-08-04 16:26:04.886554000 +0000
+diff -urp LVM2.2.02.177.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.177/scripts/blk_availability_init_red_hat.in
+--- LVM2.2.02.177.orig/scripts/blk_availability_init_red_hat.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/scripts/blk_availability_init_red_hat.in	2018-01-29 11:24:46.012906501 +0000
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
  #
- # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
  #
-@@ -31,28 +31,26 @@
+@@ -31,26 +31,29 @@
  
  . /etc/init.d/functions
  
--sbindir=@sbindir@
 -script=blkdeactivate
--options="-u -l wholevg -m disablequeueing"
 +DAEMON="blkdeactivate"
 +OPTIONS="-u -l wholevg -m disablequeueing"
  
- LOCK_FILE="/var/lock/subsys/blk-availability"
- 
--
--rtrn=1
+-sbindir=@SBINDIR@
+-options="-u -l wholevg -m disablequeueing -r wait"
 -
+-LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/blk-availability"
++LOCK_FILE="/var/lock/subsys/blk-availability"
+ 
  case "$1" in
    start)
- 	touch $LOCK_FILE
+ 	touch "$LOCK_FILE"
 +	exit 0
  	;;
--
+ 
    stop)
--	action "Stopping block device availability:" $sbindir/$script $options
-+	run_cmd "Stopping block device availability:" /sbin/$DAEMON $OPTIONS
- 	rm -f $LOCK_FILE
+-	action "Stopping block device availability:" "$sbindir/$script" $options
++	run_cmd "Stopping block device availability:" "/sbin/$DAEMON" $OPTIONS
+ 	rm -f "$LOCK_FILE"
 +	exit 0
  	;;
--
+ 
    status)
 +	exit 0
  	;;
++
    *)
 -	echo $"Usage: $0 {start|stop|status}"
 +	msg_usage "$0 {start|stop|status}"
 +	exit 3
  	;;
  esac
-diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/clvmd_init_red_hat.in
---- LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in	2016-07-28 18:50:18.000000000 +0000
-+++ LVM2.2.02.162/scripts/clvmd_init_red_hat.in	2016-08-04 16:22:09.076554000 +0000
+diff -urp LVM2.2.02.177.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.177/scripts/clvmd_init_red_hat.in
+--- LVM2.2.02.177.orig/scripts/clvmd_init_red_hat.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/scripts/clvmd_init_red_hat.in	2018-01-29 12:54:59.156583852 +0000
+@@ -4,7 +4,7 @@
+ #
+ # chkconfig: - 24 76
+ # description: Cluster daemon for userland logical volume management tools.
+-# pidfile: @CLVMD_PIDFILE@
++# pidfile: /var/run/clvmd.pid
+ #
+ # For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
+ #
 @@ -18,15 +18,12 @@
  
  . /etc/rc.d/init.d/functions
@@ -54,13 +63,13 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
 -DAEMON=clvmd
 +DAEMON="clvmd"
  
--exec_prefix=@exec_prefix@
--sbindir=@sbindir@
+-sbindir="@SBINDIR@"
+-usrsbindir="@USRSBINDIR@"
 -
--lvm_vgchange=${sbindir}/vgchange
--lvm_vgs=${sbindir}/vgs
--lvm_vgscan=${sbindir}/vgscan
--lvm_lvs=${sbindir}/lvs
+-lvm_vgchange="$sbindir/vgchange"
+-lvm_vgs="$sbindir/vgs"
+-lvm_vgscan="$sbindir/vgscan"
+-lvm_lvs="$sbindir/lvs"
 +lvm_vgchange="/sbin/vgchange"
 +lvm_vgs="/sbin/vgs"
 +lvm_vgscan="/sbin/vgscan"
@@ -68,12 +77,12 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
  
  CLVMDOPTS="-T30"
  
-@@ -50,20 +47,11 @@
- 	${lvm_lvs} --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
+@@ -50,20 +47,11 @@ clustered_active_lvs() {
+ 	"$lvm_lvs" --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
  }
  
 -rh_status() {
--	status $DAEMON
+-	status "$DAEMON"
 -}
 -
 -rh_status_q() {
@@ -84,22 +93,23 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
  {
 -	if ! rh_status_q; then
 -		echo -n "Starting $DAEMON: "
+-		"$usrsbindir/$DAEMON" $CLVMDOPTS || return $?
+-		echo
 +	if ! status $DAEMON 1>/dev/null 2>&1; then
 +		msg_starting "$DAEMON"
- 		$DAEMON $CLVMDOPTS || return $?
--		echo
++		"$DAEMON" $CLVMDOPTS || return $?
  	fi
  
  	# Refresh local cache.
-@@ -82,74 +70,62 @@
+@@ -82,74 +70,60 @@ start()
  	# unnecessary warnings.
  
- 	${lvm_vgscan} > /dev/null 2>&1
+ 	"$lvm_vgscan" > /dev/null 2>&1
 -
--	action "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
+-	action "Activating VG(s):" "$lvm_vgchange" -aay $LVM_VGS || return $?
 -
 +	run_cmd "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
- 	touch $LOCK_FILE
+ 	touch "$LOCK_FILE"
 -
  	return 0
  }
@@ -121,16 +131,16 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
  stop()
  {
 -	rh_status_q || return 0
+-
 +	status $DAEMON 1>/dev/null 2>&1 || return 0
- 
  	[ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
  	if [ -n "$LVM_VGS" ]; then
--		action "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $?
+-		action "Deactivating clustered VG(s):" "$lvm_vgchange" -anl $LVM_VGS || return $?
 +		run_cmd "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $?
  	fi
- 
--	action "Signaling $DAEMON to exit" kill -TERM $(pidofproc $DAEMON) || return $?
-+	run_cmd "Signaling $DAEMON to exit" kill -TERM $(pidofproc $DAEMON) || return $?
+-
+-	action "Signaling $DAEMON to exit" kill -TERM "$(pidofproc "$DAEMON")" || return $?
++	run_cmd "Signaling $DAEMON to exit" kill -TERM $(pidofproc "$DAEMON") || return $?
  
  	# wait half second before we start the waiting loop or we will show
  	# the loop more time than really necessary
@@ -154,16 +164,16 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
 +		ok
  	fi
 -
- 	rm -f $LOCK_FILE
+ 	rm -f "$LOCK_FILE"
 -
  	return 0
  }
  
  reload() {
 -	rh_status_q || exit 7
--	action "Reloading $DAEMON configuration: " $DAEMON -R || return $?
+-	action "Reloading $DAEMON configuration: " "$usrsbindir/$DAEMON" -R || return $?
 +	status $DAEMON 1>/dev/null 2>&1 || exit 7
-+	run_cmd "Reloading $DAEMON configuration: " $DAEMON -R || return $?
++	run_cmd "Reloading $DAEMON configuration: " "$DAEMON" -R || return $?
  }
  
  restart() {
@@ -175,12 +185,12 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
  
  	# Try to get clvmd to restart itself. This will preserve 
  	# exclusive LV locks
--	action "Restarting $DAEMON: " $DAEMON -S
-+	run_cmd "Restarting $DAEMON: " $DAEMON -S
+-	action "Restarting $DAEMON: " "$usrsbindir/$DAEMON" -S
++	run_cmd "Restarting $DAEMON: " "$DAEMON" -S
  
  	# If that fails then do a normal stop & restart
  	if  [ $? != 0 ]; then
-@@ -166,49 +142,43 @@
+@@ -166,38 +140,39 @@ restart() {
  	exit 4
  }
  
@@ -192,47 +202,46 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
 -	rtrn=$?
 +	RETVAL=$?
  	;;
--
+ 
    stop)
  	stop
 -	rtrn=$?
 +	RETVAL=$?
  	;;
--
+ 
    restart|force-reload)
  	restart
 -	rtrn=$?
 +	RETVAL=$?
  	;;
--
+ 
    condrestart|try-restart)
 -	rh_status_q || exit 0
 +	status $DAEMON 1>/dev/null 2>&1 || exit 0
  	restart
 -	rtrn=$? 
-+	RETVAL=$? 
++	RETVAL=$?
  	;;
--
+ 
    reload)
  	reload
 -	rtrn=$?
 +	RETVAL=$?
  	;;
--
+ 
    status)
 -	rh_status
 -	rtrn=$?
--	if [ $rtrn = 0 ]; then
+-	if [ "$rtrn" = 0 ]; then
 +	status $DAEMON
 +	RETVAL=$?
 +	if [ $RETVAL = 0 ]; then
  		cvgs="$(clustered_vgs)"
  		echo Clustered Volume Groups: ${cvgs:-"(none)"}
  		clvs="$(clustered_active_lvs)"
- 		echo Active clustered Logical Volumes: ${clvs:-"(none)"}
- 	fi
+@@ -206,9 +181,9 @@ case "$1" in
  	;;
--
+ 
    *)
 -	echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
 -	rtrn=2
@@ -240,19 +249,150 @@ diff -ur LVM2.2.02.162.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.162/scripts/
 +	RETVAL=2
  	;;
  esac
+ 
+-exit $rtrn
++exit $RETVAL
+diff -urp LVM2.2.02.177.orig/scripts/cmirrord_init_red_hat.in LVM2.2.02.177/scripts/cmirrord_init_red_hat.in
+--- LVM2.2.02.177.orig/scripts/cmirrord_init_red_hat.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/scripts/cmirrord_init_red_hat.in	2018-01-29 11:28:49.069892013 +0000
+@@ -2,7 +2,7 @@
+ #
+ # chkconfig: - 22 78
+ # description: Starts and stops cmirrord
+-# pidfile: @CMIRRORD_PIDFILE@
++# pidfile: /var/run/cmirrord.pid
+ #
+ # For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
+ #
+@@ -16,95 +16,57 @@
+ 
+ . /etc/init.d/functions
+ 
+-DAEMON=cmirrord
++DAEMON="cmirrord"
+ 
+-usrsbindir="@USRSBINDIR@"
 -
+-LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
++LOCK_FILE="/var/lock/subsys/$DAEMON"
+ 
+ start()
+ {
+-	rtrn=0
+-	if ! pidof "$DAEMON" > /dev/null
+-	then
+-		echo -n "Starting $DAEMON: "
+-		daemon "$usrsbindir/$DAEMON"
+-		rtrn=$?
+-		echo
+-	fi
+-
+-	return $rtrn
++        if [ -f $LOCK_FILE ]; then
++                msg_already_running "$DAEMON"
++                return
++        fi
++        msg_starting "$DAEMON"
++        daemon /sbin/$DAEMON </dev/null
++        RETVAL=$?
++        [ $RETVAL -eq 0 ] && touch "$LOCK_FILE"
+ }
+ 
+ stop()
+ {
+-	echo -n "Stopping $DAEMON:"
+-	killproc "$DAEMON" -TERM
+-	rtrn=$?
+-	echo
+-
+-	return $rtrn
+-}
+-
+-wait_for_finish()
+-{
+-	count=0
+-
+-	while [ "$count" -le 10 -a -n "`pidof $DAEMON`" ]
+-	do
+-		sleep 1
+-		count=$((count + 1))
+-	done
+-
+-	if [ "$(pidof "$DAEMON")" ]
+-	then
+-		return 1
+-	else
+-		return 0
++	if [ ! -f $LOCK_FILE ]; then
++		msg_not_running "$DAEMON"
++		return
+ 	fi
++	msg_stopping "$DAEMON"
++	killproc --pidfile "$PID_FILE" "$DAEMON"
++	rm -f "$LOCK_FILE"
+ }
+ 
+-cmirror_status()
+-{
+-	status "$DAEMON"
+-}
+-
+-rtrn=1
+-
++RETVAL=0
+ # See how we were called.
+ case "$1" in
+ 	start)
+ 		start
+-		rtrn=$?
+-		[ "$rtrn" = 0 ] && touch "$LOCK_FILE"
+ 		;;
+ 
+ 	stop)
+ 		stop
+-		rtrn=$?
+-		[ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
+ 		;;
+ 
+ 	restart)
+-		if stop
+-		then
+-			wait_for_finish
+-			start
+-		fi
+-		rtrn=$?
++		stop
++		start
+ 		;;
+ 
+ 	status)
+-		cmirror_status
+-		rtrn=$?
+-		if [ "$rtrn" -eq 0 ]; then
+-			echo "cmirror is running."
+-		fi
++		status $DAEMON
++		exit $?
+ 		;;
+ 
+ 	*)
+-		echo $"Usage: $0 {start|stop|restart|status}"
++		msg_usage "$0 {start|stop|restart|status}"
+ 		;;
+ esac
+ 
 -exit $rtrn
 +exit $RETVAL
-diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.162/scripts/lvm2_lvmetad_init_red_hat.in
---- LVM2.2.02.162.orig/scripts/lvm2_lvmetad_init_red_hat.in	2016-07-28 18:50:18.000000000 +0000
-+++ LVM2.2.02.162/scripts/lvm2_lvmetad_init_red_hat.in	2016-08-04 16:22:09.077554000 +0000
+diff -urp LVM2.2.02.177.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.177/scripts/lvm2_lvmetad_init_red_hat.in
+--- LVM2.2.02.177.orig/scripts/lvm2_lvmetad_init_red_hat.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/scripts/lvm2_lvmetad_init_red_hat.in	2018-01-29 11:30:04.229887533 +0000
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
  #
- # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
  #
-@@ -33,80 +33,76 @@
+@@ -33,78 +33,84 @@
  
  . /etc/init.d/functions
  
@@ -260,72 +400,72 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.162/s
 +DAEMON="lvmetad"
 +NAME="LVM metadata daemon"
  
--exec_prefix=@exec_prefix@
--sbindir=@sbindir@
+-sbindir="@SBINDIR@"
+-
+-LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
+-PID_FILE="@LVMETAD_PIDFILE@"
 -
--LOCK_FILE="/var/lock/subsys/$DAEMON"
+-rh_status() {
+-	status -p "$PID_FILE" "$DAEMON"
+-}
+-
+-rh_status_q() {
+-	rh_status >/dev/null 2>&1
+-}
 +LOCK_FILE="/var/lock/subsys/lvm2-lvmetad"
- PID_FILE="@LVMETAD_PIDFILE@"
++PID_FILE="/var/run/lvmetad.pid"
  
--rh_status() {
--	status -p $PID_FILE $DAEMON
-+start() {
-+	if [ -f $LOCK_FILE ]; then
+ start()
+ {
+-	ret=0
+-	action "Starting LVM metadata daemon:" "$sbindir/$DAEMON" || ret=$?
+-	return $ret
++	if [ -f "$LOCK_FILE" ]; then
 +		msg_already_running "$NAME"
 +		return
 +	fi
-+        msg_starting "$NAME"
-+        daemon /sbin/$DAEMON </dev/null
-+        RETVAL=$?
-+        [ $RETVAL -eq 0 ] && touch $LOCK_FILE
- }
- 
--rh_status_q() {
--	rh_status >/dev/null 2>&1
-+stop() {
-+        if [ ! -f $LOCK_FILE ]; then
-+                msg_not_running "$NAME"
-+                return
-+        fi
-+        msg_stopping "$NAME"
-+        killproc --pidfile $PID_FILE $DAEMON
-+        rm -f $LOCK_FILE
++	msg_starting "$NAME"
++	daemon "/sbin/$DAEMON" </dev/null
++	RETVAL=$?
++	[ "$RETVAL" -eq 0 ] && touch "$LOCK_FILE"
  }
  
--start()
--{
+ stop()
+ {
 -	ret=0
--	action "Starting LVM metadata daemon:" $DAEMON || ret=$?
+-	action "Signaling LVM metadata daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
 -	return $ret
++	if [ ! -f "$LOCK_FILE" ]; then
++		msg_not_running "$NAME"
++		return
++	fi
++	msg_stopping "$NAME"
++	killproc --pidfile "$PID_FILE" "$DAEMON"
++	rm -f "$LOCK_FILE"
++}
++
 +condrestart() {
-+        if [ ! -f $LOCK_FILE ]; then
-+                msg_not_running "$NAME"
-+                RETVAL=$1
-+                return
-+        fi
-+        stop
-+        start
++	if [ ! -f "$LOCK_FILE" ]; then
++		msg_not_running "$NAME"
++		RETVAL=$1
++		return
++	fi
++	stop
++	start
  }
  
--
--stop()
--{
--	ret=0
--	action "Signaling LVM metadata daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$?
--	return $ret
+-rtrn=1
 +reload() {
-+        if [ ! -f $LOCK_FILE ]; then
-+                msg_not_running "$NAME"
-+                RETVAL=7
-+                return
-+        fi
-+        msg_reloading "$NAME"
-+        killproc $DAEMON -HUP
-+        RETVAL=$?
- }
++	if [ ! -f "$LOCK_FILE" ]; then
++		msg_not_running "$NAME"
++		RETVAL=7
++		return
++	fi
++	msg_reloading "$NAME"
++	killproc "$DAEMON" -HUP
++	RETVAL=$?
++}
  
--rtrn=1
--
 +RETVAL=0
  # See how we were called.
  case "$1" in
@@ -333,17 +473,17 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.162/s
 -	rh_status_q && exit 0
  	start
 -	rtrn=$?
--	[ $rtrn = 0 ] && touch $LOCK_FILE
+-	[ "$rtrn" = 0 ] && touch "$LOCK_FILE"
  	;;
--
+ 
 -  stop|force-stop)
 -	rh_status_q || exit 0
 +  stop)
  	stop
 -	rtrn=$?
--	[ $rtrn = 0 ] && rm -f $LOCK_FILE
+-	[ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
  	;;
--
+ 
    restart)
 -	if stop
 -	then
@@ -353,7 +493,7 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.162/s
 +	stop
 +	start
  	;;
--
+ 
    condrestart|try-restart)
 -	rh_status_q || exit 0
 -	if stop
@@ -363,25 +503,25 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.162/s
 -	rtrn=$?
 +	condrestart 0
  	;;
--
+ 
    status)
 -	rh_status
 -	rtrn=$?
 +	status $DAEMON
 +	exit $?
  	;;
--
+ 
    *)
 -	echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
 +	msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
  	;;
  esac
--
+ 
 -exit $rtrn
 +exit $RETVAL
-diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.162/scripts/lvm2_lvmpolld_init_red_hat.in
---- LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in	2016-07-28 18:50:18.000000000 +0000
-+++ LVM2.2.02.162/scripts/lvm2_lvmpolld_init_red_hat.in	2016-08-04 16:22:09.077554000 +0000
+diff -urp LVM2.2.02.177.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.177/scripts/lvm2_lvmpolld_init_red_hat.in
+--- LVM2.2.02.177.orig/scripts/lvm2_lvmpolld_init_red_hat.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/scripts/lvm2_lvmpolld_init_red_hat.in	2018-01-29 11:31:12.405883470 +0000
 @@ -1,6 +1,6 @@
 -#!/bin/bash
 +#!/bin/sh
@@ -391,13 +531,13 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.162/
  #
  # This copyrighted material is made available to anyone wishing to use,
  # modify, copy, or redistribute it subject to the terms and conditions
-@@ -27,88 +27,84 @@
+@@ -27,86 +27,92 @@
  # Default-Start: 1 2 3 4 5
  # Default-Stop: 0 6
  # Short-Description: A daemon that is responsible for monitoring in-progress
 -#		     and possibly longer term operations on logical volumes. 
 -#		     It helps to reduce the number of spawned processes if same
-+#                    and possibly longer term operations on logical volumes.
++#                    and possibly longer term operations on logical volumes. 
 +#                    It helps to reduce the number of spawned processes if same
  #                    logical volume is requested to get monitored multiple times.
  #                    Also avoids unsolicited termination due to external factors.
@@ -409,72 +549,72 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.162/
 +DAEMON="lvmpolld"
 +NAME="LVM poll daemon"
  
--exec_prefix=@exec_prefix@
--sbindir=@sbindir@
+-sbindir="@SBINDIR@"
+-
+-LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
+-PID_FILE="@LVMPOLLD_PIDFILE@"
+-
+-rh_status() {
+-	status -p "$PID_FILE" "$DAEMON"
+-}
 -
--LOCK_FILE="/var/lock/subsys/$DAEMON"
+-rh_status_q() {
+-	rh_status >/dev/null 2>&1
+-}
 +LOCK_FILE="/var/lock/subsys/lvm2-lvmpolld"
- PID_FILE="@LVMPOLLD_PIDFILE@"
++PID_FILE="/var/run/lvmpolld.pid"
  
--rh_status() {
--	status -p $PID_FILE $DAEMON
-+start() {
+ start()
+ {
+-	ret=0
+-	action "Starting LVM poll daemon:" "$sbindir/$DAEMON" || ret=$?
+-	return $ret
 +	if [ -f $LOCK_FILE ]; then
 +		msg_already_running "$NAME"
 +		return
 +	fi
-+        msg_starting "$NAME"
-+        daemon /sbin/$DAEMON </dev/null
-+        RETVAL=$?
-+        [ $RETVAL -eq 0 ] && touch $LOCK_FILE
- }
- 
--rh_status_q() {
--	rh_status >/dev/null 2>&1
-+stop() {
-+        if [ ! -f $LOCK_FILE ]; then
-+                msg_not_running "$NAME"
-+                return
-+        fi
-+        msg_stopping "$NAME"
-+        killproc --pidfile $PID_FILE $DAEMON
-+        rm -f $LOCK_FILE
++	msg_starting "$NAME"
++	daemon "/sbin/$DAEMON" </dev/null
++	RETVAL=$?
++	[ "$RETVAL" -eq 0 ] && touch "$LOCK_FILE"
  }
  
--start()
--{
+ stop()
+ {
 -	ret=0
--	action "Starting LVM poll daemon:" $DAEMON || ret=$?
--	return $ret
+-	action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
+-	return "$ret"
++	if [ ! -f "$LOCK_FILE" ]; then
++		msg_not_running "$NAME"
++		return
++	fi
++	msg_stopping "$NAME"
++	killproc --pidfile "$PID_FILE" "$DAEMON"
++	rm -f "$LOCK_FILE"
++}
++
 +condrestart() {
-+        if [ ! -f $LOCK_FILE ]; then
-+                msg_not_running "$NAME"
-+                RETVAL=$1
-+                return
-+        fi
-+        stop
-+        start
++	if [ ! -f "$LOCK_FILE" ]; then
++		msg_not_running "$NAME"
++		RETVAL=$1
++		return
++	fi
++	stop
++	start
  }
  
--
--stop()
--{
--	ret=0
--	action "Signaling LVM poll daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$?
--	return $ret
+-rtrn=1
 +reload() {
-+        if [ ! -f $LOCK_FILE ]; then
-+                msg_not_running "$NAME"
-+                RETVAL=7
-+                return
-+        fi
-+        msg_reloading "$NAME"
-+        killproc $DAEMON -HUP
-+        RETVAL=$?
- }
++	if [ ! -f "$LOCK_FILE" ]; then
++		msg_not_running "$NAME"
++		RETVAL=7
++		return
++	fi
++	msg_reloading "$NAME"
++	killproc "$DAEMON" -HUP
++	RETVAL=$?
++}
  
--rtrn=1
--
 +RETVAL=0
  # See how we were called.
  case "$1" in
@@ -482,17 +622,17 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.162/
 -	rh_status_q && exit 0
  	start
 -	rtrn=$?
--	[ $rtrn = 0 ] && touch $LOCK_FILE
+-	[ $rtrn = 0 ] && touch "$LOCK_FILE"
  	;;
--
+ 
 -  stop|force-stop)
 -	rh_status_q || exit 0
 +  stop)
  	stop
 -	rtrn=$?
--	[ $rtrn = 0 ] && rm -f $LOCK_FILE
+-	[ $rtrn = 0 ] && rm -f "$LOCK_FILE"
  	;;
--
+ 
    restart)
 -	if stop
 -	then
@@ -502,7 +642,7 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.162/
 +	stop
 +	start
  	;;
--
+ 
    condrestart|try-restart)
 -	rh_status_q || exit 0
 -	if stop
@@ -512,32 +652,32 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.162/
 -	rtrn=$?
 +	condrestart 0
  	;;
--
+ 
    status)
 -	rh_status
 -	rtrn=$?
 +	status $DAEMON
 +	exit $?
  	;;
--
+ 
    *)
 -	echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
 +	msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
  	;;
  esac
--
+ 
 -exit $rtrn
 +exit $RETVAL
-diff -ur LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.162/scripts/lvm2_monitoring_init_red_hat.in
---- LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in	2016-07-28 18:50:18.000000000 +0000
-+++ LVM2.2.02.162/scripts/lvm2_monitoring_init_red_hat.in	2016-08-04 16:22:09.078554000 +0000
+diff -urp LVM2.2.02.177.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.177/scripts/lvm2_monitoring_init_red_hat.in
+--- LVM2.2.02.177.orig/scripts/lvm2_monitoring_init_red_hat.in	2017-12-18 20:44:35.000000000 +0000
++++ LVM2.2.02.177/scripts/lvm2_monitoring_init_red_hat.in	2018-01-29 11:33:20.925875809 +0000
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
  #
  # Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
  #
-@@ -31,15 +31,12 @@
+@@ -31,104 +31,92 @@
  
  . /etc/init.d/functions
  
@@ -546,24 +686,25 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.16
 +DAEMON="lvm2-monitor"
 +DMEVENTD_DAEMON="dmeventd"
  
--exec_prefix=@exec_prefix@
--sbindir=@sbindir@
--
--VGCHANGE=${sbindir}/vgchange
--VGS=${sbindir}/vgs
--LVS=${sbindir}/lvs
+-sbindir=@SBINDIR@
 +VGCHANGE="/sbin/vgchange"
 +VGS="/sbin/vgs"
 +LVS="/sbin/lvs"
  
- LOCK_FILE="/var/lock/subsys/$DAEMON"
- PID_FILE="@DMEVENTD_PIDFILE@"
-@@ -47,89 +44,69 @@
+-VGCHANGE="$sbindir/vgchange"
+-VGS="$sbindir/vgs"
+-LVS="$sbindir/lvs"
+-
+-LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
+-PID_FILE="@DMEVENTD_PIDFILE@"
++LOCK_FILE="/var/lock/subsys/$DAEMON"
++PID_FILE="/var/run/dmeventd.pid"
+ 
  WARN=1
  export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
  
 -rh_status() {
--	status -p $PID_FILE $DMEVENTD_DAEMON
+-	status -p "$PID_FILE" "$DMEVENTD_DAEMON"
 -}
 -
 -rh_status_q() {
@@ -578,8 +719,8 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.16
 +	VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config $config 2> /dev/null`
  	for vg in $VGSLIST
  	do
--	    action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
-+	    run_cmd "Starting monitoring for LVM VG $vg" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config $config $vg
+-	    action "Starting monitoring for VG $vg:" "$VGCHANGE" --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
++		run_cmd "Starting monitoring for LVM VG $vg" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config $config $vg
  	done
 -
 -	return $ret
@@ -599,8 +740,8 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.16
 +	VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config ${config} 2> /dev/null`
  	for vg in $VGSLIST
  	do
--	    action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
-+	    run_cmd "Stopping monitoring for LVM VG $vg" $VGCHANGE --monitor n --ignoreskippedcluster --config $config $vg
+-	    action "Stopping monitoring for VG $vg:" "$VGCHANGE" --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
++		run_cmd "Stopping monitoring for LVM VG $vg" $VGCHANGE --monitor n --ignoreskippedcluster --config $config $vg
  	done
 -	return $ret
  }
@@ -612,37 +753,37 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.16
  case "$1" in
    start)
 -	rh_status_q && exit 0
-+	status $DMEVENTD_DAEMON 1>/dev/null 2>&1 && exit 0
++	status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 && exit 0
  	start
 -	rtrn=$?
--	[ $rtrn = 0 ] && touch $LOCK_FILE
+-	[ "$rtrn" = 0 ] && touch "$LOCK_FILE"
 +	RETVAL=$?
-+	[ $RETVAL = 0 ] && touch $LOCK_FILE
++	[ "$RETVAL" = 0 ] && touch "$LOCK_FILE"
  	;;
--
+ 
    force-stop)
 -	rh_status_q || exit 0
-+	status $DMEVENTD_DAEMON 1>/dev/null 2>&1 || exit 0
++	status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 || exit 0
  	WARN=0
  	stop
 -	rtrn=$?
--	[ $rtrn = 0 ] && rm -f $LOCK_FILE
+-	[ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
 +	RETVAL=$?
-+	[ $RETVAL = 0 ] && rm -f $LOCK_FILE
++	[ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
  	;;
--
+ 
    stop)
 -	rh_status_q || exit 0
-+	status $DMEVENTD_DAEMON 1>/dev/null 2>&1 || exit 0
++	status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 || exit 0
  	test "$runlevel" = "0" && WARN=0
  	test "$runlevel" = "6" && WARN=0
  	stop
 -	rtrn=$?
--	[ $rtrn = 0 ] && rm -f $LOCK_FILE
+-	[ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
 +	RETVAL=$?
-+	[ $RETVAL = 0 ] && rm -f $LOCK_FILE
++	[ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
  	;;
--
+ 
    restart)
  	WARN=0
 -	if stop
@@ -651,23 +792,27 @@ diff -ur LVM2.2.02.162.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.16
 -	fi 
 -	rtrn=$?
 +	stop
++	RETVAL=$?
++	[ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
 +	start
++	RETVAL=$?
++	[ "$RETVAL" = 0 ] && touch "$LOCK_FILE"
  	;;
--
+ 
    status)
 -	rh_status
 -	rtrn=$?
--	[ $rtrn = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
-+	status $DMEVENTD_DAEMON
+-	[ "$rtrn" = 0 ] && "$LVS" -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
++	status "$DMEVENTD_DAEMON"
 +	RETVAL=$?
-+	[ $RETVAL = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
++	[ "$RETVAL" = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
  	;;
--
+ 
    *)
 -	echo $"Usage: $0 {start|stop|restart|status|force-stop}"
 +	msg_usage "$0 {start|stop|restart|status|force-stop}"
  	;;
  esac
--
+ 
 -exit $rtrn
 +exit $RETVAL
diff --git a/lvm2.spec b/lvm2.spec
index 0e1580c..ff787b3 100644
--- a/lvm2.spec
+++ b/lvm2.spec
@@ -1,80 +1,97 @@
 # TODO
 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
-# - --with-replicators (=internal/shared/none, default is none)?
+# - spec default value for --with-replicators (=internal/shared/none, configure default is none)?
+#   (also internal vs shared for lvm1,pool,cluster,snapshots,mirrors,raid,replicators,thin,cache;
+#    note: dmeventd requires mirrors=internal)
 #
 # Conditional build:
+# - initrd stuff
 %bcond_with	initrd		# build initrd version
 %bcond_without	uClibc		# link initrd version with uClibc
 %bcond_with	dietlibc	# link initrd version with dietlibc
 %bcond_with	glibc		# link initrd version with static GLIBC
+# - functionality
 %bcond_without  cluster		# disable all cluster support (clvmd&cmirrord)
-%bcond_without	lvmetad		# disable lvmetad (and lvmlockd)
-%bcond_without	lvmpolld	# disable lvmpolld (and lvmlockd)
-%bcond_without	lvmlockd	# disable lvmlockd
+%bcond_without	lvmetad		# lvmetad (and lvmlockd)
+%bcond_without	lvmdbusd	# lvmdbusd
+%bcond_without	lvmpolld	# lvmpolld (and lvmlockd)
+%bcond_without	lvmlockd	# lvmlockd
 %bcond_with	sanlock		# sanlock support in lvmlockd
 %bcond_with	replicator	# internal replicator support
+# - additional features
 %bcond_without	selinux		# SELinux support
-%bcond_without	python2		# Python 2.x binding
-%bcond_without	python3		# Python 3.x binding
+# - bindings
+%bcond_without	python		# Python bindings
+%bcond_without	python2		# Python 2 binding
+%bcond_without	python3		# Python 3 binding and lvmdbusd
 
 # lvmlockd requires lvmetad and lvmpolld
 %if %{without lvmetad} || %{without lvmpolld}
 %undefine	with_lvmpolld
 %endif
 
+# only glibc possible on SPARC
+%ifarch sparc sparcv9 sparc64
+%define		with_glibc 1
+%endif
 # if one of the *libc is enabled disable default dietlibc
 %if %{with dietlibc} && %{with uClibc}
 %undefine	with_dietlibc
 %endif
-
 # with glibc disables default dietlibc
 %if %{with glibc} && %{with dietlibc}
 %undefine	with_dietlibc
 %endif
-
 # fallback is glibc if neither alternatives are enabled
 %if %{without dietlibc} && %{without uClibc}
 %define		with_glibc	1
 %endif
+# for convenience
+%if %{without python}
+%undefine	with_python2
+%undefine	with_python3
+%endif
+%if %{without python3}
+%undefine	with_lvmdbusd
+%endif
 
 Summary:	The new version of Logical Volume Manager for Linux
 Summary(pl.UTF-8):	Nowa wersja Logical Volume Managera dla Linuksa
 Name:		lvm2
-Version:	2.02.168
+Version:	2.02.177
 Release:	1
 License:	GPL v2 and LGPL v2.1
 Group:		Applications/System
 Source0:	ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
-# Source0-md5:	00209bdd6befe9a7330f162909313ae8
-Source1:	clvmd.sysconfig
+# Source0-md5:	ee6cfbc5a0c5696ffae79dac04ee7a2b
+Source3:	clvmd.sysconfig
 Patch0:		%{name}-selinux.patch
 Patch1:		%{name}-diet.patch
 Patch2:		device-mapper-dmsetup-export.patch
 Patch3:		%{name}-tld_init.patch
 Patch4:		dl-dlsym.patch
-Patch6:		%{name}-lvm_path.patch
-Patch7:		%{name}-clvmd_cmd_timeout.patch
-Patch8:		device-mapper-dmsetup-deps-export.patch
-Patch9:		%{name}-run-dir.patch
+Patch8:		%{name}-clvmd_cmd_timeout.patch
+Patch9:		device-mapper-dmsetup-deps-export.patch
+Patch11:	%{name}-thin.patch
 URL:		http://www.sourceware.org/lvm2/
-BuildRequires:	autoconf >= 2.61
+BuildRequires:	autoconf >= 2.69
 BuildRequires:	automake
 # for /run detection
-BuildRequires:	autoconf-archive
 BuildRequires:	filesystem >= 3.0-43
 BuildRequires:	libblkid-devel >= 2.24
 %{?with_selinux:BuildRequires:	libselinux-devel >= 1.10}
 %{?with_selinux:BuildRequires:	libsepol-devel}
 BuildRequires:	ncurses-devel
 BuildRequires:	pkgconfig
-%{?with_python2:BuildRequires:	python-devel >= 1:2.6}
-%if %{with python3}
-BuildRequires:	python3-devel >= 1:3.2
-BuildRequires:	python3-modules >= 1:3.2
+%{?with_python2:BuildRequires:	python-devel >= 2}
+%{?with_python3:BuildRequires:	python3-devel >= 1:3.2}
+%if %{with lvmdbusd}
+BuildRequires:	python3-dbus
+BuildRequires:	python3-pyudev
 %endif
 BuildRequires:	readline-devel
 BuildRequires:	rpmbuild(macros) >= 1.647
-%{?with_sanlock:BuildRequires:	sanlock-devel >= 3.2.4}
+%{?with_sanlock:BuildRequires:	sanlock-devel >= 3.3.0}
 BuildRequires:	udev-devel >= 1:176
 %if %{with initrd}
 %if %{with dietlibc}
@@ -185,6 +202,37 @@ Ten demon polega na infrastrukturze klastra dostarczanej przez CMAN
 (Cluster MANager), który musi być skonfigurowany i działający, aby
 działał cmirrord.
 
+%package dbusd
+Summary:	LVM2 D-Bus daemon
+Summary(pl.UTF-8):	Demon LVM2 D-Bus
+Group:		Daemons
+Requires:	%{name} = %{version}-%{release}
+Requires:	python3-dbus
+Requires:	python3-pygobject3 >= 3
+Requires:	python3-pyudev
+
+%description dbusd
+Daemon for access to LVM2 functionality through a D-Bus interface.
+
+%description dbusd -l pl.UTF-8
+Demon umożliwiający dostęp do funkcjonalności LVM2 poprzez interfejs
+D-Bus.
+
+%package lockd
+Summary:	LVM2 locking daemon
+Summary(pl.UTF-8):	Demon blokad LVM2
+Group:		Daemons
+Requires:	%{name} = %{version}-%{release}
+%{?with_cluster:Requires:	dlm-libs >= 3.99.5}
+%{?with_sanlock:Requires:	sanlock-libs >= 3.3.0}
+
+%description lockd
+LVM commands use lvmlockd to coordinate access to shared storage.
+
+%description lockd -l pl.UTF-8
+Polecenia LVM wykorzystują lvmlockd do koordynowania dostępu do
+współdzielonej pamięci masowej.
+
 %package resource-agents
 Summary:	OCF Resource Agents for LVM2 processes
 Summary(pl.UTF-8):	Agenci OCF do monitorowania procesów LVM2
@@ -199,28 +247,28 @@ OCF Resource Agents for LVM2 processes.
 Agenci OCF do monitorowania procesów LVM2.
 
 %package -n python-lvm
-Summary:	Python interface to LVM2
-Summary(pl.UTF-8):	Interfejs Pythona do LVM2
+Summary:	Python 2 interface to LVM2
+Summary(pl.UTF-8):	Interfejs Pythona 2 do LVM2
 Group:		Libraries/Python
 Requires:	device-mapper-libs = %{version}-%{release}
 
 %description -n python-lvm
-Python interface to LVM2.
+Python 2 interface to LVM2.
 
 %description -n python-lvm -l pl.UTF-8
-Interfejs Pythona do LVM2.
+Interfejs Pythona 2 do LVM2.
 
 %package -n python3-lvm
-Summary:	Python interface to LVM2
-Summary(pl.UTF-8):	Interfejs Pythona do LVM2
+Summary:	Python 3 interface to LVM2
+Summary(pl.UTF-8):	Interfejs Pythona 3 do LVM2
 Group:		Libraries/Python
 Requires:	device-mapper-libs = %{version}-%{release}
 
 %description -n python3-lvm
-Python interface to LVM2.
+Python 3 interface to LVM2.
 
 %description -n python3-lvm -l pl.UTF-8
-Interfejs Pythona do LVM2.
+Interfejs Pythona 3 do LVM2.
 
 %package -n device-mapper
 Summary:	Userspace support for the device-mapper
@@ -248,9 +296,9 @@ narzędzia do zarządzania logicznymi wolumenami.
 Summary:	Device-mapper shared libraries
 Summary(pl.UTF-8):	Biblioteki współdzielone device-mappera
 Group:		Libraries
-Conflicts:	device-mapper < 2.02.119-1
 Requires:	libblkid >= 2.24
 Requires:	udev-libs >= 1:176
+Conflicts:	device-mapper < 2.02.119-1
 
 %description -n device-mapper-libs
 Device-mapper shared libraries.
@@ -337,10 +385,9 @@ potrzeby initrd.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
-%patch6 -p1
-%patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch11 -p1
 
 # do not force --export-symbol linker option for e.g. statically linked executables
 # -rdynamic compiler option drives linker in the right way.
@@ -380,8 +427,8 @@ cp -f /usr/share/automake/config.sub autoconf
 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
-mv -f tools/lvm.static initrd-lvm
-mv -f tools/dmsetup.static initrd-dmsetup
+%{__mv} tools/lvm.static initrd-lvm
+%{__mv} tools/dmsetup.static initrd-dmsetup
 
 # check if tools works
 for tool in initrd-lvm initrd-dmsetup; do
@@ -392,7 +439,7 @@ for tool in initrd-lvm initrd-dmsetup; do
 	fi
 done
 
-%{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
+%{?with_dietlibc:%{__mv} libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
 %{__make} clean
 
 unset CC
@@ -400,21 +447,26 @@ unset CC
 
 %configure \
 	--enable-applib \
+	--enable-cache_check_needs_check \
 	--enable-cmdlib \
+	%{?with_lvmdbusd:--enable-dbus-service} \
 	%{?debug:--enable-debug} \
 	--enable-dmeventd \
 	--enable-fsadm \
+	--with-default-locking-dir=/var/lock/lvm \
 %if %{with lvmlockd}
-	%{?with_cluster:--enable-lockd-dlm} \
-	%{?with_sanlock:--enable-lockd-sanlock} \
+	%{?with_cluster:--enable-lvmlockd-dlm} \
+	%{?with_sanlock:--enable-lvmlockd-sanlock} \
 %endif
 	%{?with_lvmetad:--enable-lvmetad} \
+	--enable-lvmpolld \
 	--enable-ocf \
-	%{?with_python2:--enable-python2-bindings} \
-	%{?with_python3:--enable-python3-bindings} \
+	%{?with_python2:--enable-python2_bindings} \
+	%{?with_python3:--enable-python3_bindings} \
 	--enable-readline \
 	%{!?with_selinux:--disable-selinux} \
 	--enable-pkgconfig \
+	--enable-thin_check_needs_check \
 	--enable-udev_sync \
 	--enable-udev_rules \
 	--with-cache=internal \
@@ -443,8 +495,11 @@ unset CC
 	--with-udev-prefix=/ \
 	--with-usrlibdir=%{_libdir}
 
-%{__make} -j1
-%{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
+# use bash because of "set -o pipefail"
+%{__make} -j1 \
+	SHELL=/bin/bash
+%{__make} -j1 -C libdm \
+	LIB_STATIC=libdevmapper.a
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -454,16 +509,14 @@ install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
 %{__make} install install_system_dirs install_initscripts \
 	DESTDIR=$RPM_BUILD_ROOT \
 	OWNER="" \
-	GROUP=""
-
-%{__make} -C scripts \
-	DESTDIR=$RPM_BUILD_ROOT \
+	GROUP="" \
+	python3dir=%{py3_sitescriptdir}
 
 %if %{with cluster}
-cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
 %endif
 
-mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
 	lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
 	slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
@@ -486,23 +539,16 @@ cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
 rm -rf $RPM_BUILD_ROOT
 
 %post
-/sbin/chkconfig --add lvm2-lvmetad
-%service lvm2-lvmetad restart
 /sbin/chkconfig --add lvm2-monitor
 %service lvm2-monitor restart
-/sbin/chkconfig --add lvm2-lvmpolld
-%service lvm2-lvmpolld restart
-# no service restart available
 /sbin/chkconfig --add blk-availability
+# no service blk-availability restart
 
-%preun
+%postun
 if [ "$1" = "0" ]; then
-	%service lvm2-lvmetad stop
-	/sbin/chkconfig --del lvm2-lvmetad
-	%service lvm2-lvmpolld stop
-	/sbin/chkconfig --del lvm2-lvmpolld
 	%service lvm2-monitor stop
 	/sbin/chkconfig --del lvm2-monitor
+	#no service blk-availability stop
 	/sbin/chkconfig --del blk-availability
 fi
 
@@ -527,9 +573,52 @@ fi
 %doc README WHATS_NEW doc/*
 %attr(755,root,root) %{_sbindir}/blkdeactivate
 %attr(755,root,root) %{_sbindir}/fsadm
-%attr(755,root,root) %{_sbindir}/lv*
-%attr(755,root,root) %{_sbindir}/pv*
-%attr(755,root,root) %{_sbindir}/vg*
+%attr(755,root,root) %{_sbindir}/lvchange
+%attr(755,root,root) %{_sbindir}/lvconvert
+%attr(755,root,root) %{_sbindir}/lvcreate
+%attr(755,root,root) %{_sbindir}/lvdisplay
+%attr(755,root,root) %{_sbindir}/lvextend
+%attr(755,root,root) %{_sbindir}/lvm
+%attr(755,root,root) %{_sbindir}/lvmconf
+%attr(755,root,root) %{_sbindir}/lvmconfig
+%attr(755,root,root) %{_sbindir}/lvmdiskscan
+%attr(755,root,root) %{_sbindir}/lvmdump
+%attr(755,root,root) %{_sbindir}/lvmsadc
+%attr(755,root,root) %{_sbindir}/lvmsar
+%attr(755,root,root) %{_sbindir}/lvreduce
+%attr(755,root,root) %{_sbindir}/lvremove
+%attr(755,root,root) %{_sbindir}/lvrename
+%attr(755,root,root) %{_sbindir}/lvresize
+%attr(755,root,root) %{_sbindir}/lvs
+%attr(755,root,root) %{_sbindir}/lvscan
+%attr(755,root,root) %{_sbindir}/pvchange
+%attr(755,root,root) %{_sbindir}/pvck
+%attr(755,root,root) %{_sbindir}/pvcreate
+%attr(755,root,root) %{_sbindir}/pvdisplay
+%attr(755,root,root) %{_sbindir}/pvmove
+%attr(755,root,root) %{_sbindir}/pvremove
+%attr(755,root,root) %{_sbindir}/pvresize
+%attr(755,root,root) %{_sbindir}/pvs
+%attr(755,root,root) %{_sbindir}/pvscan
+%attr(755,root,root) %{_sbindir}/vgcfgbackup
+%attr(755,root,root) %{_sbindir}/vgcfgrestore
+%attr(755,root,root) %{_sbindir}/vgchange
+%attr(755,root,root) %{_sbindir}/vgck
+%attr(755,root,root) %{_sbindir}/vgconvert
+%attr(755,root,root) %{_sbindir}/vgcreate
+%attr(755,root,root) %{_sbindir}/vgdisplay
+%attr(755,root,root) %{_sbindir}/vgexport
+%attr(755,root,root) %{_sbindir}/vgextend
+%attr(755,root,root) %{_sbindir}/vgimport
+%attr(755,root,root) %{_sbindir}/vgimportclone
+%attr(755,root,root) %{_sbindir}/vgmerge
+%attr(755,root,root) %{_sbindir}/vgmknodes
+%attr(755,root,root) %{_sbindir}/vgreduce
+%attr(755,root,root) %{_sbindir}/vgremove
+%attr(755,root,root) %{_sbindir}/vgrename
+%attr(755,root,root) %{_sbindir}/vgs
+%attr(755,root,root) %{_sbindir}/vgscan
+%attr(755,root,root) %{_sbindir}/vgsplit
 %{_mandir}/man5/lvm.conf.5*
 %{_mandir}/man7/lvmcache.7*
 %{_mandir}/man7/lvmraid.7*
@@ -538,9 +627,56 @@ fi
 %{_mandir}/man7/lvmthin.7*
 %{_mandir}/man8/blkdeactivate.8*
 %{_mandir}/man8/fsadm.8*
-%{_mandir}/man8/lv*.8*
-%{_mandir}/man8/pv*.8*
-%{_mandir}/man8/vg*.8*
+%{_mandir}/man8/lvchange.8*
+%{_mandir}/man8/lvconvert.8*
+%{_mandir}/man8/lvcreate.8*
+%{_mandir}/man8/lvdisplay.8*
+%{_mandir}/man8/lvextend.8*
+%{_mandir}/man8/lvm-config.8*
+%{_mandir}/man8/lvm-dumpconfig.8*
+%{_mandir}/man8/lvm-fullreport.8*
+%{_mandir}/man8/lvm-lvpoll.8*
+%{_mandir}/man8/lvm.8*
+%{_mandir}/man8/lvmconf.8*
+%{_mandir}/man8/lvmconfig.8*
+%{_mandir}/man8/lvmdiskscan.8*
+%{_mandir}/man8/lvmdump.8*
+%{_mandir}/man8/lvmsadc.8*
+%{_mandir}/man8/lvmsar.8*
+%{_mandir}/man8/lvreduce.8*
+%{_mandir}/man8/lvremove.8*
+%{_mandir}/man8/lvrename.8*
+%{_mandir}/man8/lvresize.8*
+%{_mandir}/man8/lvs.8*
+%{_mandir}/man8/lvscan.8*
+%{_mandir}/man8/pvchange.8*
+%{_mandir}/man8/pvck.8*
+%{_mandir}/man8/pvcreate.8*
+%{_mandir}/man8/pvdisplay.8*
+%{_mandir}/man8/pvmove.8*
+%{_mandir}/man8/pvremove.8*
+%{_mandir}/man8/pvresize.8*
+%{_mandir}/man8/pvs.8*
+%{_mandir}/man8/pvscan.8*
+%{_mandir}/man8/vgcfgbackup.8*
+%{_mandir}/man8/vgcfgrestore.8*
+%{_mandir}/man8/vgchange.8*
+%{_mandir}/man8/vgck.8*
+%{_mandir}/man8/vgconvert.8*
+%{_mandir}/man8/vgcreate.8*
+%{_mandir}/man8/vgdisplay.8*
+%{_mandir}/man8/vgexport.8*
+%{_mandir}/man8/vgextend.8*
+%{_mandir}/man8/vgimport.8*
+%{_mandir}/man8/vgimportclone.8*
+%{_mandir}/man8/vgmerge.8*
+%{_mandir}/man8/vgmknodes.8*
+%{_mandir}/man8/vgreduce.8*
+%{_mandir}/man8/vgremove.8*
+%{_mandir}/man8/vgrename.8*
+%{_mandir}/man8/vgs.8*
+%{_mandir}/man8/vgscan.8*
+%{_mandir}/man8/vgsplit.8*
 %attr(750,root,root) %dir %{_sysconfdir}/lvm
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvmlocal.conf
@@ -548,25 +684,32 @@ fi
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/cache-mq.profile
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/cache-smq.profile
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/command_profile_template.profile
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/lvmdbusd.profile
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/metadata_profile_template.profile
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-generic.profile
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-performance.profile
-%if %{with lvmetad}
-/lib/udev/rules.d/69-dm-lvm-metad.rules
-%endif
 %dir %{_sysconfdir}/lvm/cache
 %ghost %{_sysconfdir}/lvm/cache/.cache
 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
+%attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
+%attr(700,root,root) %dir /run/lvm
+%attr(700,root,root) %dir /var/lock/lvm
 %if %{with lvmetad}
+%attr(755,root,root) %{_sbindir}/lvmetad
+/lib/udev/rules.d/69-dm-lvm-metad.rules
 %attr(754,root,root) /etc/rc.d/init.d/lvm2-lvmetad
+%{_mandir}/man8/lvmetad.8*
+%endif
+%if %{with lvmlockd}
+%attr(755,root,root) %{_sbindir}/lvmlockctl
+%attr(755,root,root) %{_sbindir}/lvmlockd
+%{_mandir}/man8/lvmlockctl.8*
+%{_mandir}/man8/lvmlockd.8*
 %endif
 %if %{with lvmpolld}
+%attr(755,root,root) %{_sbindir}/lvmpolld
 %attr(754,root,root) /etc/rc.d/init.d/lvm2-lvmpolld
+%{_mandir}/man8/lvmpolld.8*
 %endif
-%attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
-%attr(700,root,root) %dir /var/lock/lvm
-%attr(700,root,root) %dir /var/run/lvm
 
 %if %{with cluster}
 %files clvmd
@@ -583,6 +726,17 @@ fi
 %{_mandir}/man8/cmirrord.8*
 %endif
 
+%if %{with lvmdbusd}
+%files dbusd
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_sbindir}/lvmdbusd
+%{py3_sitescriptdir}/lvmdbusd
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/lvmdbusd.profile
+#%config(noreplace) %verify(not md5 mtime size) /etc/dbus-1/system.d/com.redhat.lvmdbus1.conf
+#%{_datadir}/dbus-1/system-services/com.redhat.lvmdbus1.service
+%{_mandir}/man8/lvmdbusd.8*
+%endif
+
 %files resource-agents
 %defattr(644,root,root,755)
 %dir %{_prefix}/lib/ocf/resource.d/lvm2
@@ -598,7 +752,7 @@ fi
 %if %{with python3}
 %files -n python3-lvm
 %defattr(644,root,root,755)
-%attr(755,root,root) %{py3_sitedir}/lvm*.so
+%attr(755,root,root) %{py3_sitedir}/lvm.cpython-*.so
 %{py3_sitedir}/lvm-%{version}_*-py*.egg-info
 %endif
 
@@ -612,9 +766,15 @@ fi
 %attr(755,root,root) %{_sbindir}/dmeventd
 %attr(755,root,root) %{_sbindir}/dmsetup
 %attr(755,root,root) %{_sbindir}/dmstats
+%attr(755,root,root) %{_libdir}/libdevmapper-event-lvm2mirror.so
+%attr(755,root,root) %{_libdir}/libdevmapper-event-lvm2raid.so
+%attr(755,root,root) %{_libdir}/libdevmapper-event-lvm2snapshot.so
+%attr(755,root,root) %{_libdir}/libdevmapper-event-lvm2thin.so
 %dir %{_libdir}/device-mapper
-%attr(755,root,root) %{_libdir}/device-mapper/*.so
-%attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
+%attr(755,root,root) %{_libdir}/device-mapper/libdevmapper-event-lvm2mirror.so
+%attr(755,root,root) %{_libdir}/device-mapper/libdevmapper-event-lvm2raid.so
+%attr(755,root,root) %{_libdir}/device-mapper/libdevmapper-event-lvm2snapshot.so
+%attr(755,root,root) %{_libdir}/device-mapper/libdevmapper-event-lvm2thin.so
 %{_mandir}/man8/dmsetup.8*
 %{_mandir}/man8/dmstats.8*
 %{_mandir}/man8/dmeventd.8*
@@ -631,6 +791,7 @@ fi
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libdevmapper.so
 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
+%attr(755,root,root) %{_libdir}/libdevmapper-event-lvm2.so
 %attr(755,root,root) %{_libdir}/liblvm2app.so
 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
 %{_includedir}/libdevmapper.h
diff --git a/udev-deprecated.patch b/udev-deprecated.patch
deleted file mode 100644
index f2a26bf..0000000
--- a/udev-deprecated.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- LVM2.2.02.95/lib/misc/lvm-wrappers.c~	2011-04-22 14:00:00.000000000 +0200
-+++ LVM2.2.02.95/lib/misc/lvm-wrappers.c	2012-06-02 17:13:13.996363539 +0200
-@@ -72,7 +72,7 @@
- 		return NULL;
- 	}
- 
--	return udev_get_dev_path(_udev);
-+	return "/dev";
- }
- 
- struct udev* udev_get_library_context(void)
---- LVM2.2.02.95/tools/dmsetup.c~	2012-06-02 17:11:33.999700397 +0200
-+++ LVM2.2.02.95/tools/dmsetup.c	2012-06-02 17:18:14.323019614 +0200
-@@ -1047,12 +1047,11 @@
- 			  " defined by --udevcookie option.",
- 			  _udev_cookie);
- 
--	if (!(udev = udev_new()) ||
--	    !(udev_dev_dir = udev_get_dev_path(udev)) ||
--	    !*udev_dev_dir) {
--		log_error("Could not get udev dev path.");
-+	if (!(udev = udev_new())) {
-+		log_error("Could not get udev.");
- 		return 0;
- 	}
-+	udev_dev_dir = "/dev";
- 	udev_dev_dir_len = strlen(udev_dev_dir);
- 
- 	/*