Hello community,

here is the log from the commit of package lvm2.3640 for openSUSE:13.1:Update 
checked in at 2015-03-30 14:03:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/lvm2.3640 (Old)
 and      /work/SRC/openSUSE:13.1:Update/.lvm2.3640.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lvm2.3640"

Changes:
--------
New Changes file:

--- /dev/null   2015-03-12 01:14:30.992027505 +0100
+++ /work/SRC/openSUSE:13.1:Update/.lvm2.3640.new/lvm2.changes  2015-03-30 
14:03:27.000000000 +0200
@@ -0,0 +1,1193 @@
+-------------------------------------------------------------------
+Thu Mar 19 02:44:35 UTC 2015 - lw...@suse.com
+
+- RAID calculation for sufficient allocatable space (bsc#923021)
+  add: acdc731e-RAID-Fix-_sufficient_pes_free-calculation.patch 
+
+-------------------------------------------------------------------
+
+Thu Jan 22 07:59:05 UTC 2015 - lw...@suse.com
+
+- fix lvmetad: pvscan --cache aborts if no VG is defined for PV.(bsc#874396)
+  add: lvmetad-Fix-autoactivation-for-MDA-less-PVs.patch 
+
+-------------------------------------------------------------------
+Wed Jan 21 05:48:36 UTC 2015 - lw...@suse.com
+
+- fix sometimes lvm suffers a "token_mismatch", then gets stuck. (bsc#891736)
+  add: lvmetad_tokent_mismatch_retry.patch  
+
+-------------------------------------------------------------------
+Wed Jan 14 12:47:54 UTC 2015 - mplus...@suse.com
+
+- Change default locking type to 1 (bnc#901859)
+
+-------------------------------------------------------------------
+
+Tue Apr  8 08:23:40 UTC 2014 - lw...@suse.com
+
+- bnc#862403, modify lvm.conf by adding filter to exclude floppy and cdrom 
drives
+
+-------------------------------------------------------------------
+Thu Feb 20 16:01:23 UTC 2014 - arvidj...@gmail.com
+
+- add 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch
+  avoid connect to lvmetad.socket too early to prevent deadlock during
+  "systemctl daemon-reload" (bnc#862076)
+
+-------------------------------------------------------------------
+Thu Feb  6 16:23:37 UTC 2014 - arvidj...@gmail.com
+
+- add autoactivate-lvmetad-with-generator.patch - if use_lvmetad=1,
+  automatically activate lvm2-lvmetad.socket to ensure lvmetad is
+  started when required (bnc#862076)
+
+-------------------------------------------------------------------
+Mon Jan  6 07:43:59 UTC 2014 - dmzh...@suse.com
+
+- add csm_convert to lvm2-clvm package(bnc#854076)
+- system fails to boot due to missing /usr/sbin/lvm(bnc#837954)
+- lvm2 systemd incorrectly uses dependencies on Fedora services(bnc#851741)
+- set use_lvmetad = 1 as default of lvm.conf(bnc#854413)
+- drop patch dont_ignore_tmp_device_file.diff
+- backport patches from sle11 to support mirrored log in cluster
+- set default mirror to md_raid1 insdead of dm_mirror for better performance
+  
+-------------------------------------------------------------------
+Sun Oct 27 21:44:41 CET 2013 - oher...@suse.de
+
+- Remove /etc/sysconfig/lvm to avoid errors during mkinitrd run
+  LVM_VGS_ACTIVATED_ON_BOOT is not handled anymore with systemd
+- Remove fillup and insserv from PreReq
+
+-------------------------------------------------------------------
+Mon Oct 21 08:09:41 UTC 2013 - dmzh...@suse.com
+
+- bnc#779965, use export before %configure in spec
+
+-------------------------------------------------------------------
+Wed Sep 11 10:18:47 CEST 2013 - fcro...@suse.com
+
+- Add lvm-path.patch: fix lvm binary path in systemd generator.
+- Use %_tmpfilesdir macro for tmpfiles directory.
+
+-------------------------------------------------------------------
+Sun Sep  8 22:20:46 UTC 2013 - crrodrig...@opensuse.org
+
+- Set all "run" directories relative to /run not just the "lock"
+  location
+- Install /usr/lib/tmpfiles.d/lvm2.conf as required to ensure
+  such runtime directories are _always_ there.
+
+-------------------------------------------------------------------
+Wed Aug 28 11:15:54 UTC 2013 - meiss...@suse.com
+
+- replace BuildRequires: systemd by pkgconfig(udev) again
+  to avoid cycles.
+
+-------------------------------------------------------------------
+Tue Aug 20 07:59:06 UTC 2013 - dmzh...@suse.com
+
+- add systemd support to lvm2 package
+  split device-mapper to another package.
+
+-------------------------------------------------------------------
+Tue Jul 16 14:55:10 CEST 2013 - oher...@suse.de
+
+- Remove usage of absolute paths in mkinitrd scripts
+
+-------------------------------------------------------------------
+Tue Jul 16 14:39:31 CEST 2013 - oher...@suse.de
+
+- Fix parsing lvdisplay -c output with more than 10 volumes in 
+  mkinitrd-lvm2-setup.sh (bnc#826727)
+
+-------------------------------------------------------------------
+Mon Apr 22 14:01:29 UTC 2013 - cfarr...@suse.com
+
+- license update: GPL-2.0 and LGPL-2.1
+  Presence of multiple files (both GPL and LGPL) with "only" licenses
+
+-------------------------------------------------------------------
+Tue Apr 16 11:57:28 UTC 2013 - mmeis...@suse.com
+
+- Added url as source.
+  Please see http://en.opensuse.org/SourceUrls
+
+-------------------------------------------------------------------
+Fri Feb 15 11:44:36 UTC 2013 - rmila...@suse.com
+
+- Move all udev releated files in the appropriate udev directory.
+
+-------------------------------------------------------------------
+Wed Nov 28 09:37:23 UTC 2012 - rmila...@suse.com
+
+- udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch: 
+  cookie_set=1 on each dm_task_set_cookie call (bnc#788882)
+
+-------------------------------------------------------------------
+Mon Nov 12 10:41:45 UTC 2012 - seife+...@b1-systems.com
+
+- fix 10-dm.rules (bnc#789021)
+- port dmsetup export patch to new LVM code (bnc#789019,bnc#789020)
+
+-------------------------------------------------------------------
+Mon Nov  5 21:10:28 UTC 2012 - hrvoje.sen...@gmail.com
+
+- Now also fix devmapper-setup
+
+-------------------------------------------------------------------
+Mon Nov  5 12:08:26 UTC 2012 - hrvoje.sen...@gmail.com
+
+- Adapt mkinitrd scripts to new udev locataion
+
+-------------------------------------------------------------------
+Sun Nov  4 02:31:00 UTC 2012 - crrodrig...@opensuse.org
+
+- Fix booting ... place udev rules in the proper location..
+
+-------------------------------------------------------------------
+Thu Oct 18 12:35:30 UTC 2012 - hrvoje.sen...@gmail.com
+
+- Change the default locking dir to reflect the change in filesystem package
+
+-------------------------------------------------------------------
+Wed Oct 17 23:01:54 UTC 2012 - nfbr...@suse.com
+
+- lvm2.spec: merge rules for device-mapper and
+  lvm2-clvm packages, so there is only one
+  spec file and all packages are built consistently.
+
+-------------------------------------------------------------------
+Tue Oct 16 09:34:40 UTC 2012 - co...@suse.com
+
+- build against the minimal udev to avoid cycles
+- the sysvinit requires are no longer necessary
+
+-------------------------------------------------------------------
+Tue Oct 16 04:19:59 UTC 2012 - nfbr...@suse.com
+
+- Upgrade to LVM2-2-02-98.  Improvements include
+  improved interaction with udev and systemd,
+  improved dmraid support, and new command
+  "blkdeactivate".
+
+-------------------------------------------------------------------
+Thu Sep 27 01:11:17 UTC 2012 - nfbr...@suse.com
+
+- lvm2.spec: make sure MODPROBE_CMD is set properly
+  when configure is run.  Without it, modules are
+  not auto-loaded.  (bnc#779965)
+
+-------------------------------------------------------------------
+Fri Apr 20 07:52:09 UTC 2012 - rmila...@suse.com
+
+- Run update of initrd at %post and %postun.
+  We need this to make sure initrd reflects the updates. 
+
+-------------------------------------------------------------------
+Sun Sep 18 17:17:12 UTC 2011 - jeng...@medozas.de
+
+- Remove redundant tags/sections from specfile
+  (cf. packaging guidelines)
+- Use %_smp_mflags for parallel build
+
+-------------------------------------------------------------------
+Fri May 27 09:09:35 UTC 2011 - lnus...@suse.de
+
++++ 996 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.lvm2.3640.new/lvm2.changes

New:
----
  0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch
  LVM2.2.02.98.tgz
  LVM2.2.02.98.tgz.asc
  acdc731e-RAID-Fix-_sufficient_pes_free-calculation.patch
  autoactivate-lvmetad-with-generator.patch
  baselibs.conf
  cluster_support_mirrord_log.diff
  clvmd.ocf
  cmirrord.ocf
  csm-converter.tar.gz
  device-mapper-type_punning.diff
  handle_extended_devt.diff
  improve-mirror-legs-on-different-tag-pvs.patch
  improve_probing.diff
  lvm-path.patch
  lvm.conf
  lvm2.changes
  lvm2.spec
  lvmetad-Fix-autoactivation-for-MDA-less-PVs.patch
  lvmetad_tokent_mismatch_retry.patch
  make-mirror-legs-on-different-tag-pvs.patch
  make_raid1_default.diff
  man_page_sectors.diff
  mkinitrd-lvm2-boot.sh
  mkinitrd-lvm2-setup.sh
  no-inc-audit.diff
  no_buildroot_shared.diff
  pipe_buff-definition.diff
  remove-fedora-systemd.patch
  support-drbd-filter.diff
  suppress_locking_failer_message.patch
  sys_mount_instead_linux_fs.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lvm2.spec ++++++
#
# spec file for package lvm2
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Url:            http://www.sourceware.org/lvm2/

Name:           lvm2
BuildRequires:  device-mapper-devel
BuildRequires:  libcorosync-devel
BuildRequires:  libdlm-devel
BuildRequires:  libselinux-devel
BuildRequires:  libudev-devel
BuildRequires:  readline-devel
BuildRequires:  pkgconfig(udev)
Requires:       device-mapper >= 1.02.25
Provides:       lvm
PreReq:         /sbin/mkinitrd
Version:        2.02.98
Release:        0.<RELEASE11>
Summary:        Logical Volume Manager Tools
License:        GPL-2.0 and LGPL-2.1
Group:          System/Base
Source:         ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz
Source42:       ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz.asc
Source1:        lvm.conf
#Source2:        boot.lvm
Source4:        mkinitrd-lvm2-setup.sh
Source5:        mkinitrd-lvm2-boot.sh
#Source6:        64-lvm2.rules
#Source7:        collect_lvm
Source8:        clvmd.ocf
Source10:       cmirrord.ocf
#Source12:       mkinitrd-devmapper-setup.sh
#Source13:       mkinitrd-devmapper-boot.sh
Source14:       baselibs.conf
#Source15:       lvm2-activation.service
Source16:       csm-converter.tar.gz

Patch:          improve_probing.diff
Patch2:         no-inc-audit.diff
Patch3:         no_buildroot_shared.diff
Patch4:         sys_mount_instead_linux_fs.diff
Patch6:         man_page_sectors.diff

Patch13:        pipe_buff-definition.diff

Patch20:        support-drbd-filter.diff
Patch22:        handle_extended_devt.diff
Patch66:        device-mapper-type_punning.diff
Patch67:        lvm-path.patch

#fate312248,patch68,69
Patch68:        make-mirror-legs-on-different-tag-pvs.patch
Patch69:        improve-mirror-legs-on-different-tag-pvs.patch

#fate#314367
Patch70:        cluster_support_mirrord_log.diff

#upstream
Patch71:        make_raid1_default.diff
#suppress warning
Patch72:        suppress_locking_failer_message.patch
Patch73:        remove-fedora-systemd.patch

#bnc#862076
Patch74:        autoactivate-lvmetad-with-generator.patch
Patch75:        0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch
#upstream,bsc#891736
Patch76:        lvmetad_tokent_mismatch_retry.patch
#upstream,bsc#874396
Patch77:        lvmetad-Fix-autoactivation-for-MDA-less-PVs.patch
#upstream,bsc#923021
Patch78:        acdc731e-RAID-Fix-_sufficient_pes_free-calculation.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# Not a real replacement but we drop evms
Provides:       evms = 2.5.5
Provides:       evms-devel = 2.5.5
Provides:       evms-gui = 2.5.5
Provides:       evms-ha = 2.5.5
Obsoletes:      evms <= 2.5.5
Obsoletes:      evms-devel <= 2.5.5
Obsoletes:      evms-gui <= 2.5.5
Obsoletes:      evms-ha <= 2.5.5
%define _udevdir %(pkg-config --variable=udevdir udev)

%{systemd_requires}

%description
Programs and man pages for configuring and using the LVM2 Logical
Volume Manager.



%prep
%setup -q -n LVM2.%{version}
%patch -p1
%patch2
%patch3
%patch4
%patch6 -p1
%patch13 -p1
%patch20 -p1
%patch22 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1

%build
#set path so that thin_check can be found
#export before configure due to bnc#779965
export MODPROBE_CMD=/sbin/modprobe 
export CFLAGS="$RPM_OPT_FLAGS"
export PATH=$PATH:/sbin:/usr/sbin 
%configure --prefix=/ \
        --bindir=/bin --libdir=/%_lib --with-usrlibdir=%_libdir \
        --sbindir=/sbin --enable-dmeventd \
        --enable-udev_sync --enable-udev_rules \
        --enable-cmdlib --enable-applib --enable-dmeventd \
        --enable-realtime --enable-pkgconfig \
        --enable-selinux \
        --with-clvmd=corosync --with-cluster=internal --with-cluster=internal \
    --datarootdir=/usr/share --with-default-locking-dir=/run/lock/lvm \
        --enable-cmirrord --with-thin=internal --enable-lvmetad 
--with-default-pid-dir=/run \
    --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm 
--with-tmpfilesdir=%{_tmpfilesdir}
export SUSE_ASNEEDED=0
make -j1 # symlinks are generated in parallel! %{?_smp_mflags}

#csm convert
tar zxvf %{S:16}
pushd bnz
make
popd

%install
make install_lvm2 DESTDIR=$RPM_BUILD_ROOT
make install_system_dirs DESTDIR=$RPM_BUILD_ROOT
make install_systemd_units DESTDIR=$RPM_BUILD_ROOT
make install_systemd_generators DESTDIR=$RPM_BUILD_ROOT
make install_tmpfiles_configuration DESTDIR=$RPM_BUILD_ROOT
make -C liblvm install DESTDIR=$RPM_BUILD_ROOT
install -d -m 755 $RPM_BUILD_ROOT/etc/lvm
install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/backup
install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/archive
install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/metadata
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/lvm
mkdir -p $RPM_BUILD_ROOT/etc/init.d
#install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 755 %{SOURCE4} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-lvm2.sh
install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-lvm2.sh
install -m755 -D %{S:8} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/clvmd
install -m755 -D %{S:10} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/cmirrord

rm -f $RPM_BUILD_ROOT/%_libdir/libdevmapper-event-lvm2.so
ln -sf libdevmapper-event-lvm2.so.2.02 
$RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2.so
pushd $RPM_BUILD_ROOT/%_lib
rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2app.so
rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2cmd.so
ln -sf  liblvm2cmd.so.2.02 liblvm2cmd.so
ln -sf liblvm2app.so.2.2 liblvm2app.so 
ln -sf device-mapper/libdevmapper-event-lvm2mirror.so 
libdevmapper-event-lvm2mirror.so.2.02
ln -sf device-mapper/libdevmapper-event-lvm2snapshot.so 
libdevmapper-event-lvm2snapshot.so.2.02
ln -sf device-mapper/libdevmapper-event-lvm2raid.so 
libdevmapper-event-lvm2raid.so.2.02
ln -sf device-mapper/libdevmapper-event-lvm2thin.so 
libdevmapper-event-lvm2thin.so.2.02
popd
install -d $RPM_BUILD_ROOT/usr/sbin
pushd daemons/clvmd
make install DESTDIR=$RPM_BUILD_ROOT
popd
pushd daemons/cmirrord
make install DESTDIR=$RPM_BUILD_ROOT
popd
pushd man
make install DESTDIR=$RPM_BUILD_ROOT
popd
mv $RPM_BUILD_ROOT/sbin/clvmd $RPM_BUILD_ROOT/usr/sbin/clvmd
mv $RPM_BUILD_ROOT/sbin/cmirrord $RPM_BUILD_ROOT/usr/sbin/cmirrord
mkdir -p $RPM_BUILD_ROOT/usr/share
rm $RPM_BUILD_ROOT/etc/lvm/cache/.cache

#remove lvm-devel parts
rm -f $RPM_BUILD_ROOT/usr/include/lvm2cmd.h
rm -f $RPM_BUILD_ROOT/usr/include/lvm2app.h
rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/lvm2app.pc
#remove device-mapper man page
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/dm*
#remove device-mapper systemd events
rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.socket
rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.service
# install and collect_lvm
#install -m755 -D %{S:7} $RPM_BUILD_ROOT%{_udevdir}/collect_lvm

#csm-convert
pushd bnz
install -m755 -D csm-converter $RPM_BUILD_ROOT/usr/sbin/csm-converter
install -m755 -D csm-converter-helper 
$RPM_BUILD_ROOT/usr/sbin/csm-converter-helper
mv README.csm-converter ..
popd

%post
%service_add_post blk-availability.service lvm2-monitor.service
[ -x /sbin/mkinitrd ] && /sbin/mkinitrd
/sbin/ldconfig

%preun
%service_del_preun blk-availability.service lvm2-monitor.service

%postun
[ -x /sbin/mkinitrd ] && /sbin/mkinitrd
/sbin/ldconfig

%files
%defattr(-,root,root)
%doc README WHATS_NEW doc/*
%dir /etc/lvm
%dir /etc/lvm/backup
%dir /etc/lvm/archive
%dir /etc/lvm/metadata
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
%{_udevdir}/rules.d/11-dm-lvm.rules
%{_udevdir}/rules.d/69-dm-lvm-metad.rules
%{_unitdir}/blk-availability.service
%{_unitdir}/lvm2-monitor.service
%{_unitdir}/lvm2-lvmetad.socket
%{_unitdir}/lvm2-lvmetad.service
%{_tmpfilesdir}/lvm2.conf
%config /etc/lvm/lvm.conf
/lib/mkinitrd/scripts/setup-lvm2.sh
/lib/mkinitrd/scripts/boot-lvm2.sh
/usr/lib/systemd/system-generators/lvm2-activation-generator
/sbin/blkdeactivate
/sbin/fsadm
/sbin/lvchange
/sbin/lvconvert
/sbin/lvcreate
/sbin/lvdisplay
/sbin/lvextend
/sbin/lvm
/sbin/lvmchange
/sbin/lvmdiskscan
/sbin/lvmdump
/sbin/lvmsadc
/sbin/lvmsar
/sbin/lvreduce
/sbin/lvremove
/sbin/lvrename
/sbin/lvresize
/sbin/lvs
/sbin/lvscan
/sbin/pvchange
/sbin/pvck
/sbin/pvcreate
/sbin/pvdisplay
/sbin/pvmove
/sbin/pvremove
/sbin/pvresize
/sbin/pvs
/sbin/pvscan
/sbin/vgcfgbackup
/sbin/vgcfgrestore
/sbin/vgchange
/sbin/vgck
/sbin/vgconvert
/sbin/vgcreate
/sbin/vgdisplay
/sbin/vgexport
/sbin/vgextend
/sbin/vgimport
/sbin/vgimportclone
/sbin/vgmerge
/sbin/vgmknodes
/sbin/vgreduce
/sbin/vgremove
/sbin/vgrename
/sbin/vgs
/sbin/vgscan
/sbin/vgsplit
/sbin/lvmconf
/sbin/lvmetad
%dir /%_lib/device-mapper
/%_lib/device-mapper/libdevmapper-event-lvm2mirror.so
/%_lib/device-mapper/libdevmapper-event-lvm2snapshot.so
/%_lib/device-mapper/libdevmapper-event-lvm2raid.so
/%_lib/device-mapper/libdevmapper-event-lvm2thin.so
/%_lib/libdevmapper-event-lvm2mirror.so
/%_lib/libdevmapper-event-lvm2snapshot.so
/%_lib/libdevmapper-event-lvm2raid.so
/%_lib/libdevmapper-event-lvm2thin.so
/%_lib/liblvm2cmd.so
/%_lib/liblvm2cmd.so.2.02
/%_lib/liblvm2app.so
/%_lib/liblvm2app.so.2.2
/%_lib/libdevmapper-event-lvm2mirror.so.2.02
/%_lib/libdevmapper-event-lvm2snapshot.so.2.02
/%_lib/libdevmapper-event-lvm2raid.so.2.02
/%_lib/libdevmapper-event-lvm2thin.so.2.02
/%_lib/libdevmapper-event-lvm2.so
/%_lib/libdevmapper-event-lvm2.so.2.02
%{_mandir}/man5/lvm.conf.5.gz
%{_mandir}/man8/blkdeactivate.8.gz
%{_mandir}/man8/fsadm.8.gz
%{_mandir}/man8/lvchange.8.gz
%{_mandir}/man8/lvcreate.8.gz
%{_mandir}/man8/lvconvert.8.gz
%{_mandir}/man8/lvdisplay.8.gz
%{_mandir}/man8/lvmdump.8.gz
%{_mandir}/man8/lvextend.8.gz
%{_mandir}/man8/lvm.8.gz
%{_mandir}/man8/lvmchange.8.gz
%{_mandir}/man8/lvmdiskscan.8.gz
%{_mandir}/man8/lvreduce.8.gz
%{_mandir}/man8/lvremove.8.gz
%{_mandir}/man8/lvrename.8.gz
%{_mandir}/man8/lvresize.8.gz
%{_mandir}/man8/lvs.8.gz
%{_mandir}/man8/lvscan.8.gz
%{_mandir}/man8/pvchange.8.gz
%{_mandir}/man8/pvck.8.gz
%{_mandir}/man8/pvcreate.8.gz
%{_mandir}/man8/pvdisplay.8.gz
%{_mandir}/man8/pvmove.8.gz
%{_mandir}/man8/pvremove.8.gz
%{_mandir}/man8/pvresize.8.gz
%{_mandir}/man8/pvs.8.gz
%{_mandir}/man8/pvscan.8.gz
%{_mandir}/man8/vgcfgbackup.8.gz
%{_mandir}/man8/vgcfgrestore.8.gz
%{_mandir}/man8/vgchange.8.gz
%{_mandir}/man8/vgck.8.gz
%{_mandir}/man8/vgconvert.8.gz
%{_mandir}/man8/vgcreate.8.gz
%{_mandir}/man8/vgdisplay.8.gz
%{_mandir}/man8/vgexport.8.gz
%{_mandir}/man8/vgextend.8.gz
%{_mandir}/man8/vgimport.8.gz
%{_mandir}/man8/vgimportclone.8.gz
%{_mandir}/man8/vgmerge.8.gz
%{_mandir}/man8/vgmknodes.8.gz
%{_mandir}/man8/vgreduce.8.gz
%{_mandir}/man8/vgremove.8.gz
%{_mandir}/man8/vgrename.8.gz
%{_mandir}/man8/vgs.8.gz
%{_mandir}/man8/vgscan.8.gz
%{_mandir}/man8/vgsplit.8.gz
%{_mandir}/man8/lvmconf.8.gz
%{_mandir}/man8/lvmsadc.8.gz
%{_mandir}/man8/lvmsar.8.gz
%{_mandir}/man8/lvmetad.8.gz

%package clvm
Url:            http://sources.redhat.com/cluster/clvm/
Version:        2.02.98
Release:        0
Requires:       corosync
Requires:       device-mapper >= 1.02.25
Requires:       lvm2 = %{version}
Requires:       lvm2-cmirrord
Summary:        Clustered LVM2
Group:          Productivity/Clustering/HA

%description clvm
A daemon for using LVM2 Logival Volumes in a clustered environment.



%files clvm
%defattr(-,root,root)
/usr/sbin/clvmd
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/lvm2
/usr/lib/ocf/resource.d/lvm2/clvmd
%{_mandir}/man8/clvmd.8.gz
%doc README.csm-converter
/usr/sbin/csm-converter
/usr/sbin/csm-converter-helper

%package cmirrord
Url:            http://www.sourceware.org/lvm2/
Version:        2.02.98
Release:        0
Requires:       corosync
Requires:       device-mapper >= 1.02.25
Requires:       lvm2 = %{version}
Requires:       lvm2-clvm
Summary:        Clustered RAID 1 support using device-mapper and corosync
Group:          Productivity/Clustering/HA

%description cmirrord
A daemon for using LVM2 Logival Volumes in a clustered environment.



%files cmirrord
%defattr(-,root,root)
/usr/sbin/cmirrord
/usr/lib/ocf/resource.d/lvm2/cmirrord
%{_mandir}/man8/cmirrord.8.gz

%changelog
++++++ 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch ++++++
>From 983f0b46f2de85b8de0e2d7f8afbdf53f132a87a Mon Sep 17 00:00:00 2001
From: Petr Rockai <proc...@redhat.com>
Date: Mon, 29 Oct 2012 21:39:46 +0100
Subject: [PATCH] lvmetad: Init lazily, to avoid socket access on config
 overrides.

Signed-off-by: Andrey Borzenkov <arvidj...@gmail.com>
---
 lib/cache/lvmetad.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 6a374ac..72e07fd 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -33,7 +33,8 @@ static struct cmd_context *_lvmetad_cmd = NULL;
 
 void lvmetad_disconnect(void)
 {
-       daemon_close(_lvmetad);
+       if (_lvmetad_connected)
+               daemon_close(_lvmetad);
        _lvmetad_connected = 0;
        _lvmetad_cmd = NULL;
 }
@@ -41,19 +42,25 @@ void lvmetad_disconnect(void)
 void lvmetad_init(struct cmd_context *cmd)
 {
        if (!_lvmetad_use && !access(LVMETAD_PIDFILE, F_OK))
-               log_warn("WARNING: lvmetad is running but disabled. Restart 
lvmetad before enabling it!");
+               log_warn("WARNING: lvmetad is running but disabled."
+                        " Restart lvmetad before enabling it!");
+       _lvmetad_cmd = cmd;
+}
+
+static void _lvmetad_connect()
+{
        if (_lvmetad_use && _lvmetad_socket && !_lvmetad_connected) {
                assert(_lvmetad_socket);
                _lvmetad = lvmetad_open(_lvmetad_socket);
-               if (_lvmetad.socket_fd >= 0 && !_lvmetad.error) {
+               if (_lvmetad.socket_fd >= 0 && !_lvmetad.error)
                        _lvmetad_connected = 1;
-                       _lvmetad_cmd = cmd;
-               }
        }
 }
 
 void lvmetad_warning(void)
 {
+       if (!_lvmetad_connected)
+               _lvmetad_connect();
        if (_lvmetad_use && (_lvmetad.socket_fd < 0 || _lvmetad.error))
                log_warn("WARNING: Failed to connect to lvmetad: %s. Falling 
back to internal scanning.",
                         strerror(_lvmetad.error));
@@ -61,7 +68,11 @@ void lvmetad_warning(void)
 
 int lvmetad_active(void)
 {
-       return _lvmetad_use && _lvmetad_connected;
+       if (!_lvmetad_use)
+               return 0;
+       if (!_lvmetad_connected)
+               _lvmetad_connect();
+       return _lvmetad_connected;
 }
 
 void lvmetad_set_active(int active)
@@ -873,6 +884,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, 
activation_handler handler)
        char *future_token;
        int was_silent;
 
+       if (!lvmetad_active()) {
+               log_error("Cannot proceed since lvmetad is not active.");
+               return 0;
+       }
+
        if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) {
                log_error("dev_iter creation failed");
                return 0;
-- 
1.8.4.5

++++++ acdc731e-RAID-Fix-_sufficient_pes_free-calculation.patch ++++++
Index: LVM2.2.02.98/lib/metadata/lv_manip.c
===================================================================
--- LVM2.2.02.98.orig/lib/metadata/lv_manip.c
+++ LVM2.2.02.98/lib/metadata/lv_manip.c
@@ -926,7 +926,7 @@ static int _sufficient_pes_free(struct a
 {
        uint32_t area_extents_needed = (extents_still_needed - allocated) * 
ah->area_count / ah->area_multiple;
        uint32_t parity_extents_needed = (extents_still_needed - allocated) * 
ah->parity_count / ah->area_multiple;
-       uint32_t metadata_extents_needed = ah->metadata_area_count * 
RAID_METADATA_AREA_LEN; /* One each */
+       uint32_t metadata_extents_needed = (ah->alloc_and_split_meta) ? 0 : 
ah->metadata_area_count * RAID_METADATA_AREA_LEN; /* One each */
        uint32_t total_extents_needed = area_extents_needed + 
parity_extents_needed + metadata_extents_needed;
        uint32_t free_pes = pv_maps_size(pvms);
 
++++++ autoactivate-lvmetad-with-generator.patch ++++++
From: Andrey Borzenkov <arvidj...@gmail.com>
Subject: [PATCH] activate lvmetad in generator if use_lvmetad=1

This avoids unbootable system if user changes use_lvmetad but forgets
to enable lvmetad.

Ref: https://bugzilla.novell.com/show_bug.cgi?id=862076

Signed-off-by: Andrey Borzenkov <arvidj...@gmail.com>

---
 scripts/lvm2_activation_generator_systemd_red_hat.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
===================================================================
--- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -153,15 +153,15 @@ int main(int argc, char *argv[])
                r = EXIT_FAILURE; goto out;
        }
 
+       dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR;
+
        /* If lvmetad used, rely on autoactivation instead of direct 
activation. */
        if (lvm_uses_lvmetad()) {
                kmsg("LVM: Logical Volume autoactivation enabled.\n");
-               goto out;
-       }
-
-       dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR;
-
-       if (!generate_unit(dir, 1) || !generate_unit(dir, 0))
+               if (dm_snprintf(unit_path, PATH_MAX, "%s/%s", 
"/usr/lib/systemd/system", "lvm2-lvmetad.socket") < 0 ||
+                   !register_unit_with_target (dir, "lvm2-lvmetad.socket", 
"sockets.target"))
+                       r = EXIT_FAILURE;
+       } else if (!generate_unit(dir, 1) || !generate_unit(dir, 0))
                r = EXIT_FAILURE;
 out:
        kmsg("LVM: Activation generator %s.\n", r ? "failed" : "successfully 
completed");
++++++ baselibs.conf ++++++
device-mapper
device-mapper-devel
++++++ cluster_support_mirrord_log.diff ++++++
Index: LVM2.2.02.98/daemons/cmirrord/cluster.c
===================================================================
--- LVM2.2.02.98.orig/daemons/cmirrord/cluster.c
+++ LVM2.2.02.98/daemons/cmirrord/cluster.c
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <unistd.h>
+#include <pthread.h>
 #if CMIRROR_HAS_CHECKPOINT
 #include <openais/saAis.h>
 #include <openais/saCkpt.h>
@@ -118,9 +119,11 @@ struct clog_cpg {
        struct checkpoint_data *checkpoint_list;
        int idx;
        char debugging[DEBUGGING_HISTORY][128];
+       pthread_t thread_pid;
 };
 
 static struct dm_list clog_cpg_list;
+static pthread_rwlock_t clog_cpg_lock =PTHREAD_RWLOCK_INITIALIZER;
 
 /*
  * cluster_send
@@ -135,12 +138,14 @@ int cluster_send(struct clog_request *rq
        struct iovec iov;
        struct clog_cpg *entry;
 
+       pthread_rwlock_rdlock(&clog_cpg_lock);
        dm_list_iterate_items(entry, &clog_cpg_list)
                if (!strncmp(entry->name.value, rq->u_rq.uuid,
                             CPG_MAX_NAME_LENGTH)) {
                        found = 1;
                        break;
                }
+       pthread_rwlock_unlock(&clog_cpg_lock);
 
        if (!found) {
                rq->u_rq.error = -ENOENT;
@@ -221,11 +226,11 @@ static struct clog_request *get_matching
        return NULL;
 }
 
-static char rq_buffer[DM_ULOG_REQUEST_SIZE];
 static int handle_cluster_request(struct clog_cpg *entry 
__attribute__((unused)),
                                  struct clog_request *rq, int server)
 {
        int r = 0;
+       char rq_buffer[DM_ULOG_REQUEST_SIZE];
        struct clog_request *tmp = (struct clog_request *)rq_buffer;
 
        /*
@@ -332,9 +337,13 @@ static struct clog_cpg *find_clog_cpg(cp
 {
        struct clog_cpg *match;
 
+       pthread_rwlock_rdlock(&clog_cpg_lock);
        dm_list_iterate_items(match, &clog_cpg_list)
-               if (match->handle == handle)
+               if (match->handle == handle) {
+                       pthread_rwlock_unlock(&clog_cpg_lock);
                        return match;
+               }
+       pthread_rwlock_unlock(&clog_cpg_lock);
 
        return NULL;
 }
@@ -939,28 +948,17 @@ static int resend_requests(struct clog_c
        return r;
 }
 
-static int do_cluster_work(void *data __attribute__((unused)))
+static void cluster_thread_fn(void *data)
 {
        int r = CS_OK;
-       struct clog_cpg *entry, *tmp;
-
-       dm_list_iterate_items_safe(entry, tmp, &clog_cpg_list) {
-               r = cpg_dispatch(entry->handle, CS_DISPATCH_ALL);
-               if (r != CS_OK)
-                       LOG_ERROR("cpg_dispatch failed: %d", r);
-
-               if (entry->free_me) {
-                       free(entry);
-                       continue;
-               }
-               do_checkpoints(entry, 0);
-
-               resend_requests(entry);
-       }
+       struct clog_cpg * match = data;
+       r = cpg_dispatch (match->handle, CS_DISPATCH_BLOCKING);
+       if (r != CS_OK)
+               LOG_DBG("cpg_dispatch failed");
 
-       return (r == CS_OK) ? 0 : -1;  /* FIXME: good error number? */
 }
 
+
 static int flush_startup_list(struct clog_cpg *entry)
 {
        int r = 0;
@@ -1011,23 +1009,35 @@ static int flush_startup_list(struct clo
        return 0;
 }
 
+static void do_cpg_message_callback(struct clog_cpg * match , uint32_t nodeid, 
void *msg, size_t msg_len);
+
 static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name 
*gname __attribute__((unused)),
                                 uint32_t nodeid, uint32_t pid 
__attribute__((unused)),
                                 void *msg, size_t msg_len)
 {
+  struct clog_cpg * entry;
+
+       entry = find_clog_cpg(handle);
+       if (!entry) {
+               LOG_ERROR("Unable to find clog_cpg for cluster message");
+               return;
+       }
+       do_cpg_message_callback(entry, nodeid, msg, msg_len);
+
+       do_checkpoints(entry, 0);
+       resend_requests(entry);
+
+}
+
+static void do_cpg_message_callback(struct clog_cpg * match , uint32_t nodeid, 
void *msg, size_t msg_len)
+{
        int i;
        int r = 0;
        int i_am_server;
        int response = 0;
        struct clog_request *rq = msg;
        struct clog_request *tmp_rq;
-       struct clog_cpg *match;
 
-       match = find_clog_cpg(handle);
-       if (!match) {
-               LOG_ERROR("Unable to find clog_cpg for cluster message");
-               return;
-       }
 
        /*
         * Perform necessary endian and version compatibility conversions
@@ -1324,7 +1334,7 @@ static void cpg_leave_callback(struct cl
                               size_t member_list_entries)
 {
        unsigned i;
-       int j, fd;
+       int j;
        uint32_t lowest = match->lowest_id;
        struct clog_request *rq, *n;
        struct checkpoint_data *p_cp, *c_cp;
@@ -1335,10 +1345,9 @@ static void cpg_leave_callback(struct cl
        /* Am I leaving? */
        if (my_cluster_id == left->nodeid) {
                LOG_DBG("Finalizing leave...");
+               pthread_rwlock_wrlock(&clog_cpg_lock);
                dm_list_del(&match->list);
-
-               cpg_fd_get(match->handle, &fd);
-               links_unregister(fd);
+               pthread_rwlock_unlock(&clog_cpg_lock);
 
                cluster_postsuspend(match->name.value, match->luid);
 
@@ -1466,11 +1475,13 @@ static void cpg_config_callback(cpg_hand
        struct clog_cpg *match;
        int found = 0;
 
+       pthread_rwlock_rdlock(&clog_cpg_lock);
        dm_list_iterate_items(match, &clog_cpg_list)
                if (match->handle == handle) {
                        found = 1;
                        break;
                }
+       pthread_rwlock_unlock(&clog_cpg_lock);
 
        if (!found) {
                LOG_ERROR("Unable to find match for CPG config callback");
@@ -1487,6 +1498,16 @@ static void cpg_config_callback(cpg_hand
        else
                cpg_leave_callback(match, left_list,
                                   member_list, member_list_entries);
+
+
+       if (match->free_me) {
+               LOG_DBG("closing thread %x", (unsigned int)match->thread_pid);
+               free(match);
+               return;
+       }
+
+       do_checkpoints(match, 0);
+       resend_requests(match);
 }
 
 cpg_callbacks_t cpg_callbacks = {
@@ -1554,12 +1575,16 @@ int create_cluster_cpg(char *uuid, uint6
        size_t size;
        struct clog_cpg *new = NULL;
        struct clog_cpg *tmp;
+       pthread_t new_pid;
 
+       pthread_rwlock_rdlock(&clog_cpg_lock);
        dm_list_iterate_items(tmp, &clog_cpg_list)
                if (!strncmp(tmp->name.value, uuid, CPG_MAX_NAME_LENGTH)) {
                        LOG_ERROR("Log entry already exists: %s", uuid);
+                       pthread_rwlock_unlock(&clog_cpg_lock);
                        return -EEXIST;
                }
+       pthread_rwlock_unlock(&clog_cpg_lock);
 
        new = malloc(sizeof(*new));
        if (!new) {
@@ -1601,13 +1626,16 @@ int create_cluster_cpg(char *uuid, uint6
        }
 
        new->cpg_state = VALID;
+       pthread_rwlock_wrlock(&clog_cpg_lock);
        dm_list_add(&clog_cpg_list, &new->list);
+       pthread_rwlock_unlock(&clog_cpg_lock);
+
        LOG_DBG("New   handle: %llu", (unsigned long long)new->handle);
        LOG_DBG("New   name: %s", new->name.value);
 
-       /* FIXME: better variable */
-       cpg_fd_get(new->handle, &r);
-       links_register(r, "cluster", do_cluster_work, NULL);
+       pthread_create(&new_pid, NULL, (void *)cluster_thread_fn, (void*)new);
+       new->thread_pid = new_pid;
+       pthread_detach(new_pid);
 
        return 0;
 }
@@ -1676,9 +1704,11 @@ int destroy_cluster_cpg(char *uuid)
 {
        struct clog_cpg *del, *tmp;
 
+       pthread_rwlock_rdlock(&clog_cpg_lock);
        dm_list_iterate_items_safe(del, tmp, &clog_cpg_list)
                if (!strncmp(del->name.value, uuid, CPG_MAX_NAME_LENGTH))
                        _destroy_cluster_cpg(del);
+       pthread_rwlock_unlock(&clog_cpg_lock);
 
        return 0;
 }
Index: LVM2.2.02.98/daemons/cmirrord/functions.c
===================================================================
--- LVM2.2.02.98.orig/daemons/cmirrord/functions.c
+++ LVM2.2.02.98/daemons/cmirrord/functions.c
@@ -19,6 +19,7 @@
 #include <sys/stat.h>
 #include <time.h>
 #include <unistd.h>
+#include <pthread.h>
 
 #define BYTE_SHIFT 3
 
@@ -105,6 +106,9 @@ struct recovery_request {
 static DM_LIST_INIT(log_list);
 static DM_LIST_INIT(log_pending_list);
 
+static pthread_rwlock_t log_list_lock = PTHREAD_RWLOCK_INITIALIZER;
+static pthread_rwlock_t log_pending_lock = PTHREAD_RWLOCK_INITIALIZER;
+
 static int log_test_bit(dm_bitset_t bs, int bit)
 {
        return dm_bit(bs, bit) ? 1 : 0;
@@ -151,11 +155,15 @@ static struct log_c *get_log(const char
 {
        struct log_c *lc;
 
+       pthread_rwlock_rdlock(&log_list_lock);
        dm_list_iterate_items(lc, &log_list)
                if (!strcmp(lc->uuid, uuid) &&
-                   (!luid || (luid == lc->luid)))
+                   (!luid || (luid == lc->luid))) {
+                       pthread_rwlock_unlock(&log_list_lock);
                        return lc;
+               }
 
+       pthread_rwlock_unlock(&log_list_lock);
        return NULL;
 }
 
@@ -171,10 +179,14 @@ static struct log_c *get_pending_log(con
 {
        struct log_c *lc;
 
+       pthread_rwlock_rdlock(&log_pending_lock);
        dm_list_iterate_items(lc, &log_pending_list)
                if (!strcmp(lc->uuid, uuid) &&
-                   (!luid || (luid == lc->luid)))
+                   (!luid || (luid == lc->luid))) {
+                       pthread_rwlock_unlock(&log_pending_lock);
                        return lc;
+               }
+       pthread_rwlock_unlock(&log_pending_lock);
 
        return NULL;
 }
@@ -517,7 +529,9 @@ static int _clog_ctr(char *uuid, uint64_
                LOG_DBG("Disk log ready");
        }
 
+       pthread_rwlock_wrlock(&log_pending_lock);
        dm_list_add(&log_pending_list, &lc->list);
+       pthread_rwlock_unlock(&log_pending_lock);
 
        return 0;
 fail:
@@ -641,7 +655,10 @@ static int clog_dtr(struct dm_ulog_reque
 
        LOG_DBG("[%s] Cluster log removed", SHORT_UUID(lc->uuid));
 
+       pthread_rwlock_wrlock(&log_list_lock);
        dm_list_del(&lc->list);
+       pthread_rwlock_unlock(&log_list_lock);
+
        if (lc->disk_fd != -1 && close(lc->disk_fd))
                LOG_ERROR("Failed to close disk log: %s",
                          strerror(errno));
@@ -713,8 +730,13 @@ int cluster_postsuspend(char *uuid, uint
        lc->resume_override = 0;
 
        /* move log to pending list */
+       pthread_rwlock_wrlock(&log_list_lock);
        dm_list_del(&lc->list);
+       pthread_rwlock_unlock(&log_list_lock);
+
+       pthread_rwlock_wrlock(&log_pending_lock);
        dm_list_add(&log_pending_list, &lc->list);
+       pthread_rwlock_unlock(&log_pending_lock);
 
        return 0;
 }
@@ -818,9 +840,9 @@ no_disk:
        if (commit_log && (lc->disk_fd >= 0)) {
                rq->error = write_log(lc);
                if (rq->error)
-                       LOG_ERROR("Failed initial disk log write");
+                       LOG_ERROR("[%s] Failed initial disk log write", 
SHORT_UUID(lc->uuid));
                else
-                       LOG_DBG("Disk log initialized");
+                       LOG_DBG("[%s] Disk log initialized", 
SHORT_UUID(lc->uuid));
                lc->touched = 0;
        }
 out:
@@ -902,8 +924,13 @@ int local_resume(struct dm_ulog_request
                }
 
                /* move log to official list */
+               pthread_rwlock_wrlock(&log_pending_lock);
                dm_list_del(&lc->list);
+               pthread_rwlock_unlock(&log_pending_lock);
+
+               pthread_rwlock_wrlock(&log_list_lock);
                dm_list_add(&log_list, &lc->list);
+               pthread_rwlock_unlock(&log_list_lock);
        }
 
        return 0;
@@ -1910,7 +1937,6 @@ void log_debug(void)
 
        LOG_ERROR("");
        LOG_ERROR("LOG COMPONENT DEBUGGING::");
-       LOG_ERROR("Official log list:");
        LOG_ERROR("Pending log list:");
        dm_list_iterate_items(lc, &log_pending_list) {
                LOG_ERROR("%s", lc->uuid);
@@ -1920,6 +1946,7 @@ void log_debug(void)
                print_bits(lc->clean_bits, 1);
        }
 
+       LOG_ERROR("Official log list:");
        dm_list_iterate_items(lc, &log_list) {
                LOG_ERROR("%s", lc->uuid);
                LOG_ERROR("  recoverer        : %" PRIu32, lc->recoverer);
Index: LVM2.2.02.98/daemons/cmirrord/local.c
===================================================================
--- LVM2.2.02.98.orig/daemons/cmirrord/local.c
+++ LVM2.2.02.98/daemons/cmirrord/local.c
@@ -29,13 +29,13 @@
 
 static int cn_fd = -1;  /* Connector (netlink) socket fd */
 static char recv_buf[2048];
-static char send_buf[2048];
 
 
 /* FIXME: merge this function with kernel_send_helper */
 static int kernel_ack(uint32_t seq, int error)
 {
        int r;
+       char send_buf[2048];
        struct nlmsghdr *nlh = (struct nlmsghdr *)send_buf;
        struct cn_msg *msg = NLMSG_DATA(nlh);
 
@@ -179,6 +179,7 @@ static int kernel_send_helper(void *data
        int r;
        struct nlmsghdr *nlh;
        struct cn_msg *msg;
+       char send_buf[2048];
 
        memset(send_buf, 0, sizeof(send_buf));
 
Index: LVM2.2.02.98/lib/metadata/mirror.c
===================================================================
--- LVM2.2.02.98.orig/lib/metadata/mirror.c
+++ LVM2.2.02.98/lib/metadata/mirror.c
@@ -1909,10 +1909,6 @@ int add_mirror_log(struct cmd_context *c
        unsigned old_log_count;
        int r = 0;
 
-       if (vg_is_clustered(lv->vg) && (log_count > 1)) {
-               log_error("Log type, \"mirrored\", is unavailable to cluster 
mirrors");
-               return 0;
-       }
 
        if (dm_list_size(&lv->segments) != 1) {
                log_error("Multiple-segment mirror is not supported");
@@ -2076,25 +2072,6 @@ int lv_add_mirrors(struct cmd_context *c
                return 0;
        }
 
-       if (vg_is_clustered(lv->vg)) {
-               /* FIXME: review check of lv_is_active_remotely */
-               /* FIXME: move this test out of this function */
-               /* Skip test for pvmove mirrors, it can use local mirror */
-               if (!(lv->status & (PVMOVE | LOCKED)) &&
-                   !_cluster_mirror_is_available(lv)) {
-                       log_error("Shared cluster mirrors are not available.");
-                       return 0;
-               }
-
-               /*
-                * No mirrored logs for cluster mirrors until
-                * log daemon is multi-threaded.
-                */
-               if (log_count > 1) {
-                       log_error("Log type, \"mirrored\", is unavailable to 
cluster mirrors");
-                       return 0;
-               }
-       }
 
        /* For corelog mirror, activation code depends on
         * the global mirror_in_sync status. As we are adding
Index: LVM2.2.02.98/lib/mirror/mirrored.c
===================================================================
--- LVM2.2.02.98.orig/lib/mirror/mirrored.c
+++ LVM2.2.02.98/lib/mirror/mirrored.c
@@ -366,12 +366,15 @@ static int _add_log(struct dm_pool *mem,
                        return 0;
                }
        } else {
-               /* If core log, use mirror's UUID and set DM_CORELOG flag */
+               /* If core log, use mirror's (UUID + CORE) and set DM_CORELOG 
flag */
                if (!(log_dlid = build_dm_uuid(mem, seg->lv->lvid.s, NULL))) {
                        log_error("Failed to build uuid for mirror LV %s.",
                                  seg->lv->name);
                        return 0;
                }
+               if (clustered)
+                       memcpy(&(log_dlid[strlen(log_dlid)-4]),"CORE",4);
+
                log_flags |= DM_CORELOG;
        }
 
Index: LVM2.2.02.98/tools/lvconvert.c
===================================================================
--- LVM2.2.02.98.orig/tools/lvconvert.c
+++ LVM2.2.02.98/tools/lvconvert.c
@@ -1115,15 +1115,6 @@ static int _lvconvert_mirrors_parse_para
                return 0;
        }
 
-       /*
-        * No mirrored logs for cluster mirrors until
-        * log daemon is multi-threaded.
-        */
-       if ((*new_log_count == 2) && vg_is_clustered(lv->vg)) {
-               log_error("Log type, \"mirrored\", is unavailable to cluster 
mirrors");
-               return 0;
-       }
-
        log_verbose("Setting logging type to %s", mirrorlog);
 
        /*
Index: LVM2.2.02.98/daemons/cmirrord/Makefile.in
===================================================================
--- LVM2.2.02.98.orig/daemons/cmirrord/Makefile.in
+++ LVM2.2.02.98/daemons/cmirrord/Makefile.in
@@ -26,7 +26,7 @@ TARGETS = cmirrord
 
 include $(top_builddir)/make.tmpl
 
-LIBS += -ldevmapper
+LIBS += -ldevmapper -lpthread
 LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS)
 CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS)
 
++++++ clvmd.ocf ++++++
#!/bin/bash
# Copyright (c) 2008 Xinwei Hu
#                    All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
#
#######################################################################

# OCF initialization
. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs

# Parameter defaults
: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
: ${OCF_RESKEY_daemon_timeout:="80"}
: ${OCF_RESKEY_daemon_options:="-d2"}

# Common variables
DAEMON="/usr/sbin/clvmd"
CMIRRORD="/usr/sbin/cmirrord"

status_daemons()
{
    PID=`pidofproc "$DAEMON"`
        NPID=`pidofproc "$CMIRRORD"`
    if [ -n "$PID" -a -n "$NPID" ]; then
        return $OCF_SUCCESS
    fi
    return $OCF_NOT_RUNNING
}

status_clvmd()
{
    PID=`pidofproc "$DAEMON"`
    if [ -n "$PID" ]; then
        return $OCF_SUCCESS
    fi
    return $OCF_NOT_RUNNING
}

status_cmirrord()
{
    PID=`pidofproc "$CMIRRORD"`
    if [ -n "$PID" ]; then
        return $OCF_SUCCESS
    fi
    return $OCF_NOT_RUNNING
}

bringup_clvmd()
{
    if [ ! -e "$DAEMON" ]; then
        ocf_log err "Required binary not found: $DAEMON"
        return $OCF_ERR_INSTALLED
    fi

    start_daemon "$DAEMON" "$OCF_RESKEY_daemon_options"; rc=$?
    if [ $rc != 0 ]; then
        ocf_log err "Could not start $DAEMON"
        return $OCF_ERR_GENERIC
    fi

    sleep 1
    COUNT=0
    rc=$OCF_NOT_RUNNING

    while [ $rc = $OCF_NOT_RUNNING ]; do
        COUNT=`expr $COUNT + 1`
        if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
            ocf_log err "`basename $DAEMON` did not come up"
            return $OCF_ERR_GENERIC
        fi
        status_clvmd; rc=$?
        sleep 1
    done

    return $rc
}

bringup_cmirrord()
{
    if [ ! -e "$CMIRRORD" ]; then
        ocf_log err "Required binary not found: $DAEMON"
        return $OCF_ERR_INSTALLED
    fi

    start_daemon "$CMIRRORD" "$OCF_RESKEY_daemon_options"; rc=$?
    if [ $rc != 0 ]; then
        ocf_log err "Could not start $CMIRRORD"
        return $OCF_ERR_GENERIC
    fi

    sleep 1
    COUNT=0
    rc=$OCF_NOT_RUNNING

    while [ $rc = $OCF_NOT_RUNNING ]; do
        COUNT=`expr $COUNT + 1`
        if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
            ocf_log err "`basename $DAEMON` did not come up"
            return $OCF_ERR_GENERIC
        fi
        status_cmirrord; rc=$?
        sleep 1
    done

    return $rc
}


kill_clvmd()
{
    status_clvmd; rc=$?
    if [ $rc != $OCF_SUCCESS ]; then
        return rc
    fi

    ocf_log info "Stopping `basename "$DAEMON"`"
    killproc -INT "$DAEMON"

    sleep 1
    status_daemons; rc=$?
    
    COUNT=0
    while [ $rc = $OCF_SUCCESS ]; do
        COUNT=`expr $COUNT + 1`
        if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
                ocf_log err "`basename $DAEMON` shutdown emergency"
            killproc -9 "$DAEMON"
                        status_clvmd; rc=$?
                        if [ $rc = $OCF_NOT_RUNNING ]; then
                                return $OCF_SUCCESS
                        else
                                return $OCF_ERR_GENERIC
                        fi
        fi
                killproc -INT "$DAEMON"
        sleep 1
                status_clvmd; rc=$?
    done

    return $OCF_SUCCESS
}

kill_cmirrord()
{
    status_cmirrord; rc=$?
    if [ $rc != $OCF_SUCCESS ]; then
        return rc
    fi

    ocf_log info "Stopping `basename "$CMIRRORD"`"
    killproc -INT "$CMIRRORD"

    sleep 1
    status_cmirrord; rc=$?
    
    COUNT=0
    while [ $rc = $OCF_SUCCESS ]; do
        COUNT=`expr $COUNT + 1`
        if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
                ocf_log err "`basename $CMIRRORD` shutdown emergency"
            killproc -9 "$CMIRRORD"
                        status_cmirrord; rc=$?
                        if [ $rc = $OCF_NOT_RUNNING ]; then
                                return $OCF_SUCCESS
                        else
                                return $OCF_ERR_GENERIC
                        fi
        fi
                killproc -INT "$CMIRRORD"
        sleep 1
                status_cmirrord; rc=$?
    done

    return $OCF_SUCCESS
}


clvmd_start() 
{
        clvmd_validate
        ocf_log info "Starting $OCF_RESOURCE_INSTANCE"

        status_clvmd; rc=$?
    if [ $rc == $OCF_NOT_RUNNING ]; then 
      bringup_clvmd; rc=$?
          if [ $rc != $OCF_SUCCESS ]; then
                  return $OCF_ERR_GENERIC
          fi
        fi

        status_cmirrord; rc=$?
    if [ $rc == $OCF_NOT_RUNNING ]; then 
      bringup_cmirrord; rc=$?
          if [ $rc != $OCF_SUCCESS ]; then
                  kill_clvmd
                  return $OCF_ERR_GENERIC
          fi
        fi

    return $OCF_SUCCESS
}

clvmd_stop() {
        clvmd_validate
    ocf_log info "Stopping $OCF_RESOURCE_INSTANCE"

        status_clvmd; rc=$?
        if [ $rc != $OCF_NOT_RUNNING ]; then
                kill_clvmd; krc=$?
                if [ $krc != $OCF_SUCCESS ]; then
                        ocf_log err "Failed to stop clvmd"
                        return $OCF_ERR_GENERIC
                fi
        fi

        status_cmirrord; rc=$?
        if [ $rc != $OCF_NOT_RUNNING ]; then
                kill_cmirrord; krc=$?
                if [ $krc != $OCF_SUCCESS ]; then
                        ocf_log err "Failed to stop cmirrord"
                        return $OCF_ERR_GENERIC
                fi
        fi

        return $OCF_SUCCESS
}

clvmd_monitor() {
    clvmd_validate

    status_daemons
    return $?
}

clvmd_usage() {
    echo "usage: $0 {start|stop|monitor|validate-all|meta-data}"
    echo "  Expects to have a fully populated OCF RA-compliant environment set."
    echo "  In particualr, a value for OCF_ROOT"
}

clvmd_validate() {
    : TODO: check for globally_unique=true and return OCF_ERR_CONFIGURED
    case ${OCF_RESKEY_CRM_meta_globally_unique} in
        yes|Yes|true|True|1) 
            ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the 
globally_unique=false meta attribute"
            exit $OCF_ERR_CONFIGURED
            ;;
    esac

    return $OCF_SUCCESS
}

meta_data() {
        cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="clvmd">
  <version>1.0</version>
  <longdesc lang="en">
This is a Resource Agent for both clvmd and cmirrord.
It starts clvmd and cmirrord as anonymous clones.
  </longdesc>
  <shortdesc lang="en">clvmd resource agent</shortdesc>
  <parameters>

    <parameter name="daemon_timeout" unique="0">
      <longdesc lang="en">
Number of seconds to allow the control daemon to come up and down
      </longdesc>
      <shortdesc lang="en">Daemon Timeout</shortdesc>
      <content type="string" default="80"/>
    </parameter>

    <parameter name="daemon_options" unique="0">
      <longdesc lang="en">
Options to clvmd. Refer to clvmd.8 for detailed descriptions.
      </longdesc>
      <shortdesc lang="en">Daemon Options</shortdesc>
      <content type="string" default="-d2"/>
    </parameter>


  </parameters>
  <actions>
    <action name="start"         timeout="90" />
    <action name="stop"          timeout="100" />
    <action name="monitor"       timeout="20" depth="0"/>
    <action name="meta-data"     timeout="5" />
    <action name="validate-all"  timeout="30" />
  </actions>
</resource-agent>
END
}

case $__OCF_ACTION in
meta-data)      meta_data
                exit $OCF_SUCCESS
                ;;
start)          clvmd_start
                ;;
stop)           clvmd_stop
                ;;
monitor)        clvmd_monitor
                ;;
validate-all)   clvmd_validate
                ;;
usage|help)     clvmd_usage
                exit $OCF_SUCCESS
                ;;
*)              clvmd_usage
                exit $OCF_ERR_UNIMPLEMENTED
                ;;
esac

exit $?
++++++ cmirrord.ocf ++++++
#!/bin/bash
# Copyright (c) 2008 Xinwei Hu
#                    All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
#
#######################################################################

# OCF initialization
. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs

# Parameter defaults
: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
: ${OCF_RESKEY_daemon_timeout:="80"}
: ${OCF_RESKEY_daemon_options:="-d0"}

# Common variables
DAEMON="/usr/sbin/cmirrord"

status_daemon()
{
    PID=`pidofproc "$DAEMON"`
    if [ -n "$PID" ]; then
        return $OCF_SUCCESS
    fi
    return $OCF_NOT_RUNNING
}

bringup_daemon()
{
    if [ ! -e "$DAEMON" ]; then
        ocf_log err "Required binary not found: $DAEMON"
        return $OCF_ERR_INSTALLED
    fi

    start_daemon "$DAEMON" "$OCF_RESKEY_daemon_options"; rc=$?
    if [ $rc != 0 ]; then
        ocf_log err "Could not start $DAEMON"
        return $OCF_ERR_GENERIC
    fi

    sleep 1
    COUNT=0
    rc=$OCF_NOT_RUNNING

    while [ $rc = $OCF_NOT_RUNNING ]; do
        COUNT=`expr $COUNT + 1`
        if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
            ocf_log err "`basename $DAEMON` did not come up"
            return $OCF_ERR_GENERIC
        fi
        status_daemon; rc=$?
        sleep 1
    done

    return $rc
}

kill_daemon()
{
    status_daemon; rc=$?
    if [ $rc != $OCF_SUCCESS ]; then
        return rc
    fi

    ocf_log info "Stopping `basename "$DAEMON"`"
    killproc -INT "$DAEMON"

    sleep 1
    status_daemon; rc=$?
    
    COUNT=0
    while [ $rc = $OCF_SUCCESS ]; do
        COUNT=`expr $COUNT + 1`
        if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
                ocf_log err "`basename $DAEMON` shutdown emergency"
            killproc -9 "$DAEMON"
                        status_daemon; rc=$?
                        if [ $rc = $OCF_NOT_RUNNING ]; then
                                return $OCF_SUCCESS
                        else
                                return $OCF_ERR_GENERIC
                        fi
        fi
                killproc -INT "$DAEMON"
        sleep 1
                status_daemon; rc=$?
    done

    return $OCF_SUCCESS
}

cmirrord_start() {

    cmirrord_monitor; rc=$?
    if [ $rc != $OCF_NOT_RUNNING ]; then 
        return $rc
    fi

    ocf_log info "Starting $OCF_RESOURCE_INSTANCE"

    bringup_daemon
    return $?
}

cmirrord_stop() {
    cmirrord_monitor; rc=$?
    case $rc in
        $OCF_NOT_RUNNING) return $OCF_SUCCESS;;
    esac

    ocf_log info "Stopping $OCF_RESOURCE_INSTANCE"

    kill_daemon
}

cmirrord_monitor() {
    cmirrord_validate

    status_daemon
    return $?
}

cmirrord_usage() {
    echo "usage: $0 {start|stop|monitor|validate-all|meta-data}"
    echo "  Expects to have a fully populated OCF RA-compliant environment set."
    echo "  In particualr, a value for OCF_ROOT"
}

cmirrord_validate() {
    : TODO: check for globally_unique=true and return OCF_ERR_CONFIGURED
    case ${OCF_RESKEY_CRM_meta_globally_unique} in
        yes|Yes|true|True|1) 
            ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the 
globally_unique=false meta attribute"
            exit $OCF_ERR_CONFIGURED
            ;;
    esac

    return $OCF_SUCCESS
}

meta_data() {
        cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="cmirrord">
  <version>1.0</version>
  <longdesc lang="en">
This is a cmirrord Resource Agent.
It starts cmirrord as anonymous clones.
  </longdesc>
  <shortdesc lang="en">cmirrord resource agent</shortdesc>
  <parameters>

    <parameter name="daemon_timeout" unique="0">
      <longdesc lang="en">
Number of seconds to allow the control daemon to come up and down
      </longdesc>
      <shortdesc lang="en">Daemon Timeout</shortdesc>
      <content type="string" default="80"/>
    </parameter>

    <parameter name="daemon_options" unique="0">
      <longdesc lang="en">
Options to cmirrord. Cmirrord actually doesn't accept any options
for now.
      </longdesc>
      <shortdesc lang="en">Daemon Options</shortdesc>
      <content type="string" default=""/>
    </parameter>


  </parameters>
  <actions>
    <action name="start"         timeout="90" />
    <action name="stop"          timeout="100" />
    <action name="monitor"       timeout="20" depth="0"/>
    <action name="meta-data"     timeout="5" />
    <action name="validate-all"  timeout="30" />
  </actions>
</resource-agent>
END
}

case $__OCF_ACTION in
meta-data)      meta_data
                exit $OCF_SUCCESS
                ;;
start)          cmirrord_start
                ;;
stop)           cmirrord_stop
                ;;
monitor)        cmirrord_monitor
                ;;
validate-all)   cmirrord_validate
                ;;
usage|help)     cmirrord_usage
                exit $OCF_SUCCESS
                ;;
*)              cmirrord_usage
                exit $OCF_ERR_UNIMPLEMENTED
                ;;
esac

exit $?
++++++ device-mapper-type_punning.diff ++++++
---
 lib/device/device.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- LVM2.2.02.98.orig/lib/device/device.c
+++ LVM2.2.02.98/lib/device/device.c
@@ -39,7 +39,7 @@ struct partition {
        uint8_t end_cyl;
        uint32_t start_sect;
        uint32_t nr_sects;
-} __attribute__((packed));
+} __attribute__((packed,may_alias));
 
 static int _is_partitionable(struct device *dev)
 {
++++++ handle_extended_devt.diff ++++++
---
 lib/filters/filter.c |    4 ++++
 1 file changed, 4 insertions(+)

--- LVM2.2.02.98.orig/lib/filters/filter.c
+++ LVM2.2.02.98/lib/filters/filter.c
@@ -180,6 +180,10 @@ static int _scan_proc_dev(const char *pr
        /* All types unrecognised initially */
        memset(_partitions, 0, sizeof(_partitions));
 
+       /* Extended devt will use MAJOR 259
+          Consider it an non-partitionable block device */
+       _partitions[259].max_partitions = 1;
+
        if (dm_snprintf(proc_devices, sizeof(proc_devices),
                         "%s/devices", proc) < 0) {
                log_error("Failed to create /proc/devices string");
++++++ improve-mirror-legs-on-different-tag-pvs.patch ++++++
>From 69092b1179f4fbd0fae7e054665ad049dffd9966 Mon Sep 17 00:00:00 2001
From: Guangliang Zhao <gz...@suse.com>
Date: Wed, 5 Dec 2012 18:25:04 +0800
Subject: [PATCH 2/2] mirror: improve mirror legs on different tag pvs

This patch will find the biggest eligible area every time,
and add it to the parallel areas.

The previous just find the different tag pv area with all
found ones, if the new area's tag has appeared, just throw
it. The new will compare the length, and choose the longer
one.

Signed-off-by: Guangliang Zhao <gz...@suse.com>
---
 lib/metadata/lv_manip.c |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fb0199f..edafdf1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1658,6 +1658,21 @@ static uint32_t _calc_required_extents(struct 
alloc_handle *ah, struct pv_area *
        return required;
 }
 
+static void _replace_required_area(struct alloc_handle *ah, uint32_t 
max_to_allocate,
+                                  unsigned ix_pva, struct pv_area *pva,
+                                  struct alloc_state *alloc_state, 
alloc_policy_t alloc)
+{
+       uint32_t required = _calc_required_extents(ah, pva, ix_pva, 
max_to_allocate, alloc);
+
+       /*
+        * We don't worry about the area replaced, because _clear_areas() and
+        * _reset_unreserved() called by _find_some_parallel_space() will clear
+        * the alloc_state and reserved areas every time.
+        */
+       if (required > alloc_state->areas[ix_pva - 1].used)
+               _reserve_area(&alloc_state->areas[ix_pva - 1], pva, required, 
ix_pva, pva->unreserved);
+}
+
 static int _reserve_required_area(struct alloc_handle *ah, uint32_t 
max_to_allocate,
                                  unsigned ix_pva, struct pv_area *pva,
                                  struct alloc_state *alloc_state, 
alloc_policy_t alloc)
@@ -1767,6 +1782,7 @@ static int _find_some_parallel_space(struct alloc_handle 
*ah, const struct alloc
 {
        unsigned ix = 0;
        unsigned last_ix;
+       int ret;
        struct pv_map *pvm;
        struct pv_area *pva;
        unsigned preferred_count = 0;
@@ -1875,9 +1891,12 @@ static int _find_some_parallel_space(struct alloc_handle 
*ah, const struct alloc
                                        continue;
 
                                case USE_AREA:
-                                       if(check_areas_separate_tags(ah, 
alloc_state, ix_offset,
-                                                                    ix + 
ix_offset, pva) >= 0)
-                                               goto next_pv;
+                                       if((ret = check_areas_separate_tags(ah, 
alloc_state, ix_offset,
+                                                                           ix 
+ ix_offset, pva)) >= 0) {
+                                               _replace_required_area(ah, 
max_to_allocate, ret + 1,
+                                                                      pva, 
alloc_state, alloc_parms->alloc);
+                                               continue;
+                                       }
 
                                        /*
                                         * Except with ALLOC_ANYWHERE, replace 
first area with this
-- 
1.7.10.4

++++++ improve_probing.diff ++++++
---
 lib/filters/filter.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

--- LVM2.2.02.98.orig/lib/filters/filter.c
+++ LVM2.2.02.98/lib/filters/filter.c
@@ -13,6 +13,12 @@
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <sys/ioctl.h>
+#include <linux/fs.h>
+#undef MAJOR
+#undef MINOR
+#undef MKDEV
+
 #include "lib.h"
 #include "dev-cache.h"
 #include "filter.h"
@@ -111,11 +117,18 @@ static int _passes_lvm_type_device_filte
        }
 
        /* Check it's accessible */
-       if (!dev_open_readonly_quiet(dev)) {
+       if (!dev_open_flags(dev, O_RDONLY|O_NONBLOCK, 1, 1)) {
                log_debug("%s: Skipping: open failed", name);
                return 0;
        }
 
+       /* Skip cdrom device */
+       #define CDROM_GET_CAPABILITY   0x5331
+       if (ioctl(dev->fd, CDROM_GET_CAPABILITY) >= 0) {
+               log_debug("%s: Skipping: cdrom device", name );
+               goto out;
+       }
+
        /* Check it's not too small */
        if (!dev_get_size(dev, &size)) {
                log_debug("%s: Skipping: dev_get_size failed", name);
++++++ lvm-path.patch ++++++
Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
===================================================================
--- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -125,7 +125,7 @@ static int generate_unit(const char *dir
        fputs("Before=local-fs.target shutdown.target\n"
              "Wants=systemd-udev-settle.service\n\n"
              "[Service]\n"
-             "ExecStart=/usr/sbin/lvm vgchange -aay --sysinit\n"
+             "ExecStart=/sbin/lvm vgchange -aay --sysinit\n"
              "Type=oneshot\n", f);
 
        if (fclose(f) < 0) {
++++++ lvm.conf ++++++
++++ 875 lines (skipped)

++++++ lvmetad-Fix-autoactivation-for-MDA-less-PVs.patch ++++++
lvmetad: Fix autoactivation for MDA-less PVs.

Calling pvscan --cache with -aay on a PV without an MDA would spuriously fail
with an internal error, because of an incorrect assumption that a parsed VG
structure was always available. This is not true and the autoactivation handler
needs to call vg_read to obtain metadata in cases where the PV had no MDAs to
parse. Therefore, we pass vgid into the handler instead of the (possibly NULL)
VG coming from the PV's MDA.

Index: LVM2.2.02.98/lib/cache/lvmetad.c
===================================================================
--- LVM2.2.02.98.orig/lib/cache/lvmetad.c
+++ LVM2.2.02.98/lib/cache/lvmetad.c
@@ -701,7 +701,7 @@ int lvmetad_pv_found(const struct id *pv
        daemon_reply reply;
        struct lvmcache_info *info;
        struct dm_config_tree *pvmeta, *vgmeta;
-       const char *status;
+       const char *status, *vgid;
        int result;
 
        if (!lvmetad_active() || test_mode())
@@ -750,11 +750,6 @@ int lvmetad_pv_found(const struct id *pv
                                      NULL);
                dm_config_destroy(vgmeta);
        } else {
-               if (handler) {
-                       log_error(INTERNAL_ERROR "Handler needs existing VG.");
-                       dm_free(pvmeta);
-                       return 0;
-               }
                /* There are no MDAs on this PV. */
                reply = _lvmetad_send("pv_found", "pvmeta = %t", pvmeta, NULL);
        }
@@ -770,10 +765,11 @@ int lvmetad_pv_found(const struct id *pv
 
        if (result && handler) {
                status = daemon_reply_str(reply, "status", "<missing>");
+               vgid = daemon_reply_str(reply, "vgid", "<missing>");
                if (!strcmp(status, "partial"))
-                       handler(vg, 1, CHANGE_AAY);
+                       handler(_lvmetad_cmd, vgid, 1, CHANGE_AAY);
                else if (!strcmp(status, "complete"))
-                       handler(vg, 0, CHANGE_AAY);
+                       handler(_lvmetad_cmd, vgid, 0, CHANGE_AAY);
                else if (!strcmp(status, "orphan"))
                        ;
                else
Index: LVM2.2.02.98/lib/cache/lvmetad.h
===================================================================
--- LVM2.2.02.98.orig/lib/cache/lvmetad.h
+++ LVM2.2.02.98/lib/cache/lvmetad.h
@@ -22,7 +22,8 @@ struct cmd_context;
 struct dm_config_tree;
 enum activation_change;
 
-typedef int (*activation_handler) (struct volume_group *vg, int partial,
+typedef int (*activation_handler) (struct cmd_context *cmd,
+                                  const char *vgid, int partial,
                                   enum activation_change activate);
 
 #ifdef LVMETAD_SUPPORT
Index: LVM2.2.02.98/test/shell/lvmetad-pvscan-nomda.sh
===================================================================
--- /dev/null
+++ LVM2.2.02.98/test/shell/lvmetad-pvscan-nomda.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+. lib/test
+
+test -e LOCAL_LVMETAD || skip
+kill $(cat LOCAL_LVMETAD)
+rm LOCAL_LVMETAD
+
+aux prepare_devs 2
+
+pvcreate --metadatacopies 0 $dev1
+pvcreate --metadatacopies 1 $dev2
+vgcreate $vg1 $dev1 $dev2
+lvcreate -n foo -l 1 -an --zero n $vg1
+
+# start lvmetad but make sure it doesn't know about $dev1 or $dev2
+aux disable_dev $dev1
+aux disable_dev $dev2
+aux prepare_lvmetad
+lvs
+mv LOCAL_LVMETAD XXX
+aux enable_dev $dev2
+aux enable_dev $dev1
+mv XXX LOCAL_LVMETAD
+
+aux lvmconf 'global/use_lvmetad = 0'
+check inactive $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
+
+pvscan --cache $dev2 -aay
+
+aux lvmconf 'global/use_lvmetad = 0'
+check inactive $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
+
+pvscan --cache $dev1 -aay
+
+aux lvmconf 'global/use_lvmetad = 0'
+check active $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
Index: LVM2.2.02.98/tools/pvscan.c
===================================================================
--- LVM2.2.02.98.orig/tools/pvscan.c
+++ LVM2.2.02.98/tools/pvscan.c
@@ -91,18 +91,36 @@ static void _pvscan_display_single(struc
                                display_size(cmd, (uint64_t) (pv_pe_count(pv) - 
pv_pe_alloc_count(pv)) * pv_pe_size(pv)));
 }
 
-static int _auto_activation_handler(struct volume_group *vg, int partial,
+static int _auto_activation_handler(struct cmd_context *cmd,
+                                   const char *vgid, int partial,
                                    activation_change_t activate)
 {
+       struct volume_group *vg;
+       int consistent = 0;
+       struct id vgid_raw;
+
        /* TODO: add support for partial and clustered VGs */
-       if (partial || vg_is_clustered(vg))
+       if (partial)
                return 1;
 
+       id_read_format(&vgid_raw, vgid);
+       /* NB. This is safe because we know lvmetad is running and we won't hit
+        * disk. */
+       if (!(vg = vg_read_internal(cmd, NULL, &vgid_raw, 0, &consistent)))
+           return 1;
+
+       if (vg_is_clustered(vg)) {
+               release_vg(vg);
+               return 1;
+       }
+
        if (!vgchange_activate(vg->cmd, vg, activate)) {
                log_error("%s: autoactivation failed.", vg->name);
+               release_vg(vg);
                return 0;
        }
 
+       release_vg(vg);
        return 1;
 }
 
++++++ lvmetad_tokent_mismatch_retry.patch ++++++
Index: LVM2.2.02.98/lib/cache/lvmetad.c
===================================================================
--- LVM2.2.02.98.orig/lib/cache/lvmetad.c
+++ LVM2.2.02.98/lib/cache/lvmetad.c
@@ -23,6 +23,9 @@
 #include "assert.h"
 #include "crc.h"
 
+#define SCAN_TIMEOUT_SECONDS    80
+#define MAX_RESCANS            10 /* Maximum number of times to scan all PVs 
and retry if the daemon returns a token mismatch error */
+
 static daemon_handle _lvmetad;
 static int _lvmetad_use = 0;
 static int _lvmetad_connected = 0;
@@ -128,7 +131,10 @@ static daemon_reply _lvmetad_send(const
        va_list ap;
        daemon_reply repl;
        daemon_request req;
-       int try = 0;
+       unsigned num_rescans = 0;
+       unsigned total_usecs_waited = 0;
+       unsigned max_remaining_sleep_times = 1;
+       unsigned wait_usecs;
 
 retry:
        req = daemon_request_make(id);
@@ -144,15 +150,35 @@ retry:
 
        daemon_request_destroy(req);
 
+       /** If another process is trying to scan, it might have the
+        * same future token id and it's better to wait and avoid doing
+        * the work multiple times. For the case where the future token is
+        * different, the wait is randomized so that multiple waiting
+        * processes do not start scanning all at once.
+        *
+        * If the token is mismatched because of global_filter changes,
+        * we re-scan immediately, but if we lose the potential race for
+        * the update, we back off for a short while (0.05-0.5 seconds) and
+        * try again.
+        */
        if (!repl.error && !strcmp(daemon_reply_str(repl, "response", ""), 
"token_mismatch") &&
-           try < 2 && !test_mode()) {
-               if (lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL)) {
-                       ++ try;
-                       daemon_reply_destroy(repl);
-                       goto retry;
+           num_rescans < MAX_RESCANS && total_usecs_waited < 
(SCAN_TIMEOUT_SECONDS * 1000000) && !test_mode()) {
+               if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in 
progress") ||
+                   max_remaining_sleep_times) {
+                       wait_usecs = 50000 + 
lvm_even_rand(&_lvmetad_cmd->rand_seed, 450000); /* between 0.05s and 0.5s */
+                       (void) usleep(wait_usecs);
+                       total_usecs_waited += wait_usecs;
+                       if (max_remaining_sleep_times)
+                               max_remaining_sleep_times--;    /* Sleep once 
before rescanning the first time, then 5 times each time after that. */
+               } else {
+                       /* If the re-scan fails here, we try again later. */
+                       (void) lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
+                       num_rescans++;
+                       max_remaining_sleep_times = 5;
                }
+               daemon_reply_destroy(repl);
+               goto retry;
        }
-
        return repl;
 }
 
Index: LVM2.2.02.98/lib/misc/lvm-wrappers.c
===================================================================
--- LVM2.2.02.98.orig/lib/misc/lvm-wrappers.c
+++ LVM2.2.02.98/lib/misc/lvm-wrappers.c
@@ -117,3 +117,25 @@ int read_urandom(void *buf, size_t len)
        return 1;
 }
 
+/*
+ * Return random integer in [0,max) interval
+ *
+ * The loop rejects numbers that come from an "incomplete" slice of the
+ * RAND_MAX space.  Considering the number space [0, RAND_MAX] is divided
+ * into some "max"-sized slices and at most a single smaller slice,
+ * between [n*max, RAND_MAX] for suitable n, numbers from this last slice
+ * are discarded because they could distort the distribution in favour of
+ * smaller numbers.
+ */
+unsigned lvm_even_rand(unsigned *seed, unsigned max)
+{
+        unsigned r, ret;
+
+        do {
+                r = (unsigned) rand_r(seed);
+                ret = r % max;
+        } while (r - ret > RAND_MAX - max);
+
+        return ret;
+}
+
++++++ make-mirror-legs-on-different-tag-pvs.patch ++++++
>From 49a5da732c74b8b96bc123a541d590c4fd06d7af Mon Sep 17 00:00:00 2001
From: Guangliang Zhao <gz...@suse.com>
Date: Mon, 12 Nov 2012 15:28:11 +0800
Subject: [PATCH 1/2] mirror: make mirror legs on different tag pvs

The mirror legs could be placed on the PVs(with different
tags) from the other mirror legs with this patch.

The lvcreate allocates the replica "randomly" when creating
a mirrored logical volume now, so it could happen that both
copies end up on the same array (or on the same site), clearly
undesired.

We can't control the fist allocation, because didn't restrict
the areas into parallel space. This patch add the limit when
finding areas for parallel space, so that mirror legs will
always be placed on pvs with differnt tags.

Signed-off-by: Guangliang Zhao <gz...@suse.com>
---
 doc/example.conf.in     |   17 +++++++++++++++++
 lib/config/defaults.h   |    1 +
 lib/metadata/lv_manip.c |   37 +++++++++++++++++++++++++++++++++++++
 man/lvcreate.8.in       |    3 +++
 4 files changed, 58 insertions(+)

diff --git a/doc/example.conf.in b/doc/example.conf.in
index f7344bb..57e00d6 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -224,6 +224,23 @@ allocation {
     # algorithm.
     maximise_cling = 1
 
+    # Set to 1 to guarantee that mirror leg will always be placed on
+    # different PVs(with different tags) from the other mirror legs.
+    #
+    # If you want to enable this feature, the following conditions
+    # must be met:
+    # 1) The mirror_legs_require_separate_pvs must be set to 1, the
+    #    default value is 0.
+    # 2) The cling_tag_list must be activated.
+    # 3) The length of all pvs with same tag must greater than or equal
+    #    to the mirror's.
+
+    # This feature is only for the first allocation, on the other hand
+    # when creating new mirrored lvs.
+    # Please note that the commond may fail if the number of all tags
+    # on the pvs less than the mirror legs number.
+    mirror_legs_require_separate_pvs = 0
+
     # Set to 1 to guarantee that mirror logs will always be placed on 
     # different PVs from the mirror images.  This was the default
     # until version 2.02.85.
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 9730a2d..d08d004 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -98,6 +98,7 @@
 #define DEFAULT_MAX_LV 0
 #define DEFAULT_ALLOC_POLICY ALLOC_NORMAL
 #define DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS 0
+#define DEFAULT_MIRROR_LEGS_REQUIRE_SEPARATE_PVS 0
 #define DEFAULT_MAXIMISE_CLING 1
 #define DEFAULT_CLUSTERED 0
 
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9f87854..fb0199f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -684,6 +684,9 @@ struct alloc_handle {
 
        unsigned maximise_cling;
        unsigned mirror_logs_separate;  /* Force mirror logs on separate PVs? */
+       unsigned mirror_legs_separate;  /* Force mirror *legs* on separate PVs*/
+
+       const struct segment_type *segtype;
 
        /*
         * RAID devices require a metadata area that accompanies each
@@ -868,6 +871,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context 
*cmd,
        ah->parity_count = parity_count;
        ah->region_size = region_size;
        ah->alloc = alloc;
+       ah->segtype = segtype;
 
        /*
         * For the purposes of allocation, area_count and parity_count are
@@ -879,6 +883,8 @@ static struct alloc_handle *_alloc_init(struct cmd_context 
*cmd,
        ah->area_multiple = _calc_area_multiple(segtype, area_count + 
parity_count, stripes);
        ah->mirror_logs_separate = find_config_tree_bool(cmd, 
"allocation/mirror_logs_require_separate_pvs",
                                                         
DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS);
+       ah->mirror_legs_separate = find_config_tree_bool(cmd, 
"allocation/mirror_legs_require_separate_pvs",
+                                                        
DEFAULT_MIRROR_LEGS_REQUIRE_SEPARATE_PVS);
 
        if (segtype_is_raid(segtype)) {
                if (metadata_area_count) {
@@ -1725,6 +1731,33 @@ static void _report_needed_allocation_space(struct 
alloc_handle *ah,
        log_debug("  %" PRIu32 " %ss of %" PRIu32 " extents each",
                  metadata_count, metadata_type, metadata_size);
 }
+
+/*
+ * Return -1 if we don't need check tags, or there aren't any areas in 
alloc_status
+ * have the same tag with pva, the index otherwise.
+ */
+static int check_areas_separate_tags(struct alloc_handle *ah,
+                                    struct alloc_state *alloc_state,
+                                    unsigned ix_start,
+                                    unsigned ix_end,
+                                    struct pv_area *pva)
+{
+       int i;
+
+       if (!segtype_is_mirrored(ah->segtype) ||
+                       alloc_state->allocated ||
+                       !ah->mirror_legs_separate ||
+                       !ah->cling_tag_list_cn)
+               return -1;
+
+       for (i = ix_start; i < ix_end; i++)
+               if(_pvs_have_matching_tag(ah->cling_tag_list_cn,
+                                       alloc_state->areas[i].pva->map->pv,
+                                       pva->map->pv))
+                       return i;
+       return -1;
+}
+
 /*
  * Returns 1 regardless of whether any space was found, except on error.
  */
@@ -1842,6 +1875,10 @@ static int _find_some_parallel_space(struct alloc_handle 
*ah, const struct alloc
                                        continue;
 
                                case USE_AREA:
+                                       if(check_areas_separate_tags(ah, 
alloc_state, ix_offset,
+                                                                    ix + 
ix_offset, pva) >= 0)
+                                               goto next_pv;
+
                                        /*
                                         * Except with ALLOC_ANYWHERE, replace 
first area with this
                                         * one which is smaller but still big 
enough.
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index f374950..d7355b9 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -205,6 +205,9 @@ will create a persistent log that is itself mirrored.
 
 The optional argument --corelog is equivalent to --mirrorlog core.
 
+Every leg of the mirrored logical volume could be placed on the pvs with
+same tag, see details(mirror_legs_require_separate_pvs) in lvm.conf.
+
 .TP
 .IR \fB\-n ", " \fB\-\-name " " LogicalVolume { Name | Path }
 The name for the new logical volume.
-- 
1.7.10.4

++++++ make_raid1_default.diff ++++++
commit 7e1083c985fd130b240c2471643350cc5c0f05cf
Author: Jonathan Brassow <jbras...@redhat.com>
Date:   Tue Aug 6 14:13:55 2013 -0500

    RAID: Make "raid1" the default mirror segment type

diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 5af0f00..59282c5 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -51,7 +51,7 @@
 #define DEFAULT_METADATA_READ_ONLY 0
 #define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
 
-#define DEFAULT_MIRROR_SEGTYPE "mirror"
+#define DEFAULT_MIRROR_SEGTYPE "raid1"
 #define DEFAULT_MIRRORLOG "disk"
 #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
 #define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"
++++++ man_page_sectors.diff ++++++
---
 man/pvdisplay.8.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- LVM2.2.02.98.orig/man/pvdisplay.8.in
+++ LVM2.2.02.98/man/pvdisplay.8.in
@@ -64,7 +64,7 @@ The values are:
 
 * physical volume device name
 * volume group name
-* physical volume size in kilobytes
+* physical volume size in sectors
 * internal physical volume number (obsolete)
 * physical volume status
 * physical volume (not) allocatable
++++++ mkinitrd-lvm2-boot.sh ++++++
#!/bin/bash
#%stage: volumemanager
#%depends: evms
#%programs: vgscan vgchange lvm
#%programs: sed
#%modules: linear
#%if: -n "$root_lvm2"
#
##### LVM (Logical Volume Management)
##
## This activates and waits for an LVM.
##
## Command line parameters
## -----------------------
##
## root_lvm2=1          use LVM
## root=/dev/mapper/... use this device as Volume Group
## vg_roots             use this group as Volume Group
## 

lvm2_get_vg() {
    local param=$1
    local vg_root vg_name
    local sysdev
    
    case $param in
        /dev/disk/by-*/*)
            vg_root=
            ;;
        /dev/mapper/*)
            vg_name=${o##root=/dev/mapper/}
            vg_root=${vg_name%%-*}
            ;;
        /dev/*)
            set -- $(IFS=/ ; echo $param)
            if [ "$#" = "3" ] ; then
                # Check sysfs. If there are subdirectories
                # matching this name it's a block device
                for d in /sys/block/$2\!* ; do
                    if [ -d $d ] ; then
                        sysdev=$d
                    fi
                done
                # Not found in sysfs, looks like a VG then
                if [ -z "$sysdev" ] ; then
                    vg_root=$2
                fi
            fi
            ;;
    esac

    echo $vg_root
}

# load the necessary module before we initialize the raid system
load_modules

if [ -n "$root_lvm2" ] ; then
    o=$(get_param root)
    # Fallback if 'root=' is not specified
    [ -z "$o" ] && o=$rootdev
    vg_root=$(lvm2_get_vg $o)
    if [ "$vg_root" ] ; then
        # We are waiting for a device-mapper device
        root_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices)
    fi
    o=$(get_param resume)
    vg_resume=$(lvm2_get_vg $o)
    if [ "$vg_resume" ] ; then
        resume_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices)
    fi
fi

# initialize remebered and parameterized devices
for vgr in $vg_root $vg_resume $vg_roots; do
        vgchange -a y $vgr
done

unset lvm2_get_vg
++++++ mkinitrd-lvm2-setup.sh ++++++
#!/bin/bash
#
#%stage: volumemanager
#%depends: evms
#
# get information about the current blockdev
update_blockdev

# Check whether we are using LVM2 (only available when not using EVMS)
if [ -z "$root_evms" ] && [ -x "$(type -p lvdisplay)" ] ; then
  lvm_blockdev=

  for bd in $blockdev; do
    update_blockdev $bd
        
    vg_name=$(lvdisplay -c 2> /dev/null | sed -n 
"/:${blockmajor}:${blockminor}$/p")
    vg_dev=${vg_name%%:*}
    vg_name=${vg_name#*:}
    vg_root=${vg_name%%:*}
    if [ "$vg_root" ] ; then
        local vg_blockdev
        root_lvm2=1
        realrootdev=${vg_dev##  }
        vg_blockdev=$(vgs --noheadings --options pv_name $vg_root 2> /dev/null 
| sed "s@,@\n@g" | sed "s@([0-9]*)@@g;s@ @@g" | sort | uniq)
        lvm_blockdev="$lvm_blockdev $vg_blockdev"
        [ $? -eq 0 ] || return 1
        vg_roots="$vg_roots $vg_root"
    else
        lvm_blockdev="$lvm_blockdev $bd"
    fi
  done
  blockdev="$lvm_blockdev"
fi

if use_script lvm2; then
    tmp_root_dm=1 # lvm needs dm
    mkdir -p $tmp_mnt/etc/lvm
    mkdir -p $tmp_mnt/var/lock/lvm
    cp -a /etc/lvm/lvm.conf $tmp_mnt/etc/lvm/
# udev rule for lvm2
        mkdir -p $tmp_mnt/usr/lib/udev/rules.d
        cp /usr/lib/udev/rules.d/11-dm-lvm.rules $tmp_mnt/usr/lib/udev/rules.d/
        if [ -e /usr/lib/udev/rules.d/64-lvm2.rules ]; then
                cp /usr/lib/udev/rules.d/64-lvm2.rules 
$tmp_mnt/usr/lib/udev/rules.d/
        fi
fi

save_var root_lvm2
save_var vg_roots

++++++ no-inc-audit.diff ++++++
Index: lib/device/dev-io.c
===================================================================
--- lib/device/dev-io.c.orig    2009-05-20 19:09:49.000000000 +0800
+++ lib/device/dev-io.c 2010-02-04 11:00:22.000000000 +0800
@@ -31,6 +31,7 @@
 #  define u64 uint64_t         /* Missing without __KERNEL__ */
 #  undef WNOHANG               /* Avoid redefinition */
 #  undef WUNTRACED             /* Avoid redefinition */
+#  define _LINUX_AUDIT_H_      /* Avoid inclusion */
 #  include <linux/fs.h>                /* For block ioctl definitions */
 #  define BLKSIZE_SHIFT SECTOR_SHIFT
 #  ifndef BLKGETSIZE64         /* fs.h out-of-date */
Index: lib/filters/filter.c
===================================================================
--- lib/filters/filter.c.orig   2010-02-04 11:00:18.000000000 +0800
+++ lib/filters/filter.c        2010-02-04 11:00:22.000000000 +0800
@@ -14,6 +14,7 @@
  */
 
 #include <sys/ioctl.h>
+#define _LINUX_AUDIT_H_
 #include <linux/fs.h>
 #undef MAJOR
 #undef MINOR
++++++ no_buildroot_shared.diff ++++++
Index: tools/Makefile.in
===================================================================
--- tools/Makefile.in.orig      2011-02-15 14:57:28.000000000 +0800
+++ tools/Makefile.in   2011-02-15 14:57:32.000000000 +0800
@@ -109,7 +109,7 @@
 EXPORTED_HEADER = $(srcdir)/lvm2cmd.h
 EXPORTED_FN_PREFIX = lvm2
 
-DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
+DEFS += -DLVM_SHARED_PATH=\"/sbin/lvm\"
 
 CFLOW_LIST = lvmcmdlib.c lvm2cmd.c
 CFLOW_LIST_TARGET = liblvm2cmd.cflow
++++++ pipe_buff-definition.diff ++++++
---
 daemons/clvmd/clvmd.c |    2 ++
 1 file changed, 2 insertions(+)

--- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c
+++ LVM2.2.02.98/daemons/clvmd/clvmd.c
@@ -53,6 +53,8 @@
 
 #define ISLOCAL_CSID(c) (memcmp(c, our_csid, max_csid_len) == 0)
 
+#include <linux/limits.h>
+
 /* Head of the fd list. Also contains
    the cluster_socket details */
 static struct local_client local_client_head;
++++++ remove-fedora-systemd.patch ++++++
commit 360c569ce8f0bfe936d59ca91de2716958550524
Author: Peter Rajnoha <prajn...@redhat.com>
Date:   Tue Oct 30 20:36:49 2012 +0100

    systemd: various updates and fixes
    
    Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue.
     - a systemd design issue while processing dependencies
       with socket-based activation that ends up with a hang
     - https://bugzilla.redhat.com/show_bug.cgi?id=843587
       (also tracker bug https://bugzilla.redhat.com/show_bug.cgi?id=871527)
     - not using lvmetad in this case is just a workaround, once the bug
       above is resolved, we should enable the lvmetad in that specific case
    
    Remove dependency on fedora-storage-init.service in lvm2 systemd units.
     - fedora-storage-init.service and fedora-storage-init-late.service is
       going to be separated into respective units that belong to each block
       device subsystem:
         - mpath + mdraid activated via udev solely
         - dmraid with its own dmraid-activation.service unit
         - lvm2 with the lvm2-activation-generator to generate the
           activation units runtime if lvmetad disabled
           (global/use_lvmetad=0 set in lvm.conf) and activation done
           via udev+lvmetad if lvmetad enabled (global/use_lvmetad=1 set
           in lvm.conf)
    
    Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.
     - as lvm2-monitor uses lvmetad if lvmetad is enabled

diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in 
b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 6c4c55f..e6b4814 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -1,8 +1,8 @@
 [Unit]
 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
+Requires=dm-event.socket lvm2-lvmetad.socket
+After=dm-event.socket lvm2-lvmetad.socket lvm2-lvmetad.service
 Before=local-fs.target
 DefaultDependencies=no
 Conflicts=shutdown.target
@@ -11,7 +11,8 @@ Conflicts=shutdown.target
 Type=oneshot
 Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
 ExecStart=@sbindir@/lvm vgchange --monitor y
-ExecStop=@sbindir@/lvm vgchange --monitor n
+# The lvmetad must be disabled here, it needs 
https://bugzilla.redhat.com/show_bug.cgi?id=843587 to be resolved first.
+ExecStop="@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'"
 RemainAfterExit=yes
 
 [Install]
++++++ support-drbd-filter.diff ++++++
This is still very primitive support of drbd in lvm2.
Can we use some /sys information for this ?
---
 lib/cache/lvmcache.c |   14 ++++++++++++++
 lib/filters/filter.c |    7 +++++++
 2 files changed, 21 insertions(+)

--- LVM2.2.02.98.orig/lib/cache/lvmcache.c
+++ LVM2.2.02.98/lib/cache/lvmcache.c
@@ -1489,6 +1489,14 @@ struct lvmcache_info *lvmcache_add(struc
                                                 
dev_subsystem_name(existing->dev),
                                                 dev_name(existing->dev));
                                return NULL;
+                       } else if (MAJOR(existing->dev->dev) == drbd_major() &&
+                                       MAJOR(dev->dev) != drbd_major()) {
+                               log_very_verbose("Ignoring duplicate PV %s on "
+                                               "%s - using drbd %s",
+                                               pvid, dev_name(dev),
+                                               dev_name(existing->dev));
+                               return NULL;
+
                        } else if (dm_is_dm_major(MAJOR(existing->dev->dev)) &&
                                   !dm_is_dm_major(MAJOR(dev->dev))) {
                                log_very_verbose("Ignoring duplicate PV %s on "
@@ -1509,6 +1517,12 @@ struct lvmcache_info *lvmcache_add(struc
                                                 "using dm %s", pvid,
                                                 dev_name(existing->dev),
                                                 dev_name(dev));
+                       else if (MAJOR(existing->dev->dev) != drbd_major() &&
+                                       MAJOR(dev->dev) == drbd_major())
+                               log_very_verbose("Duplicate PV %s on %s - "
+                                               "using drbd %s", pvid,
+                                               dev_name(existing->dev),
+                                               dev_name(dev));
                        /* FIXME If both dm, check dependencies */
                        //else if (dm_is_dm_major(MAJOR(existing->dev->dev)) &&
                                 //dm_is_dm_major(MAJOR(dev->dev)))
--- LVM2.2.02.98.orig/lib/filters/filter.c
+++ LVM2.2.02.98/lib/filters/filter.c
@@ -60,6 +60,13 @@ int md_major(void)
        return _md_major;
 }
 
+/* FIXME: Should we consider filter out non-primary
+   drbd resource ?? */
+int drbd_major(void)
+{
+       return _drbd_major;
+}
+
 int blkext_major(void)
 {
        return _blkext_major;
++++++ suppress_locking_failer_message.patch ++++++
Index: LVM2.2.02.98/lib/locking/locking.c
===================================================================
--- LVM2.2.02.98.orig/lib/locking/locking.c
+++ LVM2.2.02.98/lib/locking/locking.c
@@ -221,8 +221,8 @@ static void _update_vg_lock_count(const
  */
 int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
 {
-       if (getenv("LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES"))
-               suppress_messages = 1;
+
+       suppress_messages = 1;
 
        if (type < 0)
                type = find_config_tree_int(cmd, "global/locking_type", 1);
++++++ sys_mount_instead_linux_fs.diff ++++++
Index: lib/device/dev-io.c
===================================================================
--- lib/device/dev-io.c.orig    2009-04-27 16:15:42.000000000 +0800
+++ lib/device/dev-io.c 2009-04-27 16:15:49.000000000 +0800
@@ -32,7 +32,7 @@
 #  undef WNOHANG               /* Avoid redefinition */
 #  undef WUNTRACED             /* Avoid redefinition */
 #  define _LINUX_AUDIT_H_      /* Avoid inclusion */
-#  include <linux/fs.h>                /* For block ioctl definitions */
+#  include <sys/mount.h>        /* For block ioctl definitions */
 #  define BLKSIZE_SHIFT SECTOR_SHIFT
 #  ifndef BLKGETSIZE64         /* fs.h out-of-date */
 #    define BLKGETSIZE64 _IOR(0x12, 114, size_t)
Index: lib/filters/filter.c
===================================================================
--- lib/filters/filter.c.orig   2009-04-27 16:15:42.000000000 +0800
+++ lib/filters/filter.c        2009-04-27 16:15:49.000000000 +0800
@@ -15,7 +15,7 @@
 
 #include <sys/ioctl.h>
 #define _LINUX_AUDIT_H_
-#include <linux/fs.h>
+#include <sys/mount.h>
 #undef MAJOR
 #undef MINOR
 #undef MKDEV
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to