--- /dev/null
+[Unit]
+Description=cluster LVM daemon
+After=syslog.target network.target corosync.service dlm.service
+Requires=dlm.service
+
+[Service]
+Type=notify
+NotifyAccess=main
+EnvironmentFile=/etc/sysconfig/clvmd
+ExecStart=/usr/sbin/clvmd -f $CLVMDOPTS
+ExecReload=/usr/sbin/clvmd -R
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+# CLVMDOPTS -- set command line options for clvmd
+# See clvmd man page for list of options.
+CLVMDOPTS="-T30"
--- /dev/null
+---
+ 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;
+ const char *name = NULL;
+ const char *uuid = NULL;
+ struct dm_info info;
++ struct dm_deps *deps;
+
+ 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);
+ }
+ printf("\n");
+ }
+
++ dm_task_destroy(dmt);
++
++ if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
++ goto out;
++
++ name = NULL;
++ if (names)
++ name = names->name;
++ else if (argc == 2)
++ name = argv[1];
++
++ if (!_set_task_device(dmt, name, 0))
++ goto out;
++
++ if (!dm_task_run(dmt))
++ goto out;
++
++ if (!(deps = dm_task_get_deps(dmt)))
++ goto out;
++
++ printf("DM_DEPS=%d\n", deps->count);
++
+ r = 1;
+ out:
+ if (dmt)
+ dm_task_destroy(dmt);
+ return r;
--- /dev/null
+---
+ man/dmsetup.8.in | 7 ++++
+ tools/dmsetup.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 95 insertions(+)
+
+Index: LVM2.2.02.98/man/dmsetup.8.in
+===================================================================
+--- LVM2.2.02.98.orig/man/dmsetup.8.in
++++ LVM2.2.02.98/man/dmsetup.8.in
+@@ -17,10 +17,13 @@ dmsetup \- low level logical volume mana
+ .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }]
+ .RB [ \-\-readahead
+ .RI [ \+ ]< sectors >| auto | none ]
+ .RE
+ .br
++.B dmsetup export
++.I [ device_name ]
++.br
+ .B dmsetup deps
+ .RB [ \-o
+ .IR options ]
+ .RI [ device_name ]
+ .br
+@@ -283,10 +286,14 @@ Otherwise a table is read from standard
+ The optional uuid can be used in place of
+ device_name in subsequent dmsetup commands.
+ If successful a device will appear as
+ /dev/mapper/<device-name>.
+ See below for information on the table format.
++.IP \fBexport
++.I [ device_name ]
++.br
++Outputs information in key/value format to be imported by other programs.
+ .br
+ .TP
+ .B deps
+ .RB [ \-o
+ .IR options ]
+Index: LVM2.2.02.98/tools/dmsetup.c
+===================================================================
+--- LVM2.2.02.98.orig/tools/dmsetup.c
++++ LVM2.2.02.98/tools/dmsetup.c
+@@ -1706,10 +1706,97 @@ static int _status(CMD_ARGS)
+ out:
+ dm_task_destroy(dmt);
+ return r;
+ }
+
++static int _export(CMD_ARGS)
++{
++ int r = 0;
++ struct dm_task *dmt = NULL;
++ void *next = NULL;
++ uint64_t start, length;
++ char *target_type = NULL;
++ char *params;
++ const char *name = NULL;
++ const char *uuid = NULL;
++ struct dm_info info;
++
++ if (names)
++ name = names->name;
++ else if (argc == 2)
++ name = argv[1];
++
++ if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
++ goto out;
++
++ if (!_set_task_device(dmt, name, 0))
++ goto out;
++
++ if (!dm_task_run(dmt))
++ goto out;
++
++ if (!dm_task_get_info(dmt, &info) || !info.exists)
++ goto out;
++
++ if (!name)
++ name = dm_task_get_name(dmt);
++
++ uuid = dm_task_get_uuid(dmt);
++ printf("DM_NAME=%s\n", name);
++
++ if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
++ printf("DM_UUID=%s\n", uuid);
++
++ if (!info.exists) {
++ printf("DM_STATE=NOTPRESENT\n");
++ goto out;
++ }
++
++ printf("DM_STATE=%s\n",
++ info.suspended ? "SUSPENDED" :
++ (info.read_only ? "READONLY" : "ACTIVE"));
++
++ if (!info.live_table && !info.inactive_table)
++ printf("DM_TABLE_STATE=NONE\n");
++ else
++ printf("DM_TABLE_STATE=%s%s%s\n",
++ info.live_table ? "LIVE" : "",
++ info.live_table && info.inactive_table ? "/" : "",
++ info.inactive_table ? "INACTIVE" : "");
++
++ if (info.open_count != -1)
++ printf("DM_OPENCOUNT=%d\n", info.open_count);
++
++ printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
++
++ printf("DM_MAJOR=%d\n", info.major);
++ printf("DM_MINOR=%d\n", info.minor);
++
++ if (info.target_count != -1)
++ printf("DM_TARGET_COUNT=%d\n", info.target_count);
++
++ /* export all table types */
++ next = dm_get_next_target(dmt, next, &start, &length,
++ &target_type, ¶ms);
++ if (target_type) {
++ printf("DM_TARGET_TYPES=%s", target_type);
++ while (next) {
++ next = dm_get_next_target(dmt, next, &start, &length,
++ &target_type, ¶ms);
++ if (target_type)
++ printf(",%s", target_type);
++ }
++ printf("\n");
++ }
++
++ r = 1;
++ out:
++ if (dmt)
++ dm_task_destroy(dmt);
++ return r;
++}
++
+ /* Show target names and their version numbers */
+ static int _targets(CMD_ARGS)
+ {
+ int r = 0;
+ struct dm_task *dmt;
+@@ -3056,10 +3143,11 @@ static struct command _commands[] = {
+ {"message", "<device> <sector> <message>", 2, -1, 0, _message},
+ {"ls", "[--target <target_type>] [--exec <command>] [-o options] [--tree]", 0, 0, 0, _ls},
+ {"info", "[<device>]", 0, -1, 1, _info},
+ {"deps", "[-o options] [<device>]", 0, -1, 1, _deps},
+ {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, _status},
++ {"export", "[<device>]", 0, 1, 1, _export},
+ {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, _status},
+ {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, _wait},
+ {"mknodes", "[<device>]", 0, -1, 1, _mknodes},
+ {"mangle", "[<device>]", 0, -1, 1, _mangle},
+ {"udevcreatecookie", "", 0, 0, 0, _udevcreatecookie},
--- /dev/null
+--- 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 @@
+ return 1;
+ }
+
++#ifdef HAVE_LIBDL
+ static int _init_single_segtype(struct cmd_context *cmd,
+ struct segtype_library *seglib)
+ {
+@@ -893,6 +894,7 @@
+
+ return lvm_register_segtype(seglib, segtype);
+ }
++#endif
+
+ static int _init_segtypes(struct cmd_context *cmd)
+ {
--- /dev/null
+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)
+ }
+ }
+
+- /* Select timed out. Check for clients that have been waiting too long for a response */
+- if (select_status == 0) {
++ /* Check for clients that have been waiting too long for a response */
++ if (select_status >= 0) {
+ time_t the_time = time(NULL);
+
+ for (thisfd = &local_client_head; thisfd != NULL;
--- /dev/null
+--- 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 @@
+ #ifdef M_MMAP_MAX
+ mallopt(M_MMAP_MAX, 0);
+ #endif
+-
++#ifdef __dietlibc__
+ if (!setlocale(LC_ALL, ""))
+ log_very_verbose("setlocale failed");
+-
++#endif
+ #ifdef INTL_PACKAGE
+ bindtextdomain(INTL_PACKAGE, LOCALEDIR);
+ #endif
+--- LVM2.2.02.45/lib/locking/file_locking.c 2008-11-12 10:30:52.000000000 +0100
++++ LVM2.2.02.45-diet/lib/locking/file_locking.c 2009-03-18 12:18:52.000000000 +0100
+@@ -30,6 +30,10 @@
+ #include <fcntl.h>
+ #include <signal.h>
+
++#ifdef __dietlibc__
++typedef void (*sig_t) (int);
++#endif
++
+ struct lock_list {
+ struct dm_list list;
+ int lf;
+--- 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>
+
++#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>
+
++#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
++# 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>
+
++#ifdef __dietlibc__
++# 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
++
+ #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"
+
++#ifdef __dietlibc__
++#define __UINT64_C(c) c ## ULL
++# define UINT64_MAX (__UINT64_C(18446744073709551615))
++#endif
++
+ 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>
+
++#ifdef __dietlibc__
++# 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
++#define canonicalize_file_name(x) realpath(x, NULL)
++#endif
++#include <strings.h>
++
+ /* FIXME Unused so far */
+ #undef HAVE_SYS_STATVFS_H
+
+--- LVM2.2.02.65/tools/Makefile.in~ 2010-05-18 13:18:54.344217166 +0200
++++ LVM2.2.02.65/tools/Makefile.in 2010-05-18 13:21:19.303172002 +0200
+@@ -122,18 +122,18 @@
+ device-mapper: $(TARGETS_DM)
+
+ dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
+- $(CC) $(CFLAGS) $(LDFLAGS) -L$(top_builddir)/libdm \
++ $(CC) $(CFLAGS) -L$(interfacedir) -L$(top_builddir)/libdm $(LDFLAGS) \
+ -o $@ dmsetup.o -ldevmapper $(LIBS)
+
+ dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
+- $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
+- -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS)
++ $(CC) $(CFLAGS) -static -L$(interfacebuilddir) $(LDFLAGS) \
++ -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS) $(DIETLIBC_LIBS)
+
+ all: device-mapper
+
+ lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
+- $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
++ $(CC) $(CFLAGS) -L$(interfacedir) $(LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
+ $(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic
+
+ lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a
+
+--- LVM2.2.02.65/tools/Makefile.in~ 2010-05-18 13:39:46.797633173 +0200
++++ LVM2.2.02.65/tools/Makefile.in 2010-05-18 13:46:01.629690313 +0200
+@@ -137,7 +137,7 @@
+
+ lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(interfacebuilddir)/libdevmapper.a
+ $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
+- $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
++ $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS) $(DIETLIBC_LIBS)
+
+ 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"
+
++#ifdef __dietlibc__
++# ifndef UINT64_MAX
++# define UINT64_MAX __UINT64_MAX__
++# endif
++#endif
++
+ /*
+ * FIXME: Check for valid handle before dereferencing field or log error?
+ */
--- /dev/null
+diff -dur -x '*~' LVM2.2.02.95.orig/configure.in LVM2.2.02.95/configure.in
+--- LVM2.2.02.95.orig/configure.in 2012-07-01 15:33:45.000000000 +0200
++++ LVM2.2.02.95/configure.in 2012-07-02 18:41:07.560481138 +0200
+@@ -1267,7 +1267,7 @@
+ lvm_exec_prefix=$exec_prefix
+ test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$prefix
+ test "$lvm_exec_prefix" = NONE && lvm_exec_prefix=$ac_default_prefix
+-LVM_PATH="$lvm_exec_prefix/sbin/lvm"
++LVM_PATH="$sbindir/lvm"
+ AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
+
+ if test "$CLVMD" != none; then
--- /dev/null
+diff -dur LVM2.2.02.98.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.98/scripts/blk_availability_init_red_hat.in
+--- LVM2.2.02.98.orig/scripts/blk_availability_init_red_hat.in 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/scripts/blk_availability_init_red_hat.in 2012-10-25 12:01:33.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ #
+ # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+ #
+@@ -43,16 +43,20 @@
+ case "$1" in
+ start)
+ touch $LOCK_FILE
++ exit 0
+ ;;
+
+ stop)
+- action "Stopping block device availability:" $sbindir/$script $options
++ run_cmd "Stopping block device availability:" $sbindir/$script $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 -dur LVM2.2.02.98.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.98/scripts/clvmd_init_red_hat.in
+--- LVM2.2.02.98.orig/scripts/clvmd_init_red_hat.in 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/scripts/clvmd_init_red_hat.in 2012-10-25 11:57:52.000000000 +0200
+@@ -65,9 +65,8 @@
+ start()
+ {
+ if ! rh_status_q; then
+- echo -n "Starting $DAEMON: "
++ msg_starting "$DAEMON"
+ $DAEMON $CLVMDOPTS || return $?
+- echo
+ fi
+
+ # Refresh local cache.
+@@ -87,7 +86,7 @@
+
+ ${lvm_vgscan} > /dev/null 2>&1
+
+- action "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
++ run_cmd "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
+
+ touch $LOCK_FILE
+
+@@ -112,27 +111,23 @@
+
+ [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
+ if [ -n "$LVM_VGS" ]; then
+- 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 $?
+
+ # wait half second before we start the waiting loop or we will show
+ # the loop more time than really necessary
+ usleep 500000
+
+ # clvmd could take some time to stop
+- rh_status_q && action "Waiting for $DAEMON to exit:" wait_for_finish
++ rh_status_q && run_cmd "Waiting for $DAEMON to exit:" wait_for_finish
+
+ if rh_status_q; then
+- echo -n "$DAEMON failed to exit"
+- failure
+- echo
++ fail
+ return 1
+ else
+- echo -n "$DAEMON terminated"
+- success
+- echo
++ ok
+ fi
+
+ rm -f $LOCK_FILE
+@@ -142,7 +137,7 @@
+
+ reload() {
+ rh_status_q || exit 7
+- action "Reloading $DAEMON configuration: " $DAEMON -R || return $?
++ run_cmd "Reloading $DAEMON configuration: " $DAEMON -R || return $?
+ }
+
+ restart() {
+@@ -153,7 +148,7 @@
+
+ # Try to get clvmd to restart itself. This will preserve
+ # exclusive LV locks
+- action "Restarting $DAEMON: " $DAEMON -S
++ run_cmd "Restarting $DAEMON: " $DAEMON -S
+
+ # If that fails then do a normal stop & restart
+ if [ $? != 0 ]; then
+diff -dur LVM2.2.02.98.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.98/scripts/lvm2_monitoring_init_red_hat.in
+--- LVM2.2.02.98.orig/scripts/lvm2_monitoring_init_red_hat.in 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/scripts/lvm2_monitoring_init_red_hat.in 2012-10-25 11:57:52.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ #
+ # Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
+ #
+@@ -46,12 +46,19 @@
+
+ start()
+ {
+- ret=0
++ local ret=0
+ # TODO do we want to separate out already active groups only?
+ VGSLIST=`$VGS --noheadings -o name --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
+ for vg in $VGSLIST
+ do
+- action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y --poll y --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
++ msg_starting "Starting monitoring for VG $vg:"; busy
++ $VGCHANGE --monitor y --poll y --config 'log{command_names=0 prefix=" "}' $vg
++ ret=$?
++ if [ $ret -ne 0 ]; then
++ fail
++ return $ret
++ fi
++ ok
+ done
+
+ return $ret
+@@ -60,7 +67,7 @@
+
+ stop()
+ {
+- ret=0
++ local ret=0
+ # TODO do we want to separate out already active groups only?
+ if test "$WARN" = "1"; then
+ echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
+@@ -69,7 +76,14 @@
+ VGSLIST=`$VGS --noheadings -o name --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
+ for vg in $VGSLIST
+ do
+- action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
++ msg_stopping "Stopping monitoring for VG $vg:"; busy
++ $VGCHANGE --monitor n --config 'log{command_names=0 prefix=" "}' $vg
++ ret=$?
++ if [ $ret -ne 0 ]; then
++ fail
++ return $ret
++ fi
++ ok
+ done
+ return $ret
+ }
+diff -dur LVM2.2.02.98.orig/scripts/lvm2_monitoring_systemd_red_hat.service.in LVM2.2.02.98/scripts/lvm2_monitoring_systemd_red_hat.service.in
+--- LVM2.2.02.98.orig/scripts/lvm2_monitoring_systemd_red_hat.service.in 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/scripts/lvm2_monitoring_systemd_red_hat.service.in 2012-10-25 11:57:52.000000000 +0200
+@@ -2,7 +2,7 @@
+ Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
+ Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
+ Requires=dm-event.socket
+-After=dm-event.socket fedora-storage-init.service fedora-storage-init-late.service lvm2-activation.service lvm2-lvmetad.service
++After=dm-event.socket pld-storage-init.service pld-storage-init-late.service lvm2-activation.service lvm2-lvmetad.service
+ Before=local-fs.target
+ DefaultDependencies=no
+ Conflicts=shutdown.target
+diff -dur LVM2.2.02.98.orig/scripts/blk_availability_systemd_red_hat.service.in LVM2.2.02.98/scripts/blk_availability_systemd_red_hat.service.in
+--- LVM2.2.02.98.orig/scripts/blk_availability_systemd_red_hat.service.in 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/scripts/blk_availability_systemd_red_hat.service.in 2012-10-29 15:38:31.000000000 +0100
+@@ -6,7 +6,7 @@
+
+ [Service]
+ Type=oneshot
+-ExecStart=/usr/bin/true
++ExecStart=/bin/true
+ ExecStop=@sbindir@/blkdeactivate -u -l wholevg
+ RemainAfterExit=yes
+
--- /dev/null
+diff -dur LVM2.2.02.98.orig/daemons/clvmd/Makefile.in LVM2.2.02.98/daemons/clvmd/Makefile.in
+--- LVM2.2.02.98.orig/daemons/clvmd/Makefile.in 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/daemons/clvmd/Makefile.in 2012-11-01 18:35:19.000000000 +0100
+@@ -90,6 +90,8 @@
+ DEFS += -D_REENTRANT
+ CFLAGS += -fno-strict-aliasing
+
++LIBS += `pkg-config --libs libsystemd-daemon`
++
+ INSTALL_TARGETS = \
+ install_clvmd
+
+diff -dur LVM2.2.02.98.orig/daemons/clvmd/clvmd.c LVM2.2.02.98/daemons/clvmd/clvmd.c
+--- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c 2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/daemons/clvmd/clvmd.c 2012-11-01 18:34:20.000000000 +0100
+@@ -41,6 +41,8 @@
+ #include <sys/un.h>
+ #include <sys/utsname.h>
+
++#include <systemd/sd-daemon.h>
++
+ #ifndef TRUE
+ #define TRUE 1
+ #endif
+@@ -599,6 +601,7 @@
+ clops->cluster_init_completed();
+
+ DEBUGLOG("clvmd ready for work\n");
++ sd_notify(0, "READY=1");
+ child_init_signal(SUCCESS);
+
+ /* Try to shutdown neatly */
--- /dev/null
+--- 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
+
+ LVMLIBS += -ldevmapper
++ifneq ("@STATIC_LINK@", "yes")
++ LVMLIBS += -lselinux -lsepol
++endif
+
+ DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
+
--- /dev/null
+D /var/lock/lvm 0700 root root -
+D /var/run/lvm 0700 root root -
--- /dev/null
+--- LVM2.2.02.94/lib/misc/lvm-wrappers.h~ 2011-04-22 14:00:00.000000000 +0200
++++ LVM2.2.02.94/lib/misc/lvm-wrappers.h 2012-03-04 10:43:46.032807285 +0100
+@@ -33,7 +34,8 @@
+ */
+ int read_urandom(void *buf, size_t len);
+
+-# ifndef HAVE_SIGINTERRUPT
++#ifndef HAVE_SIGINTERRUPT
++#include <signal.h>
+ # define siginterrupt(sig, flag) \
+ do { \
+ int ret; \
+@@ -45,7 +47,7 @@
+ act.sa_flags |= SA_RESTART; \
+ ret = sigaction(sig, &act, NULL); \
+ return ret; \
+- while (0)
+-# endif
++ } while (0);
++#endif
+
+ #endif
--- /dev/null
+# TODO
+# - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
+# - --with-replicators (=internal/shared/none, default is none)?
+# - OCF agents?
+#
+# Conditional build:
+%bcond_without initrd # don't 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
+%bcond_without cluster # disable all cluster support (clvmd&cmirrord)
+%bcond_with lvmetad # enable lvmetad
+%bcond_without selinux # disable SELinux
+
+%ifarch sparc64 sparc
+%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
+
+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.98
+Release: 3
+License: GPL v2 and LGPL v2.1
+Group: Applications/System
+Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
+# Source0-md5: 1ce5b7f9981e1d02dfd1d3857c8d9fbe
+Source1: %{name}-tmpfiles.conf
+Source2: clvmd.service
+Source3: clvmd.sysconfig
+Patch0: %{name}-selinux.patch
+Patch1: %{name}-diet.patch
+Patch2: device-mapper-dmsetup-export.patch
+Patch3: %{name}-pld_init.patch
+Patch4: dl-dlsym.patch
+Patch5: %{name}-wrapper.patch
+Patch6: %{name}-lvm_path.patch
+Patch7: %{name}-sd_notify.patch
+Patch8: %{name}-clvmd_cmd_timeout.patch
+Patch9: device-mapper-dmsetup-deps-export.patch
+URL: http://sources.redhat.com/lvm2/
+BuildRequires: autoconf >= 2.61
+BuildRequires: automake
+%{?with_selinux:BuildRequires: libselinux-devel >= 1.10}
+%{?with_selinux:BuildRequires: libsepol-devel}
+BuildRequires: ncurses-devel
+BuildRequires: pkgconfig
+BuildRequires: readline-devel
+BuildRequires: rpmbuild(macros) >= 1.647
+BuildRequires: udev-devel >= 143
+%if %{with initrd}
+%if %{with dietlibc}
+BuildRequires: dietlibc-static >= 2:0.32-7
+BuildConflicts: device-mapper-dietlibc
+%endif
+%if %{with glibc}
+%{?with_selinux:BuildRequires: libselinux-static}
+%{?with_selinux:BuildRequires: libsepol-static}
+%endif
+%{?with_glibc:BuildRequires: glibc-static}
+%{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
+%endif
+%if %{with cluster}
+BuildRequires: corosync-devel
+BuildRequires: dlm-devel >= 3.99.5
+BuildRequires: systemd-devel
+%endif
+Requires(post,preun,postun): systemd-units >= 38
+Requires(post,postun): /sbin/chkconfig
+Requires: device-mapper >= %{version}-%{release}
+%{?with_selinux:Requires: libselinux >= 1.10}
+Requires: systemd-units >= 38
+# doesn't work with 2.4 kernels
+Requires: uname(release) >= 2.6
+Obsoletes: lvm
+Obsoletes: lvm2-systemd
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define _sbindir /sbin
+%define _usrsbindir /usr/sbin
+
+# changing CFLAGS in the middle confuses confcache
+%undefine configure_cache
+
+# borken on AC
+%define filterout_ld -Wl,--as-needed
+
+# causes: undefined reference to `__stack_chk_fail_local'
+%define filterout_c -fstack-protector
+
+# for some reason known only to rpm there must be "\\|" not "\|" here
+%define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
+%define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
+
+%define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
+
+%description
+This package includes a number of utilities for creating, checking,
+and repairing logical volumes.
+
+%description -l pl.UTF-8
+Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
+logicznych wolumenów dyskowych (LVM2).
+
+%package initrd
+Summary: The new version of Logical Volume Manager for Linux - initrd version
+Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
+Group: Base
+Conflicts: geninitrd < 10000.18
+
+%description initrd
+This package includes a number of utilities for creating, checking,
+and repairing logical volumes - staticaly linked for initrd.
+
+%description initrd -l pl.UTF-8
+Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
+logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
+potrzeby initrd.
+
+%package clvmd
+Summary: Cluster LVM daemon
+Summary(pl.UTF-8): Demon clustra LVM
+Group: Applications/System
+Requires: %{name} = %{version}-%{release}
+
+%description clvmd
+clvmd is the daemon that distributes LVM metadata updates around a
+cluster. It must be running on all nodes in the cluster and will give
+an error if a node in the cluster does not have this daemon running.
+
+%description clvmd -l pl.UTF-8
+clvmd to demon który rozprowadza zmiany meta-danych LVM po klastrze.
+Mysi działać na wszystkich węzłach klastra i zgłosi błąd gdy jakiś
+węzeł w klastrze nie ma tego demona uruchomionego.
+
+%package cmirrord
+Summary: Cluster mirror log daemon
+Group: Applications/System
+Requires: %{name} = %{version}-%{release}
+
+%description cmirrord
+cmirrord is the daemon that tracks mirror log information in a
+cluster. It is specific to device-mapper based mirrors (and by
+extension, LVM cluster mirrors). Cluster mirrors are not possible
+without this daemon running.
+
+This daemon relies on the cluster infrastructure provided by the
+Cluster MANager (CMAN), which must be set up and running in order for
+cmirrord to function.
+
+%package -n device-mapper
+Summary: Userspace support for the device-mapper
+Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
+Group: Base
+Requires(post,preun,postun): systemd-units >= 38
+Requires: systemd-units >= 38
+
+%description -n device-mapper
+The goal of this driver is to support volume management. The driver
+enables the definition of new block devices composed of ranges of
+sectors of existing devices. This can be used to define disk
+partitions - or logical volumes. This light-weight kernel component
+can support user-space tools for logical volume management.
+
+%description -n device-mapper -l pl.UTF-8
+Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
+włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
+sektorów na istniejących urządzeniach. Może to być wykorzystane do
+definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
+składnik jądra może wspierać działające w przestrzeni użytkownika
+narzędzia do zarządzania logicznymi wolumenami.
+
+%package -n device-mapper-devel
+Summary: Header files and development documentation for %{name}
+Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
+Group: Development/Libraries
+Requires: device-mapper = %{version}-%{release}
+%if %{with selinux}
+Requires: libselinux-devel
+Requires: libsepol-devel
+%endif
+
+%description -n device-mapper-devel
+Header files and development documentation for %{name}.
+
+%description -n device-mapper-devel -l pl.UTF-8
+Pliki nagłówkowe i dokumentacja do %{name}.
+
+%package -n device-mapper-static
+Summary: Static devmapper library
+Summary(pl.UTF-8): Statyczna biblioteka devmapper
+License: LGPL v2.1
+Group: Development/Libraries
+Requires: device-mapper-devel = %{version}-%{release}
+
+%description -n device-mapper-static
+Static devmapper library.
+
+%description -n device-mapper-static -l pl.UTF-8
+Statyczna biblioteka devmapper.
+
+%package -n device-mapper-dietlibc
+Summary: Static devmapper library built with dietlibc
+Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
+License: LGPL v2.1
+Group: Development/Libraries
+Requires: device-mapper-devel = %{version}-%{release}
+
+%description -n device-mapper-dietlibc
+Static devmapper library built with dietlibc.
+
+%description -n device-mapper-dietlibc -l pl.UTF-8
+Statyczna biblioteka devmapper zbudowana z dietlibc.
+
+%package -n device-mapper-initrd
+Summary: Userspace support for the device-mapper - initrd version
+Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
+Group: Base
+Obsoletes: device-mapper-initrd-devel
+Conflicts: geninitrd < 10000.10
+
+%description -n device-mapper-initrd
+The goal of this driver is to support volume management. The driver
+enables the definition of new block devices composed of ranges of
+sectors of existing devices. This can be used to define disk
+partitions - or logical volumes. This light-weight kernel component
+can support user-space tools for logical volume management.
+
+This package contains dmsetup program linked staticaly for use in
+initrd.
+
+%description -n device-mapper-initrd -l pl.UTF-8
+Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
+włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
+sektorów na istniejących urządzeniach. Może to być wykorzystane do
+definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
+składnik jądra może wspierać działające w przestrzeni użytkownika
+narzędzia do zarządzania logicznymi wolumenami.
+
+Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
+potrzeby initrd.
+
+%prep
+%setup -q -n LVM2.%{version}
+%{?with_selinux:%patch0 -p1}
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+
+# do not force --export-symbol linker option for e.g. statically linked executables
+# -rdynamic compiler option drives linker in the right way.
+%{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
+
+%build
+%if %{with initrd}
+echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
+%endif
+cp -f /usr/share/automake/config.sub autoconf
+%{__aclocal}
+%{__autoconf}
+
+%if %{with initrd}
+%{?with_glibc:export CC="%{__cc}"}
+%{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
+%{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
+
+%configure \
+ ac_cv_lib_dl_dlopen=no \
+ %{?with_uClibc:ac_cv_func_siginterrupt=no} \
+ %{?debug:--enable-debug} \
+ --with-optimisation="%{rpmcflags} -Os" \
+ --enable-static_link \
+ --with-lvm1=internal \
+ --disable-selinux \
+ --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
+ --disable-readline \
+ --disable-nls
+# glibc version links with normal static libdevicemapper which has selinux enabled
+# and we need to keep these in sync between device-mapper and lvm2
+
+%{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
+%{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
+
+%{__make} -j1 -C include
+%{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
+%{__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
+
+# check if tools works
+for tool in initrd-lvm initrd-dmsetup; do
+ LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
+ if [ $rc -gt 127 ]; then
+ echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
+ exit 1
+ fi
+done
+
+
+%{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
+%{__make} clean
+
+unset CC
+%endif
+
+%configure \
+ --with-usrlibdir=%{_libdir} \
+ %{?debug:--enable-debug} \
+ --with-optimisation="%{rpmcflags}" \
+ --enable-readline \
+ --enable-fsadm \
+ --enable-applib \
+ --enable-cmdlib \
+ %{?with_lvmetad:--enable-lvmetad} \
+ --enable-dmeventd \
+ --with-dmeventd-path=%{_sbindir}/dmeventd \
+ --enable-pkgconfig \
+ --enable-udev_sync \
+ --enable-udev_rules \
+%if %{with cluster}
+ --with-clvmd=corosync \
+ --enable-cmirrord \
+%endif
+ --with-lvm1=internal \
+ --with-pool=internal \
+ --with-cluster=internal \
+ --with-snapshots=internal \
+ --with-mirrors=internal \
+ --with-thin=internal \
+ --with-thin-check="" \
+ --with-interface=ioctl \
+ --with-udev-prefix=/ \
+ --with-systemd_dir=%{systemdunitdir} \
+ %{!?with_selinux:--disable-selinux}
+
+%{__make} -j1
+%{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
+%{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
+
+%{__make} install install_system_dirs install_systemd_units install_initscripts \
+ DESTDIR=$RPM_BUILD_ROOT \
+ OWNER="" \
+ GROUP=""
+
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
+
+%if %{with cluster}
+install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/clvmd.service
+install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
+%endif
+
+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')
+ ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
+done
+
+touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
+
+%if %{with initrd}
+install -d $RPM_BUILD_ROOT%{_libdir}/initrd
+install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
+install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
+
+%{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
+%endif
+
+cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/chkconfig --add lvm2-monitor
+%service lvm2-monitor restart
+%systemd_post lvm2-monitor.service
+/sbin/chkconfig --add blk-availability
+# no service blk-availability restart
+%systemd_post blk-availability.service
+
+%preun
+%systemd_preun lvm2-monitor.service
+%systemd_preun blk-availability.service
+
+%postun
+if [ "$1" = "0" ]; then
+ %service lvm2-monitor stop
+ /sbin/chkconfig --del lvm2-monitor
+ #no service blk-availability stop
+ /sbin/chkconfig --del blk-availability
+fi
+%systemd_reload
+
+%triggerpostun -- %{name} < 2.02.94-1
+%systemd_trigger lvm2-monitor.service
+
+%post -n device-mapper
+/sbin/ldconfig
+%systemd_post dm-event.socket
+
+%preun -n device-mapper
+%systemd_preun dm-event.socket dm-event.service
+
+%postun -n device-mapper
+/sbin/ldconfig
+%systemd_reload
+
+%triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
+%systemd_trigger dm-event.socket
+
+%post clvmd
+/sbin/chkconfig --add clvmd
+# no service restart - it breaks current locks!
+export NORESTART=1
+%systemd_post clvmd.service
+# re-exec instead
+/usr/sbin/clvmd -S 2>/dev/null || :
+
+%preun clvmd
+%systemd_preun clvmd.service
+
+%postun clvmd
+if [ "$1" = "0" ]; then
+ %service clvmd stop
+ /sbin/chkconfig --del clvmd
+fi
+%systemd_reload
+
+%files
+%defattr(644,root,root,755)
+%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*
+%{_mandir}/man5/lvm.conf.5*
+%{_mandir}/man8/blkdeactivate.8*
+%{_mandir}/man8/fsadm.8*
+%{_mandir}/man8/lv*.8*
+%{_mandir}/man8/pv*.8*
+%{_mandir}/man8/vg*.8*
+%attr(750,root,root) %dir %{_sysconfdir}/lvm
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
+%{_sysconfdir}/tmpfiles.d/lvm2.conf
+%{systemdunitdir}/lvm2-monitor.service
+%{systemdunitdir}/blk-availability.service
+%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
+%dir %attr(700,root,root) /var/run/lvm
+
+%if %{with cluster}
+%files clvmd
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_usrsbindir}/clvmd
+%attr(754,root,root) /etc/rc.d/init.d/clvmd
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clvmd
+%{systemdunitdir}/clvmd.service
+%{_mandir}/man8/clvmd.8*
+
+%files cmirrord
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_usrsbindir}/cmirrord
+%{_mandir}/man8/cmirrord.8*
+%attr(754,root,root) /etc/rc.d/init.d/cmirrord
+%endif
+
+%files -n device-mapper
+%defattr(644,root,root,755)
+%doc *_DM
+%{systemdunitdir}/dm-event.service
+%{systemdunitdir}/dm-event.socket
+/lib/udev/rules.d/10-dm.rules
+/lib/udev/rules.d/11-dm-lvm.rules
+/lib/udev/rules.d/13-dm-disk.rules
+/lib/udev/rules.d/95-dm-notify.rules
+%attr(755,root,root) %{_sbindir}/dmeventd
+%attr(755,root,root) %{_sbindir}/dmsetup
+%attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
+%attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
+%attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
+%dir %{_libdir}/device-mapper
+%attr(755,root,root) %{_libdir}/device-mapper/*.so
+%attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
+%{_mandir}/man8/dmsetup.8*
+%{_mandir}/man8/dmeventd.8*
+
+%files -n device-mapper-devel
+%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}/liblvm2app.so
+%attr(755,root,root) %{_libdir}/liblvm2cmd.so
+%{_includedir}/libdevmapper*.h
+%{_includedir}/lvm2app.h
+%{_includedir}/lvm2cmd.h
+%{_pkgconfigdir}/devmapper*.pc
+%{_pkgconfigdir}/lvm2app.pc
+
+%files -n device-mapper-static
+%defattr(644,root,root,755)
+%{_libdir}/libdevmapper*.a
+
+%if %{with initrd}
+%if %{with dietlibc}
+%files -n device-mapper-dietlibc
+%defattr(644,root,root,755)
+%{dietlibdir}/libdevmapper.a
+%endif
+
+%files -n device-mapper-initrd
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/initrd/dmsetup
+
+%files initrd
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/initrd/lvm
+%endif
--- /dev/null
+--- 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);
+
+ /*