From wysochanski@sourceware.org Wed May 6 15:25:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Wed, 06 May 2009 15:25:00 -0000 Subject: LVM2/lib/report columns.h Message-ID: <20090506152523.30195.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-06 15:25:23 Modified files: lib/report : columns.h Log message: Update columns.h comment. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.34&r2=1.35 --- LVM2/lib/report/columns.h 2009/04/25 01:18:00 1.34 +++ LVM2/lib/report/columns.h 2009/05/06 15:25:23 1.35 @@ -35,7 +35,10 @@ * it is pointer that may be used to derive the data value (for example, * seg_count - see _lvsegcount_disp()). In the FIELD macro definition, * this is used in an offset calculation to derive the offset to the - * data value from the containing struct base address. + * data value from the containing struct base address. Note that in some + * cases, the argument is the first member of the struct, in which case the + * data value pointer points to the start of the struct itself (for example, + * 'lvid' field of struct 'lv'). * 6. Minimum display width. This is the minimum width used to display * the field value. * 7. Display function identifier. Used to derive the full name of the From mbroz@sourceware.org Thu May 7 12:01:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Thu, 07 May 2009 12:01:00 -0000 Subject: LVM2/lib/activate dev_manager.c Message-ID: <20090507120122.15326.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-07 12:01:22 Modified files: lib/activate : dev_manager.c Log message: Use zalloc in initialization of device manager (to zero pvmove mirror count). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147 --- LVM2/lib/activate/dev_manager.c 2009/02/28 20:04:24 1.146 +++ LVM2/lib/activate/dev_manager.c 2009/05/07 12:01:21 1.147 @@ -445,7 +445,7 @@ if (!(mem = dm_pool_create("dev_manager", 16 * 1024))) return_NULL; - if (!(dm = dm_pool_alloc(mem, sizeof(*dm)))) + if (!(dm = dm_pool_zalloc(mem, sizeof(*dm)))) goto_bad; dm->cmd = cmd; From mbroz@sourceware.org Thu May 7 12:11:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Thu, 07 May 2009 12:11:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format_text/format-text.c ... Message-ID: <20090507121152.30578.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-07 12:11:51 Modified files: . : WHATS_NEW lib/format_text: format-text.c test : t-pvcreate-usage.sh Log message: Fix PV datalign when for values starting prior to MDA area. The dataalign value must always be aligned according to MDA area. The currect code checks if calculated value collides with MDA area but not if the value is so small that it is located before MDA starts. Unfortunatelly there can be also MDA in the end of the device. The patch adds simple check to avoid this miscalculation. Patch expects that first MDA always starts on <= pagesize boundary (this is true for all allowed label sector parameters). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1096&r2=1.1097 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.104&r2=1.105 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.8&r2=1.9 --- LVM2/WHATS_NEW 2009/04/25 01:17:59 1.1096 +++ LVM2/WHATS_NEW 2009/05/07 12:11:50 1.1097 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix PV datalignment for values starting prior to MDA area. (2.02.45) Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). Add lvs origin_size field. Fix linux configure --enable-debug to exclude -O2. --- LVM2/lib/format_text/format-text.c 2009/03/23 21:13:37 1.104 +++ LVM2/lib/format_text/format-text.c 2009/05/07 12:11:51 1.105 @@ -1372,7 +1372,9 @@ dm_list_iterate_items(mda, &info->mdas) { mdac = (struct mda_context *) mda->metadata_locn; if (pv->dev == mdac->area.dev && - (mdac->area.start <= (pv->pe_start << SECTOR_SHIFT)) && + ((mdac->area.start <= (pv->pe_start << SECTOR_SHIFT)) || + (mdac->area.start <= lvm_getpagesize() && + pv->pe_start < (lvm_getpagesize() >> SECTOR_SHIFT))) && (mdac->area.start + mdac->area.size > (pv->pe_start << SECTOR_SHIFT))) { pv->pe_start = (mdac->area.start + mdac->area.size) --- LVM2/test/t-pvcreate-usage.sh 2009/02/25 23:31:06 1.8 +++ LVM2/test/t-pvcreate-usage.sh 2009/05/07 12:11:51 1.9 @@ -94,6 +94,12 @@ pvcreate --metadatasize 100k --dataalignment 100k $dev1 check_pv_field_ $dev1 pe_start 200.00K +pvcreate --metadatasize 128k --dataalignment 3.5k $dev1 +check_pv_field_ $dev1 pe_start 133.00K + +pvcreate --metadatasize 128k --metadatacopies 2 --dataalignment 3.5k $dev1 +check_pv_field_ $dev1 pe_start 133.00K + #COMM 'pv with LVM1 compatible data alignment can be convereted' #compatible == LVM1_PE_ALIGN == 64k pvcreate --dataalignment 256k $dev1 From wysochanski@sourceware.org Fri May 8 04:24:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Fri, 08 May 2009 04:24:00 -0000 Subject: LVM2/test t-lvcreate-usage.sh Message-ID: <20090508042453.13970.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-08 04:24:52 Modified files: test : t-lvcreate-usage.sh Log message: Validate chunksize and originsize for snapshots. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11 --- LVM2/test/t-lvcreate-usage.sh 2009/03/16 14:34:58 1.10 +++ LVM2/test/t-lvcreate-usage.sh 2009/05/08 04:24:52 1.11 @@ -67,3 +67,20 @@ vgs $vg lvremove -ff $vg vgchange -l 0 $vg + +# lvcreate rejects invalid chunksize, accepts between 4K and 512K +# validate origin_size +vgremove -ff $vg +vgcreate -cn $vg $devs +lvcreate -L 32M -n $lv1 $vg +not lvcreate -L 8M -n $lv2 -s --chunksize 3K $vg/$lv1 +not lvcreate -L 8M -n $lv2 -s --chunksize 1024K $vg/$lv1 +lvcreate -L 8M -n $lv2 -s --chunksize 4K $vg/$lv1 +check_lv_field_ $vg/$lv2 chunk_size 4.00K +check_lv_field_ $vg/$lv2 origin_size 32.00M +lvcreate -L 8M -n $lv3 -s --chunksize 512K $vg/$lv1 +check_lv_field_ $vg/$lv3 chunk_size 512.00K +check_lv_field_ $vg/$lv3 origin_size 32.00M +lvremove -ff $vg +vgchange -l 0 $vg + From wysochanski@sourceware.org Fri May 8 05:15:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Fri, 08 May 2009 05:15:00 -0000 Subject: LVM2/test t-vgcreate-usage.sh Message-ID: <20090508051553.13733.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-08 05:15:52 Modified files: test : t-vgcreate-usage.sh Log message: Add tests to check vgcreate --physicalextentsize and field vg_extent_size. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgcreate-usage.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7 --- LVM2/test/t-vgcreate-usage.sh 2008/11/10 12:43:35 1.6 +++ LVM2/test/t-vgcreate-usage.sh 2009/05/08 05:15:52 1.7 @@ -66,3 +66,16 @@ #COMM "vgcreate fails when the only pv has --metadatacopies 0" not vgcreate $vg $dev3 + +# Test default (4MB) vg_extent_size as well as limits of extent_size +not vgcreate --physicalextentsize 0K $vg $dev1 $dev2 +vgcreate $vg $dev1 $dev2 +check_vg_field_ $vg vg_extent_size 4.00M +vgremove -ff $vg +vgcreate --physicalextentsize 1K $vg $dev1 $dev2 +check_vg_field_ $vg vg_extent_size 1.00K +vgremove -ff $vg +not vgcreate --physicalextentsize 3K $vg $dev1 $dev2 +not vgcreate --physicalextentsize 1024T $vg $dev1 $dev2 +#not vgcreate --physicalextentsize 1T $vg $dev1 $dev2 +# FIXME: vgcreate allows physicalextentsize larger than pv size! From wysochanski@sourceware.org Fri May 8 06:10:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Fri, 08 May 2009 06:10:00 -0000 Subject: LVM2/test lvm-utils.sh t-pvcreate-usage.sh Message-ID: <20090508061048.20292.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-08 06:10:47 Modified files: test : lvm-utils.sh t-pvcreate-usage.sh Log message: Add tests to check pv_mda_size and vg_mda_size. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lvm-utils.sh.diff?cvsroot=lvm2&r1=1.17&r2=1.18 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.9&r2=1.10 --- LVM2/test/lvm-utils.sh 2009/01/10 12:19:41 1.17 +++ LVM2/test/lvm-utils.sh 2009/05/08 06:10:45 1.18 @@ -50,6 +50,26 @@ return 0; } +compare_two_fields_() +{ + local cmd1=$1; + local obj1=$2; + local field1=$3; + local cmd2=$4; + local obj2=$5; + local field2=$6; + local val1; + local val2; + + val1=$($cmd1 --noheadings -o $field1 $obj1) + val2=$($cmd2 --noheadings -o $field2 $obj2) +if test "$verbose" = "t" +then + echo "compare_two_fields_ $obj1($field1): $val1 $obj2($field2): $val2" +fi + test $val1 = $val2 +} + compare_vg_field_() { local vg1=$1; --- LVM2/test/t-pvcreate-usage.sh 2009/05/07 12:11:51 1.9 +++ LVM2/test/t-pvcreate-usage.sh 2009/05/08 06:10:45 1.10 @@ -29,6 +29,13 @@ pvcreate --metadatasize 0 $dev1 pvremove $dev1 +#Verify vg_mda_size is smaller pv_mda_size +pvcreate --metadatasize 512K $dev1 +pvcreate --metadatasize 96K $dev2 +vgcreate $vg $dev1 $dev2 +compare_two_fields_ vgs $vg vg_mda_size pvs $dev2 pv_mda_size +vgremove -ff $vg + # x. metadatasize too large # For some reason we allow this, even though there's no room for data? ##COMM 'pvcreate rejects metadatasize too large' From wysochanski@sourceware.org Fri May 8 21:50:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Fri, 08 May 2009 21:50:00 -0000 Subject: LVM2/test t-lvcreate-usage.sh Message-ID: <20090508215023.14892.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-08 21:50:22 Modified files: test : t-lvcreate-usage.sh Log message: Update tests for region_size. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.11&r2=1.12 --- LVM2/test/t-lvcreate-usage.sh 2009/05/08 04:24:52 1.11 +++ LVM2/test/t-lvcreate-usage.sh 2009/05/08 21:50:20 1.12 @@ -13,7 +13,7 @@ . ./test-utils.sh -aux prepare_pvs 2 +aux prepare_pvs 4 aux pvcreate --metadatacopies 0 $dev1 vgcreate -cn $vg $devs @@ -48,10 +48,6 @@ not lvcreate -L 64M -n $lv -i129 $vg 2>err grep "^ Number of stripes (129) must be between 1 and 128\$" err -# 'lvcreate rejects an invalid regionsize (bz186013)' -not lvcreate -L 64M -n $lv -R0 $vg 2>err -grep "Non-zero region size must be supplied." err - # The case on lvdisplay output is to verify that the LV was not created. # 'lvcreate rejects an invalid stripe size' not lvcreate -L 64M -n $lv -i2 --stripesize 3 $vg 2>err @@ -84,3 +80,18 @@ lvremove -ff $vg vgchange -l 0 $vg +# regionsize must be +# - nonzero (bz186013) +# - a power of 2 and a multiple of page size +# - <= size of LV +not lvcreate -L 32M -n $lv -R0 $vg 2>err +grep "Non-zero region size must be supplied." err +not lvcreate -L 32M -n $lv -R 11k $vg +not lvcreate -L 32M -n $lv -R 1k $vg +lvcreate -L 32M -n $lv --regionsize 128M -m 1 $vg +check_lv_field_ $vg/$lv regionsize "32.00M" +lvremove -ff $vg +lvcreate -L 32M -n $lv --regionsize 4M -m 1 $vg +check_lv_field_ $vg/$lv regionsize "4.00M" +lvremove -ff $vg + From mornfall@sourceware.org Sat May 9 13:47:00 2009 From: mornfall@sourceware.org (mornfall@sourceware.org) Date: Sat, 09 May 2009 13:47:00 -0000 Subject: LVM2 WHATS_NEW Message-ID: <20090509134703.15293.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2009-05-09 13:47:03 Modified files: . : WHATS_NEW Log message: Update WHATS_NEW wrt a recent patch. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1097&r2=1.1098 --- LVM2/WHATS_NEW 2009/05/07 12:11:50 1.1097 +++ LVM2/WHATS_NEW 2009/05/09 13:47:03 1.1098 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Reject missing PVs from allocation in toollib. Fix PV datalignment for values starting prior to MDA area. (2.02.45) Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). Add lvs origin_size field. From wysochanski@sourceware.org Mon May 11 03:37:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 11 May 2009 03:37:00 -0000 Subject: LVM2/test t-lvextend-percent-extents.sh Message-ID: <20090511033735.26532.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-11 03:37:34 Modified files: test : t-lvextend-percent-extents.sh Log message: Add test for seg_start, seg_count, seg_start_pe Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvextend-percent-extents.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7 --- LVM2/test/t-lvextend-percent-extents.sh 2008/11/11 15:46:15 1.6 +++ LVM2/test/t-lvextend-percent-extents.sh 2009/05/11 03:37:34 1.7 @@ -80,3 +80,22 @@ grep "^ Logical volume $lv successfully resized\$" out check_lv_field_ $vg/$lv lv_size "72.00M" +# Simple seg_count validation; initially create the LV with half the # of +# extents (should be 1 lv segment), extend it (should go to 2 segments), +# then reduce (should be back to 1) +# FIXME: test other segment fields such as seg_size, pvseg_start, pvseg_size +lvremove -f $vg/$lv +pe_count=$(pvs -o pv_pe_count --noheadings $dev1) +pe1=$(( $pe_count / 2 )) +lvcreate -l $pe1 -n $lv $vg +pesize=$(lvs -ovg_extent_size --units b --nosuffix --noheadings $vg/$lv) +segsize=$(( $pe1 * $pesize / 1024 / 1024 ))M +check_lv_field_ $vg/$lv seg_count 1 +check_lv_field_ $vg/$lv seg_start 0 +check_lv_field_ $vg/$lv seg_start_pe 0 +#check_lv_field_ $vg/$lv seg_size $segsize +lvextend -l +$(( $pe_count * 1 )) $vg/$lv +check_lv_field_ $vg/$lv seg_count 2 +lvreduce -f -l -$(( $pe_count * 1 )) $vg/$lv +check_lv_field_ $vg/$lv seg_count 1 + From mbroz@sourceware.org Mon May 11 10:12:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 11 May 2009 10:12:00 -0000 Subject: LVM2/daemons/dmeventd Makefile.in Message-ID: <20090511101235.14423.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-11 10:12:35 Modified files: daemons/dmeventd: Makefile.in Log message: Do not use generic install if running install_device-mapper. It propagates into subdirs which includes DSOs which requires lvm2 build (only install_device-mapper should propagate there). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/Makefile.in.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/daemons/dmeventd/Makefile.in 2009/04/08 14:04:35 1.24 +++ LVM2/daemons/dmeventd/Makefile.in 2009/05/11 10:12:35 1.25 @@ -63,7 +63,7 @@ install: $(INSTALL_TYPE) install_include install_dmeventd -install_device-mapper: install +install_device-mapper: $(INSTALL_TYPE) install_include install_dmeventd install_include: $(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper-event.h \ From mbroz@sourceware.org Mon May 11 10:13:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 11 May 2009 10:13:00 -0000 Subject: LVM2/tools Makefile.in Message-ID: <20090511101328.14693.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-11 10:13:28 Modified files: tools : Makefile.in Log message: Fix device-mapper static build targets. dmsetup.static is not built and cleaned properly if running only device-mapper install/build. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/Makefile.in.diff?cvsroot=lvm2&r1=1.95&r2=1.96 --- LVM2/tools/Makefile.in 2009/04/15 14:42:27 1.95 +++ LVM2/tools/Makefile.in 2009/05/11 10:13:28 1.96 @@ -66,12 +66,15 @@ .commands \ lvm +TARGETS_DM = dmsetup + INSTALL_LVM_TARGETS = install_tools_dynamic INSTALL_DMSETUP_TARGETS = install_dmsetup_dynamic INSTALL_CMDLIB_TARGETS = install_cmdlib_dynamic ifeq ("@STATIC_LINK@", "yes") - TARGETS += lvm.static dmsetup.static + TARGETS += lvm.static + TARGETS_DM += dmsetup.static INSTALL_LVM_TARGETS += install_tools_static INSTALL_DMSETUP_TARGETS += install_dmsetup_static INSTALL_CMDLIB_TARGETS += install_cmdlib_static @@ -82,7 +85,7 @@ CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) liblvm2cmd.a liblvm2cmd-static.a lvm lvm.o \ lvm2cmd.o lvm2cmd-static.o lvm2cmdlib.o lvm.static \ lvm.cflow lvm.xref lvm.tree lvm.rxref lvm.rtree \ - lvmcmdlib.o lvm-static.o dmsetup.o dmsetup + lvmcmdlib.o lvm-static.o dmsetup.o $(TARGETS_DM) ifeq ("@CMDLIB@", "yes") TARGETS += liblvm2cmd.$(LIB_SUFFIX) @@ -99,7 +102,7 @@ include $(top_srcdir)/make.tmpl -device-mapper: dmsetup +device-mapper: $(TARGETS_DM) dmsetup: dmsetup.o $(top_srcdir)/libdm/libdevmapper.$(LIB_SUFFIX) $(CC) -o $@ dmsetup.o $(CFLAGS) $(LDFLAGS) \ From mbroz@sourceware.org Mon May 11 10:28:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 11 May 2009 10:28:00 -0000 Subject: LVM2 ./WHATS_NEW ./make.tmpl.in daemons/dmeven ... Message-ID: <20090511102848.22776.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-11 10:28:47 Modified files: . : WHATS_NEW make.tmpl.in daemons/dmeventd/plugins/mirror: Makefile.in daemons/dmeventd/plugins/snapshot: Makefile.in doc : Makefile.in include : Makefile.in man : Makefile.in scripts : Makefile.in tools : Makefile.in Log message: Introduce lvm2_install target. Buildsystem support device-mapper only install, but generic install tagret includes both dm+lvm2. For distribution which uses separate install_device-mapper, there is no way how to install lvm2 only (so after installing lvm2 for packaging purposes built system must remove installed device-mapper files). Fix it by allowing lvm2_install target, similarily like install_cluster for clvmd. (install = install_device-mapper + install_lvm2) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1098&r2=1.1099 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/make.tmpl.in.diff?cvsroot=lvm2&r1=1.66&r2=1.67 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/mirror/Makefile.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/snapshot/Makefile.in.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/Makefile.in.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/include/Makefile.in.diff?cvsroot=lvm2&r1=1.10&r2=1.11 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/Makefile.in.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/Makefile.in.diff?cvsroot=lvm2&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/Makefile.in.diff?cvsroot=lvm2&r1=1.96&r2=1.97 --- LVM2/WHATS_NEW 2009/05/09 13:47:03 1.1098 +++ LVM2/WHATS_NEW 2009/05/11 10:28:45 1.1099 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Add make install_lvm2 as complement to device-mapper install. Reject missing PVs from allocation in toollib. Fix PV datalignment for values starting prior to MDA area. (2.02.45) Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). --- LVM2/make.tmpl.in 2009/04/08 14:08:18 1.66 +++ LVM2/make.tmpl.in 2009/05/11 10:28:45 1.67 @@ -126,7 +126,7 @@ POTFILES = $(SOURCES:%.c=%.pot) .PHONY: all install install_cluster pofile distclean clean cflow device-mapper -.PHONY: install_device-mapper +.PHONY: install_device-mapper install_lvm2 .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean) .PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow) .PHONY: $(SUBDIRS.device-mapper) $(SUBDIRS.install-device-mapper) @@ -135,6 +135,7 @@ SUBDIRS.install := $(SUBDIRS:=.install) SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster) SUBDIRS.install_device-mapper := $(SUBDIRS:=.install_device-mapper) +SUBDIRS.install_lvm2 := $(SUBDIRS:=.install_lvm2) SUBDIRS.pofile := $(SUBDIRS:=.pofile) SUBDIRS.cflow := $(SUBDIRS:=.cflow) SUBDIRS.clean := $(SUBDIRS:=.clean) @@ -147,6 +148,7 @@ install: all $(SUBDIRS.install) install_cluster: all $(SUBDIRS.install_cluster) install_device-mapper: $(SUBDIRS.install_device-mapper) +install_lvm2: $(SUBDIRS.install_lvm2) $(SUBDIRS): $(SUBDIRS.device-mapper) $(MAKE) -C $@ @@ -163,6 +165,9 @@ $(SUBDIRS.install_device-mapper): device-mapper $(MAKE) -C $(@:.install_device-mapper=) install_device-mapper +$(SUBDIRS.install_lvm2): $(SUBDIRS) + $(MAKE) -C $(@:.install_lvm2=) install_lvm2 + $(SUBDIRS.clean): -$(MAKE) -C $(@:.clean=) clean --- LVM2/daemons/dmeventd/plugins/mirror/Makefile.in 2008/11/03 22:14:26 1.8 +++ LVM2/daemons/dmeventd/plugins/mirror/Makefile.in 2009/05/11 10:28:46 1.9 @@ -31,7 +31,9 @@ include $(top_srcdir)/make.tmpl -install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX) +install_lvm2: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX) $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \ $(libdir)/$<.$(LIB_VERSION) $(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$< + +install: install_lvm2 --- LVM2/daemons/dmeventd/plugins/snapshot/Makefile.in 2008/11/03 22:14:27 1.4 +++ LVM2/daemons/dmeventd/plugins/snapshot/Makefile.in 2009/05/11 10:28:46 1.5 @@ -31,7 +31,9 @@ include $(top_srcdir)/make.tmpl -install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX) +install_lvm2: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX) $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \ $(libdir)/$<.$(LIB_VERSION) $(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$< + +install: install_lvm2 --- LVM2/doc/Makefile.in 2007/09/21 10:16:43 1.4 +++ LVM2/doc/Makefile.in 2009/05/11 10:28:46 1.5 @@ -20,10 +20,11 @@ include $(top_srcdir)/make.tmpl -install: +install_lvm2: @if [ ! -e $(confdir)/$(CONFDEST) ]; then \ echo "Installing $(CONFSRC) as $(confdir)/$(CONFDEST)"; \ @INSTALL@ -D $(OWNER) $(GROUP) -m 644 $(CONFSRC) \ $(confdir)/$(CONFDEST); \ fi +install: install_lvm2 --- LVM2/include/Makefile.in 2008/11/04 17:25:32 1.10 +++ LVM2/include/Makefile.in 2009/05/11 10:28:46 1.11 @@ -45,5 +45,7 @@ install_device-mapper: +install_lvm2: + cflow: --- LVM2/man/Makefile.in 2008/11/04 17:25:32 1.25 +++ LVM2/man/Makefile.in 2009/05/11 10:28:46 1.26 @@ -57,7 +57,7 @@ %: %.in $(SED) -e "s/#VERSION#/$(LVM_VERSION)/" $< > $@ -install: install_device-mapper +install_lvm2: @echo "Installing $(MAN8) in $(MAN8DIR)" @for f in $(MAN8); \ do \ @@ -87,3 +87,5 @@ $(RM) $(MAN8DIR)/$$f; \ @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \ done + +install: install_lvm2 install_device-mapper --- LVM2/scripts/Makefile.in 2009/03/16 20:00:10 1.6 +++ LVM2/scripts/Makefile.in 2009/05/11 10:28:46 1.7 @@ -17,6 +17,8 @@ include $(top_srcdir)/make.tmpl +install_lvm2: install + install: $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) lvm_dump.sh \ $(sbindir)/lvmdump --- LVM2/tools/Makefile.in 2009/05/11 10:13:28 1.96 +++ LVM2/tools/Makefile.in 2009/05/11 10:28:46 1.97 @@ -195,4 +195,6 @@ install_device-mapper: $(INSTALL_DMSETUP_TARGETS) -install: $(INSTALL_LVM_TARGETS) install_device-mapper +install_lvm2: $(INSTALL_LVM_TARGETS) + +install: install_lvm2 install_device-mapper From mbroz@sourceware.org Mon May 11 10:35:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Mon, 11 May 2009 10:35:00 -0000 Subject: LVM2/scripts Makefile.in Message-ID: <20090511103501.24811.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-11 10:35:01 Modified files: scripts : Makefile.in Log message: Fix previous commit (scripts/Makefile targets order) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/Makefile.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8 --- LVM2/scripts/Makefile.in 2009/05/11 10:28:46 1.7 +++ LVM2/scripts/Makefile.in 2009/05/11 10:35:00 1.8 @@ -17,8 +17,6 @@ include $(top_srcdir)/make.tmpl -install_lvm2: install - install: $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) lvm_dump.sh \ $(sbindir)/lvmdump @@ -27,4 +25,6 @@ $(sbindir)/fsadm endif +install_lvm2: install + DISTCLEAN_TARGETS += clvmd_init_red_hat From wysochanski@sourceware.org Mon May 11 16:17:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Mon, 11 May 2009 16:17:00 -0000 Subject: LVM2/test t-read-ahead.sh Message-ID: <20090511161713.11722.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-11 16:17:12 Modified files: test : t-read-ahead.sh Log message: Update t-read-ahead.sh to validate lv_read_ahead and lv_kernel_read_ahead. - check default values - check active/inactive values Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-read-ahead.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5 --- LVM2/test/t-read-ahead.sh 2008/11/10 12:43:35 1.4 +++ LVM2/test/t-read-ahead.sh 2009/05/11 16:17:12 1.5 @@ -43,3 +43,13 @@ check_lvs_ lv_read_ahead 400 lvremove -ff "$vg" +# Check default, active/inactive values for read_ahead / kernel_read_ahead +lvcreate -n $lv -l 50%FREE $vg +lvchange -an $vg/$lv +check_lv_field_ $vg/$lv lv_read_ahead auto +check_lv_field_ $vg/$lv lv_kernel_read_ahead -1 +lvchange -r 512 $vg/$lv +lvchange -ay $vg/$lv +check_lv_field_ $vg/$lv lv_read_ahead 256.00K +check_lv_field_ $vg/$lv lv_kernel_read_ahead 256.00K +lvremove -ff $vg From mbroz@sourceware.org Tue May 12 19:09:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 12 May 2009 19:09:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c Message-ID: <20090512190922.28498.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-12 19:09:21 Modified files: . : WHATS_NEW lib/metadata : metadata.c Log message: Fix first_seg() call for empty segment list. The seg variable is temporary variable for list iterator, code cannot expect that after iteration it remains NULL (it contains non-NULL pointer here id list is empty). Patch fixes first_seg function so it now correctly returns NULL for empty segment list. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1099&r2=1.1100 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.213&r2=1.214 --- LVM2/WHATS_NEW 2009/05/11 10:28:45 1.1099 +++ LVM2/WHATS_NEW 2009/05/12 19:09:21 1.1100 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix first_seg() call for empty segment list. Add make install_lvm2 as complement to device-mapper install. Reject missing PVs from allocation in toollib. Fix PV datalignment for values starting prior to MDA area. (2.02.45) --- LVM2/lib/metadata/metadata.c 2009/04/28 17:46:47 1.213 +++ LVM2/lib/metadata/metadata.c 2009/05/12 19:09:21 1.214 @@ -1108,12 +1108,12 @@ struct lv_segment *first_seg(const struct logical_volume *lv) { - struct lv_segment *seg = NULL; + struct lv_segment *seg; dm_list_iterate_items(seg, &lv->segments) - break; + return seg; - return seg; + return NULL; } /* Find segment at a given physical extent in a PV */ From mbroz@sourceware.org Tue May 12 19:12:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 12 May 2009 19:12:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format1/import-export.c l ... Message-ID: <20090512191215.29370.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-12 19:12:10 Modified files: . : WHATS_NEW lib/format1 : import-export.c lib/format_pool: format_pool.c lib/metadata : metadata-exported.h metadata.c metadata.h snapshot_manip.c lib/report : columns.h report.c tools : vgmerge.c vgsplit.c Log message: Remove snapshot_count from VG and use function instead. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1100&r2=1.1101 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.214&r2=1.215 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.192&r2=1.193 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71 --- LVM2/WHATS_NEW 2009/05/12 19:09:21 1.1100 +++ LVM2/WHATS_NEW 2009/05/12 19:12:09 1.1101 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Remove snapshot_count from VG and use function instead. Fix first_seg() call for empty segment list. Add make install_lvm2 as complement to device-mapper install. Reject missing PVs from allocation in toollib. --- LVM2/lib/format1/import-export.c 2008/11/03 22:14:28 1.100 +++ LVM2/lib/format1/import-export.c 2009/05/12 19:12:09 1.101 @@ -282,7 +282,7 @@ vgd->vg_status |= VG_EXTENDABLE; vgd->lv_max = vg->max_lv; - vgd->lv_cur = vg->lv_count + vg->snapshot_count; + vgd->lv_cur = vg->lv_count + snapshot_count(vg); vgd->pv_max = vg->max_pv; vgd->pv_cur = vg->pv_count; --- LVM2/lib/format_pool/format_pool.c 2009/04/10 09:59:18 1.21 +++ LVM2/lib/format_pool/format_pool.c 2009/05/12 19:12:09 1.22 @@ -120,7 +120,6 @@ vg->extent_count = 0; vg->pv_count = 0; vg->lv_count = 0; - vg->snapshot_count = 0; vg->seqno = 1; vg->system_id = NULL; dm_list_init(&vg->pvs); --- LVM2/lib/metadata/metadata-exported.h 2009/04/25 01:17:59 1.65 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/12 19:12:09 1.66 @@ -243,8 +243,7 @@ * Snapshots consist of 2 instances of "struct logical_volume": * - cow (lv_name is visible to the user) * - snapshot (lv_name is 'snapshotN') - * Neither of these instances is reflected in lv_count, but we - * multiply the snapshot_count by 2. + * Neither of these instances is reflected in lv_count. * * Mirrors consist of multiple instances of "struct logical_volume": * - one for the mirror log @@ -253,7 +252,6 @@ * all of the instances are reflected in lv_count. */ uint32_t lv_count; - uint32_t snapshot_count; struct dm_list lvs; struct dm_list tags; --- LVM2/lib/metadata/metadata.c 2009/05/12 19:09:21 1.214 +++ LVM2/lib/metadata/metadata.c 2009/05/12 19:12:09 1.215 @@ -574,8 +574,6 @@ vg->lv_count = 0; dm_list_init(&vg->lvs); - vg->snapshot_count = 0; - dm_list_init(&vg->tags); if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, vg_name, @@ -1155,6 +1153,18 @@ return lv_count; } +unsigned snapshot_count(const struct volume_group *vg) +{ + struct lv_list *lvl; + unsigned lv_count = 0; + + dm_list_iterate_items(lvl, &vg->lvs) + if (lv_is_cow(lvl->lv)) + lv_count++; + + return lv_count; +} + /* * Determine whether two vgs are compatible for merging. */ @@ -1445,11 +1455,11 @@ } if ((lv_count = (uint32_t) dm_list_size(&vg->lvs)) != - vg->lv_count + 2 * vg->snapshot_count) { + vg->lv_count + 2 * snapshot_count(vg)) { log_error("Internal error: #internal LVs (%u) != #LVs (%" PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s", dm_list_size(&vg->lvs), vg->lv_count, - vg->snapshot_count, vg->name); + snapshot_count(vg), vg->name); r = 0; } --- LVM2/lib/metadata/metadata.h 2009/04/25 01:18:00 1.192 +++ LVM2/lib/metadata/metadata.h 2009/05/12 19:12:10 1.193 @@ -345,6 +345,11 @@ unsigned displayable_lvs_in_vg(const struct volume_group *vg); /* + * Count snapshot LVs. + */ +unsigned snapshot_count(const struct volume_group *vg); + +/* * For internal metadata caching. */ int export_vg_to_buffer(struct volume_group *vg, char **buf); --- LVM2/lib/metadata/snapshot_manip.c 2009/04/25 01:18:00 1.35 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/12 19:12:10 1.36 @@ -106,7 +106,6 @@ seg->lv->status |= SNAPSHOT; origin->origin_count++; - origin->vg->snapshot_count++; cow->snapshot = seg; cow->status &= ~VISIBLE_LV; @@ -133,7 +132,6 @@ cow->snapshot = NULL; - cow->vg->snapshot_count--; cow->vg->lv_count++; cow->status |= VISIBLE_LV; --- LVM2/lib/report/columns.h 2009/05/06 15:25:23 1.35 +++ LVM2/lib/report/columns.h 2009/05/12 19:12:10 1.36 @@ -108,7 +108,7 @@ FIELD(VGS, vg, NUM, "MaxPV", max_pv, 5, uint32, "max_pv", "Maximum number of PVs allowed in VG or 0 if unlimited.") FIELD(VGS, vg, NUM, "#PV", pv_count, 3, uint32, "pv_count", "Number of PVs.") FIELD(VGS, vg, NUM, "#LV", cmd, 3, lvcount, "lv_count", "Number of LVs.") -FIELD(VGS, vg, NUM, "#SN", snapshot_count, 3, uint32, "snap_count", "Number of snapshots.") +FIELD(VGS, vg, NUM, "#SN", cmd, 3, snapcount, "snap_count", "Number of snapshots.") FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, "vg_seqno", "Revision number of internal metadata. Incremented whenever it changes.") FIELD(VGS, vg, STR, "VG Tags", tags, 7, tags, "vg_tags", "Tags, if any.") FIELD(VGS, vg, NUM, "#VMda", cmd, 5, vgmdas, "vg_mda_count", "Number of metadata areas in use by this VG.") --- LVM2/lib/report/report.c 2009/04/25 01:18:00 1.97 +++ LVM2/lib/report/report.c 2009/05/12 19:12:10 1.98 @@ -991,6 +991,18 @@ return _uint32_disp(rh, mem, field, &count, private); } +static int _snapcount_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct volume_group *vg = (const struct volume_group *) data; + uint32_t count; + + count = snapshot_count(vg); + + return _uint32_disp(rh, mem, field, &count, private); +} + static int _snpercent_disp(struct dm_report *rh __attribute((unused)), struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private __attribute((unused))) --- LVM2/tools/vgmerge.c 2009/04/10 10:01:39 1.51 +++ LVM2/tools/vgmerge.c 2009/05/12 19:12:10 1.52 @@ -102,8 +102,6 @@ } vg_to->lv_count += vg_from->lv_count; - vg_to->snapshot_count += vg_from->snapshot_count; - vg_to->extent_count += vg_from->extent_count; vg_to->free_count += vg_from->free_count; --- LVM2/tools/vgsplit.c 2009/04/10 10:01:39 1.70 +++ LVM2/tools/vgsplit.c 2009/05/12 19:12:10 1.71 @@ -106,10 +106,7 @@ return 0; } - if (lv->status & SNAPSHOT) { - vg_from->snapshot_count--; - vg_to->snapshot_count++; - } else if (!lv_is_cow(lv)) { + if (!(lv->status & SNAPSHOT) && !lv_is_cow(lv)) { vg_from->lv_count--; vg_to->lv_count++; } From agk@sourceware.org Wed May 13 01:48:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 13 May 2009 01:48:00 -0000 Subject: LVM2/lib/metadata metadata.c Message-ID: <20090513014819.2529.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-13 01:48:19 Modified files: lib/metadata : metadata.c Log message: better variable name for snapshot counting Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.215&r2=1.216 --- LVM2/lib/metadata/metadata.c 2009/05/12 19:12:09 1.215 +++ LVM2/lib/metadata/metadata.c 2009/05/13 01:48:18 1.216 @@ -1156,13 +1156,13 @@ unsigned snapshot_count(const struct volume_group *vg) { struct lv_list *lvl; - unsigned lv_count = 0; + unsigned num_snapshots = 0; dm_list_iterate_items(lvl, &vg->lvs) if (lv_is_cow(lvl->lv)) - lv_count++; + num_snapshots++; - return lv_count; + return num_snapshots; } /* From wysochanski@sourceware.org Wed May 13 13:03:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Wed, 13 May 2009 13:03:00 -0000 Subject: LVM2 ./WHATS_NEW lib/locking/locking.c tools/v ... Message-ID: <20090513130302.17875.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-13 13:02:58 Modified files: . : WHATS_NEW lib/locking : locking.c tools : vgcfgrestore.c vgcreate.c vgextend.c vgmerge.c vgreduce.c vgremove.c vgrename.c vgsplit.c Log message: Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. As a simplification to the tools and further liblvm, this patch pushes the setting of NON_BLOCKING lock flag inside the lock_vol() call. The policy we set is if any existing VGs are currently locked, we set the NON_BLOCKING flag. Should be no functional change. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1101&r2=1.1102 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgrestore.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgremove.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 --- LVM2/WHATS_NEW 2009/05/12 19:12:09 1.1101 +++ LVM2/WHATS_NEW 2009/05/13 13:02:52 1.1102 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. Remove snapshot_count from VG and use function instead. Fix first_seg() call for empty segment list. Add make install_lvm2 as complement to device-mapper install. --- LVM2/lib/locking/locking.c 2009/02/22 16:13:57 1.56 +++ LVM2/lib/locking/locking.c 2009/05/13 13:02:55 1.57 @@ -376,6 +376,14 @@ switch (flags & LCK_SCOPE_MASK) { case LCK_VG: + /* + * Automatically set LCK_NONBLOCK if one or more VGs locked. + * This will enforce correctness and prevent deadlocks rather + * than relying on the caller to set the flag properly. + */ + if (vgs_locked()) + flags |= LCK_NONBLOCK; + /* Lock VG to change on-disk metadata. */ /* If LVM1 driver knows about the VG, it can't be accessed. */ if (!check_lvm1_vg_inactive(cmd, vol)) --- LVM2/tools/vgcfgrestore.c 2008/01/30 14:00:02 1.18 +++ LVM2/tools/vgcfgrestore.c 2009/05/13 13:02:55 1.19 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -48,7 +48,7 @@ return ECMD_FAILED; } - if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) { + if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) { log_error("Unable to lock volume group %s", vg_name); unlock_vg(cmd, VG_ORPHANS); return ECMD_FAILED; --- LVM2/tools/vgcreate.c 2009/04/10 10:01:39 1.59 +++ LVM2/tools/vgcreate.c 2009/05/13 13:02:56 1.60 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -51,7 +51,7 @@ return ECMD_FAILED; } - if (!lock_vol(cmd, vp_new.vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) { + if (!lock_vol(cmd, vp_new.vg_name, LCK_VG_WRITE)) { log_error("Can't get lock for %s", vp_new.vg_name); unlock_vg(cmd, VG_ORPHANS); return ECMD_FAILED; --- LVM2/tools/vgextend.c 2009/04/10 10:01:39 1.38 +++ LVM2/tools/vgextend.c 2009/05/13 13:02:56 1.39 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -42,7 +42,7 @@ } log_verbose("Checking for volume group \"%s\"", vg_name); - if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE | LCK_NONBLOCK, + if (!(vg = vg_lock_and_read(cmd, vg_name, NULL, LCK_VG_WRITE, CLUSTERED | EXPORTED_VG | LVM_WRITE | RESIZEABLE_VG, CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { --- LVM2/tools/vgmerge.c 2009/05/12 19:12:10 1.52 +++ LVM2/tools/vgmerge.c 2009/05/13 13:02:56 1.53 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -35,7 +35,7 @@ log_verbose("Checking for volume group \"%s\"", vg_name_from); if (!(vg_from = vg_lock_and_read(cmd, vg_name_from, NULL, - LCK_VG_WRITE | LCK_NONBLOCK, + LCK_VG_WRITE, CLUSTERED | EXPORTED_VG | LVM_WRITE, CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { unlock_release_vg(cmd, vg_to, vg_name_to); --- LVM2/tools/vgreduce.c 2009/04/22 17:00:31 1.89 +++ LVM2/tools/vgreduce.c 2009/05/13 13:02:56 1.90 @@ -397,7 +397,7 @@ return ECMD_FAILED; } - if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE | LCK_NONBLOCK)) { + if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) { log_error("Can't get lock for orphan PVs"); return ECMD_FAILED; } --- LVM2/tools/vgremove.c 2008/01/30 14:00:02 1.46 +++ LVM2/tools/vgremove.c 2009/05/13 13:02:56 1.47 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -41,7 +41,7 @@ } ret = process_each_vg(cmd, argc, argv, - LCK_VG_WRITE | LCK_NONBLOCK, 1, + LCK_VG_WRITE, 1, NULL, &vgremove_single); unlock_vg(cmd, VG_ORPHANS); --- LVM2/tools/vgrename.c 2009/04/10 10:01:39 1.60 +++ LVM2/tools/vgrename.c 2009/05/13 13:02:56 1.61 @@ -100,7 +100,7 @@ log_verbose("Checking for new volume group \"%s\"", vg_name_new); - if (!lock_vol(cmd, vg_name_new, LCK_VG_WRITE | LCK_NONBLOCK)) { + if (!lock_vol(cmd, vg_name_new, LCK_VG_WRITE)) { unlock_release_vg(cmd, vg, vg_name_old); log_error("Can't get lock for %s", vg_name_new); return 0; --- LVM2/tools/vgsplit.c 2009/05/12 19:12:10 1.71 +++ LVM2/tools/vgsplit.c 2009/05/13 13:02:56 1.72 @@ -325,7 +325,7 @@ return ECMD_FAILED; log_verbose("Checking for new volume group \"%s\"", vg_name_to); - if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE | LCK_NONBLOCK)) { + if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) { log_error("Can't get lock for %s", vg_name_to); unlock_release_vg(cmd, vg_from, vg_name_from); return ECMD_FAILED; From zkabelac@sourceware.org Wed May 13 14:13:00 2009 From: zkabelac@sourceware.org (zkabelac@sourceware.org) Date: Wed, 13 May 2009 14:13:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/dev_manager.c Message-ID: <20090513141357.26343.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2009-05-13 14:13:55 Modified files: . : WHATS_NEW lib/activate : dev_manager.c Log message: Do not query nonexistent devices for readahead. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1102&r2=1.1103 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.147&r2=1.148 --- LVM2/WHATS_NEW 2009/05/13 13:02:52 1.1102 +++ LVM2/WHATS_NEW 2009/05/13 14:13:54 1.1103 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Do not query nonexistent devices for readahead. Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. Remove snapshot_count from VG and use function instead. Fix first_seg() call for empty segment list. --- LVM2/lib/activate/dev_manager.c 2009/05/07 12:01:21 1.147 +++ LVM2/lib/activate/dev_manager.c 2009/05/13 14:13:55 1.148 @@ -141,7 +141,7 @@ if (!dm_task_get_info(dmt, info)) goto_out; - if (with_read_ahead) { + if (with_read_ahead && info->exists) { if (!dm_task_get_read_ahead(dmt, read_ahead)) goto_out; } else if (read_ahead) From wysochanski@sourceware.org Wed May 13 19:18:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Wed, 13 May 2009 19:18:00 -0000 Subject: LVM2/test test-utils.sh Message-ID: <20090513191848.32327.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-13 19:18:47 Modified files: test : test-utils.sh Log message: Update test-utils to cope with ":" in device names and allow configurable names. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.11&r2=1.12 --- LVM2/test/test-utils.sh 2009/04/24 08:00:48 1.11 +++ LVM2/test/test-utils.sh 2009/05/13 19:18:47 1.12 @@ -33,7 +33,7 @@ test -n "$PREFIX" && { rm -rf $G_root_/dev/$PREFIX* while dmsetup table | grep -q ^$PREFIX; do - for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do + for s in `dmsetup table | grep ^$PREFIX| awk '{ print substr($1,1,length($1)-1) }'`; do dmsetup resume $s 2>/dev/null > /dev/null || true dmsetup remove $s 2>/dev/null > /dev/null || true done @@ -99,6 +99,8 @@ test -z "$n" && n=3 local devsize="$2" test -z "$devsize" && devsize=33 + local pvname="$3" + test -z "$pvname" && pvname="pv" prepare_loop $(($n*$devsize)) @@ -111,7 +113,7 @@ local size=$(($loopsz/$n)) for i in `seq 1 $n`; do - local name="${PREFIX}pv$i" + local name="${PREFIX}$pvname$i" local dev="$G_dev_/mapper/$name" eval "dev$i=$dev" devs="$devs $dev" From mbroz@sourceware.org Wed May 13 21:22:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:22:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format1/import-export.c l ... Message-ID: <20090513212200.26257.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:21:59 Modified files: . : WHATS_NEW lib/format1 : import-export.c lib/format_text: import_vsn1.c lib/metadata : metadata-exported.h snapshot_manip.c lib/snapshot : snapshot.c tools : lvconvert.c lvcreate.c Log message: Fix snapshot segment import to not use duplicate segments & replace. The snapshot segment (snapshotX) is created twice during the text metadata segment processing. This can cause temporary violation of max_lv count. Simplify the code, snapshot segment is properly initialized in init_snapshot_seg function now and do not need to be replaced by vg_add_snapshot call. The vg_add_snapshot() is now usefull only for adding new snapshot and it shares the same initialization function. The snapshot name is always generated, name paramater can be removed from function call. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1103&r2=1.1104 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.66&r2=1.67 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.185&r2=1.186 --- LVM2/WHATS_NEW 2009/05/13 14:13:54 1.1103 +++ LVM2/WHATS_NEW 2009/05/13 21:21:58 1.1104 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix snapshot segment import to not use duplicate segments & replace. Do not query nonexistent devices for readahead. Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. Remove snapshot_count from VG and use function instead. --- LVM2/lib/format1/import-export.c 2009/05/12 19:12:09 1.101 +++ LVM2/lib/format1/import-export.c 2009/05/13 21:21:58 1.102 @@ -616,7 +616,7 @@ continue; /* insert the snapshot */ - if (!vg_add_snapshot(NULL, org, cow, NULL, + if (!vg_add_snapshot(org, cow, NULL, org->le_count, lvd->lv_chunk_size)) { log_err("Couldn't add snapshot."); --- LVM2/lib/format_text/import_vsn1.c 2009/04/10 09:59:19 1.58 +++ LVM2/lib/format_text/import_vsn1.c 2009/05/13 21:21:58 1.59 @@ -603,16 +603,6 @@ lv->size = (uint64_t) lv->le_count * (uint64_t) vg->extent_size; - /* - * FIXME We now have 2 LVs for each snapshot. The real one was - * created by vg_add_snapshot from the segment text_import. - */ - if (lv->status & SNAPSHOT) { - vg->lv_count--; - dm_list_del(&lvl->list); - return 1; - } - lv->minor = -1; if ((lv->status & FIXED_MINOR) && !_read_int32(lvn, "minor", &lv->minor)) { --- LVM2/lib/metadata/metadata-exported.h 2009/05/12 19:12:09 1.66 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:21:58 1.67 @@ -545,8 +545,10 @@ /* Given a cow LV, return its origin */ struct logical_volume *origin_from_cow(const struct logical_volume *lv); -int vg_add_snapshot(const char *name, - struct logical_volume *origin, struct logical_volume *cow, +void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, + struct logical_volume *cow, uint32_t chunk_size); + +int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow, union lvid *lvid, uint32_t extent_count, uint32_t chunk_size); --- LVM2/lib/metadata/snapshot_manip.c 2009/05/12 19:12:10 1.36 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:21:58 1.37 @@ -62,7 +62,31 @@ return lv->snapshot->origin; } -int vg_add_snapshot(const char *name, struct logical_volume *origin, +void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, + struct logical_volume *cow, uint32_t chunk_size) +{ + seg->chunk_size = chunk_size; + seg->origin = origin; + seg->cow = cow; + + // FIXME: direct count manipulation to be removed later + cow->status &= ~VISIBLE_LV; + cow->vg->lv_count--; + cow->snapshot = seg; + + origin->origin_count++; + origin->vg->lv_count--; + + /* FIXME Assumes an invisible origin belongs to a sparse device */ + if (!lv_is_visible(origin)) + origin->status |= VIRTUAL_ORIGIN; + + seg->lv->status |= (SNAPSHOT | VIRTUAL); + + dm_list_add(&origin->snapshot_segs, &seg->origin_list); +} + +int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow, union lvid *lvid, uint32_t extent_count, uint32_t chunk_size) { @@ -82,39 +106,18 @@ return 0; } - /* - * Set origin lv count in advance to prevent fail because - * of temporary violation of LV limits. - */ - origin->vg->lv_count--; - - if (!(snap = lv_create_empty(name ? name : "snapshot%d", + if (!(snap = lv_create_empty("snapshot%d", lvid, LVM_READ | LVM_WRITE | VISIBLE_LV, - ALLOC_INHERIT, 1, origin->vg))) { - origin->vg->lv_count++; + ALLOC_INHERIT, 1, origin->vg))) return_0; - } snap->le_count = extent_count; if (!(seg = alloc_snapshot_seg(snap, 0, 0))) return_0; - seg->chunk_size = chunk_size; - seg->origin = origin; - seg->cow = cow; - seg->lv->status |= SNAPSHOT; - - origin->origin_count++; - cow->snapshot = seg; - - cow->status &= ~VISIBLE_LV; - - /* FIXME Assumes an invisible origin belongs to a sparse device */ - if (!lv_is_visible(origin)) - origin->status |= VIRTUAL_ORIGIN; - - dm_list_add(&origin->snapshot_segs, &seg->origin_list); + origin->vg->lv_count++; + init_snapshot_seg(seg, origin, cow, chunk_size); return 1; } --- LVM2/lib/snapshot/snapshot.c 2009/04/02 21:34:41 1.36 +++ LVM2/lib/snapshot/snapshot.c 2009/05/13 21:21:58 1.37 @@ -39,8 +39,6 @@ struct logical_volume *org, *cow; int old_suppress; - seg->lv->status |= SNAPSHOT; - if (!get_config_uint32(sn, "chunk_size", &chunk_size)) { log_error("Couldn't read chunk size for snapshot."); return 0; @@ -74,9 +72,7 @@ return 0; } - if (!vg_add_snapshot(seg->lv->name, org, cow, - &seg->lv->lvid, seg->len, chunk_size)) - return_0; + init_snapshot_seg(seg, org, cow, chunk_size); return 1; } --- LVM2/tools/lvconvert.c 2009/04/29 20:11:46 1.72 +++ LVM2/tools/lvconvert.c 2009/05/13 21:21:59 1.73 @@ -760,8 +760,7 @@ return 0; } - if (!vg_add_snapshot(NULL, org, lv, NULL, org->le_count, - lp->chunk_size)) { + if (!vg_add_snapshot(org, lv, NULL, org->le_count, lp->chunk_size)) { log_error("Couldn't create snapshot."); return 0; } --- LVM2/tools/lvcreate.c 2009/04/29 20:14:21 1.185 +++ LVM2/tools/lvcreate.c 2009/05/13 21:21:59 1.186 @@ -918,7 +918,7 @@ /* cow LV remains active and becomes snapshot LV */ - if (!vg_add_snapshot(NULL, org, lv, NULL, + if (!vg_add_snapshot(org, lv, NULL, org->le_count, lp->chunk_size)) { log_error("Couldn't create snapshot."); goto deactivate_and_revert_new_lv; From mbroz@sourceware.org Wed May 13 21:22:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:22:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format1/import-export.c l ... Message-ID: <20090513212259.26543.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:22:58 Modified files: . : WHATS_NEW lib/format1 : import-export.c lib/format_pool: format_pool.c import_export.c lib/format_text: import_vsn1.c lib/metadata : lv_manip.c metadata-exported.h metadata.c snapshot_manip.c tools : vgchange.c vgmerge.c vgsplit.c Log message: Remove vg->lv_count and use counter function. This should not cause problems but simplifies code a lot. (the volumes_count is merged and renamed with lvs_visible function by following patch.) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1104&r2=1.1105 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.102&r2=1.103 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/import_export.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.166&r2=1.167 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.67&r2=1.68 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.216&r2=1.217 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.69&r2=1.70 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 --- LVM2/WHATS_NEW 2009/05/13 21:21:58 1.1104 +++ LVM2/WHATS_NEW 2009/05/13 21:22:57 1.1105 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Remove lv_count from VG and use counter function instead. Fix snapshot segment import to not use duplicate segments & replace. Do not query nonexistent devices for readahead. Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. --- LVM2/lib/format1/import-export.c 2009/05/13 21:21:58 1.102 +++ LVM2/lib/format1/import-export.c 2009/05/13 21:22:57 1.103 @@ -282,7 +282,7 @@ vgd->vg_status |= VG_EXTENDABLE; vgd->lv_max = vg->max_lv; - vgd->lv_cur = vg->lv_count + snapshot_count(vg); + vgd->lv_cur = volumes_count(vg) + snapshot_count(vg); vgd->pv_max = vg->max_pv; vgd->pv_cur = vg->pv_count; @@ -469,7 +469,6 @@ return_NULL; dm_list_add(&vg->lvs, &ll->list); - vg->lv_count++; return lv; } --- LVM2/lib/format_pool/format_pool.c 2009/05/12 19:12:09 1.22 +++ LVM2/lib/format_pool/format_pool.c 2009/05/13 21:22:57 1.23 @@ -119,7 +119,6 @@ vg->status = 0; vg->extent_count = 0; vg->pv_count = 0; - vg->lv_count = 0; vg->seqno = 1; vg->system_id = NULL; dm_list_init(&vg->pvs); --- LVM2/lib/format_pool/import_export.c 2008/11/03 22:14:28 1.25 +++ LVM2/lib/format_pool/import_export.c 2009/05/13 21:22:57 1.26 @@ -49,7 +49,6 @@ vg->max_lv = 1; vg->max_pv = POOL_MAX_DEVICES; vg->alloc = ALLOC_NORMAL; - vg->lv_count = 0; } return 1; @@ -117,7 +116,6 @@ lv->le_count = lv->size / POOL_PE_SIZE; lvl->lv = lv; dm_list_add(&vg->lvs, &lvl->list); - vg->lv_count++; return 1; } --- LVM2/lib/format_text/import_vsn1.c 2009/05/13 21:21:58 1.59 +++ LVM2/lib/format_text/import_vsn1.c 2009/05/13 21:22:57 1.60 @@ -562,7 +562,6 @@ } lv->vg = vg; - vg->lv_count++; dm_list_add(&vg->lvs, &lvl->list); return 1; --- LVM2/lib/metadata/lv_manip.c 2009/04/21 14:31:58 1.166 +++ LVM2/lib/metadata/lv_manip.c 2009/05/13 21:22:57 1.167 @@ -438,9 +438,6 @@ return_0; dm_list_del(&lvl->list); - - if (!(lv->status & SNAPSHOT)) - lv->vg->lv_count--; } else if (lv->vg->fid->fmt->ops->lv_setup && !lv->vg->fid->fmt->ops->lv_setup(lv->vg->fid, lv)) return_0; @@ -1827,7 +1824,7 @@ struct logical_volume *lv; char dname[NAME_LEN]; - if (vg->max_lv && (vg->max_lv == vg->lv_count)) { + if (vg->max_lv && (vg->max_lv == volumes_count(vg))) { log_error("Maximum number of logical volumes (%u) reached " "in volume group %s", vg->max_lv, vg->name); return NULL; @@ -1883,9 +1880,6 @@ return_NULL; } - if (!import) - vg->lv_count++; - dm_list_add(&vg->lvs, &ll->list); return lv; --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:21:58 1.67 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:22:57 1.68 @@ -251,7 +251,6 @@ * - one for the user-visible mirror LV * all of the instances are reflected in lv_count. */ - uint32_t lv_count; struct dm_list lvs; struct dm_list tags; @@ -556,6 +555,8 @@ int vg_check_status(const struct volume_group *vg, uint32_t status); +unsigned volumes_count(const struct volume_group *vg); + /* * Mirroring functions */ --- LVM2/lib/metadata/metadata.c 2009/05/13 01:48:18 1.216 +++ LVM2/lib/metadata/metadata.c 2009/05/13 21:22:57 1.217 @@ -571,7 +571,6 @@ vg->pv_count = 0; dm_list_init(&vg->pvs); - vg->lv_count = 0; dm_list_init(&vg->lvs); dm_list_init(&vg->tags); @@ -1165,6 +1164,22 @@ return num_snapshots; } +unsigned volumes_count(const struct volume_group *vg) +{ + struct lv_list *lvl; + unsigned lv_count = 0; + + dm_list_iterate_items(lvl, &vg->lvs) { + if (lv_is_cow(lvl->lv)) + continue; + if (lvl->lv->status & SNAPSHOT) + continue; + lv_count++; + } + + return lv_count; +} + /* * Determine whether two vgs are compatible for merging. */ @@ -1199,7 +1214,7 @@ } if (vg_to->max_lv && - (vg_to->max_lv < vg_to->lv_count + vg_from->lv_count)) { + (vg_to->max_lv < volumes_count(vg_to) + volumes_count(vg_from))) { log_error("Maximum number of logical volumes (%d) exceeded " " for \"%s\" and \"%s\"", vg_to->max_lv, vg_to->name, vg_from->name); @@ -1455,10 +1470,10 @@ } if ((lv_count = (uint32_t) dm_list_size(&vg->lvs)) != - vg->lv_count + 2 * snapshot_count(vg)) { + volumes_count(vg) + 2 * snapshot_count(vg)) { log_error("Internal error: #internal LVs (%u) != #LVs (%" PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s", - dm_list_size(&vg->lvs), vg->lv_count, + dm_list_size(&vg->lvs), volumes_count(vg), snapshot_count(vg), vg->name); r = 0; } @@ -1502,10 +1517,10 @@ r = 0; } - if (vg->max_lv && (vg->max_lv < vg->lv_count)) { + if (vg->max_lv && (vg->max_lv < volumes_count(vg))) { log_error("Internal error: Volume group %s contains %u volumes" " but the limit is set to %u.", - vg->name, vg->lv_count, vg->max_lv); + vg->name, volumes_count(vg), vg->max_lv); r = 0; } --- LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:21:58 1.37 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:22:57 1.38 @@ -69,13 +69,10 @@ seg->origin = origin; seg->cow = cow; - // FIXME: direct count manipulation to be removed later cow->status &= ~VISIBLE_LV; - cow->vg->lv_count--; cow->snapshot = seg; origin->origin_count++; - origin->vg->lv_count--; /* FIXME Assumes an invisible origin belongs to a sparse device */ if (!lv_is_visible(origin)) @@ -116,7 +113,6 @@ if (!(seg = alloc_snapshot_seg(snap, 0, 0))) return_0; - origin->vg->lv_count++; init_snapshot_seg(seg, origin, cow, chunk_size); return 1; @@ -134,8 +130,6 @@ } cow->snapshot = NULL; - - cow->vg->lv_count++; cow->status |= VISIBLE_LV; return 1; --- LVM2/tools/vgchange.c 2009/04/10 10:01:38 1.69 +++ LVM2/tools/vgchange.c 2009/05/13 21:22:57 1.70 @@ -308,9 +308,9 @@ } } - if (max_lv && max_lv < vg->lv_count) { + if (max_lv && max_lv < volumes_count(vg)) { log_error("MaxLogicalVolume is less than the current number " - "%d of LVs for \"%s\"", vg->lv_count, + "%d of LVs for %s", volumes_count(vg), vg->name); return ECMD_FAILED; } --- LVM2/tools/vgmerge.c 2009/05/13 13:02:56 1.53 +++ LVM2/tools/vgmerge.c 2009/05/13 21:22:57 1.54 @@ -101,7 +101,6 @@ dm_list_move(&vg_to->fid->metadata_areas, mdah); } - vg_to->lv_count += vg_from->lv_count; vg_to->extent_count += vg_from->extent_count; vg_to->free_count += vg_from->free_count; --- LVM2/tools/vgsplit.c 2009/05/13 13:02:56 1.72 +++ LVM2/tools/vgsplit.c 2009/05/13 21:22:57 1.73 @@ -106,12 +106,8 @@ return 0; } - if (!(lv->status & SNAPSHOT) && !lv_is_cow(lv)) { - vg_from->lv_count--; - vg_to->lv_count++; - } return 1; -} +} static int _move_lvs(struct volume_group *vg_from, struct volume_group *vg_to) { From mbroz@sourceware.org Wed May 13 21:24:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:24:00 -0000 Subject: LVM2/lib/format1 disk-rep.h import-export.c Message-ID: <20090513212413.27092.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:24:12 Modified files: lib/format1 : disk-rep.h import-export.c Log message: Tidy format1 import LV function. Later patch initializes lv->vg after the LV structure is prepared, so pass through cmd context and do not use vg->cmd here. Also move LV id calculation (which uses lv->vg too). Also properly free memory pool if operation fails. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.h.diff?cvsroot=lvm2&r1=1.53&r2=1.54 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.103&r2=1.104 --- LVM2/lib/format1/disk-rep.h 2008/11/03 22:14:28 1.53 +++ LVM2/lib/format1/disk-rep.h 2009/05/13 21:24:12 1.54 @@ -215,7 +215,8 @@ struct volume_group *vg, struct disk_list *dl); int export_vg(struct vg_disk *vgd, struct volume_group *vg); -int import_lv(struct dm_pool *mem, struct logical_volume *lv, struct lv_disk *lvd); +int import_lv(struct cmd_context *cmd, struct dm_pool *mem, + struct logical_volume *lv, struct lv_disk *lvd); int import_extents(struct cmd_context *cmd, struct volume_group *vg, struct dm_list *pvds); --- LVM2/lib/format1/import-export.c 2009/05/13 21:22:57 1.103 +++ LVM2/lib/format1/import-export.c 2009/05/13 21:24:12 1.104 @@ -294,10 +294,9 @@ return 1; } -int import_lv(struct dm_pool *mem, struct logical_volume *lv, struct lv_disk *lvd) +int import_lv(struct cmd_context *cmd, struct dm_pool *mem, + struct logical_volume *lv, struct lv_disk *lvd) { - lvid_from_lvnum(&lv->lvid, &lv->vg->id, lvd->lv_number); - if (!(lv->name = _create_lv_name(mem, (char *)lvd->lv_name))) return_0; @@ -331,7 +330,7 @@ lv->alloc = ALLOC_NORMAL; if (!lvd->lv_read_ahead) - lv->read_ahead = lv->vg->cmd->default_settings.read_ahead; + lv->read_ahead = cmd->default_settings.read_ahead; else lv->read_ahead = lvd->lv_read_ahead; @@ -465,8 +464,12 @@ lv = ll->lv; lv->vg = vg; - if (!import_lv(mem, lv, lvd)) + lvid_from_lvnum(&lv->lvid, &vg->id, lvd->lv_number); + + if (!import_lv(vg->cmd, mem, lv, lvd)) { + dm_pool_free(mem, ll); return_NULL; + } dm_list_add(&vg->lvs, &ll->list); From mbroz@sourceware.org Wed May 13 21:25:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:25:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format1/import-export.c l ... Message-ID: <20090513212503.27423.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:25:02 Modified files: . : WHATS_NEW lib/format1 : import-export.c lib/format_pool: import_export.c lib/format_text: import_vsn1.c lib/metadata : lv_manip.c metadata-exported.h Log message: Introduce link_lv_to_vg and unlink_lv_from_vg functions. link_lv_to_vg and unlink_lv_from_vg are the only functions for adding/removing logical volume from volume group. Only these function should manipulate with vg->lvs list. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1105&r2=1.1106 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.104&r2=1.105 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/import_export.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.167&r2=1.168 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.68&r2=1.69 --- LVM2/WHATS_NEW 2009/05/13 21:22:57 1.1105 +++ LVM2/WHATS_NEW 2009/05/13 21:25:01 1.1106 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Introduce link_lv_to_vg and unlink_lv_from_vg functions. Remove lv_count from VG and use counter function instead. Fix snapshot segment import to not use duplicate segments & replace. Do not query nonexistent devices for readahead. --- LVM2/lib/format1/import-export.c 2009/05/13 21:24:12 1.104 +++ LVM2/lib/format1/import-export.c 2009/05/13 21:25:01 1.105 @@ -455,25 +455,23 @@ struct volume_group *vg, struct lv_disk *lvd) { - struct lv_list *ll; struct logical_volume *lv; - if (!(ll = dm_pool_zalloc(mem, sizeof(*ll))) || - !(ll->lv = dm_pool_zalloc(mem, sizeof(*ll->lv)))) + if (!(lv = dm_pool_zalloc(mem, sizeof(*lv)))) return_NULL; - lv = ll->lv; - lv->vg = vg; lvid_from_lvnum(&lv->lvid, &vg->id, lvd->lv_number); - if (!import_lv(vg->cmd, mem, lv, lvd)) { - dm_pool_free(mem, ll); - return_NULL; - } + if (!import_lv(vg->cmd, mem, lv, lvd)) + goto_bad; - dm_list_add(&vg->lvs, &ll->list); + if (!link_lv_to_vg(vg, lv)) + goto_bad; return lv; +bad: + dm_pool_free(mem, lv); + return NULL; } int import_lvs(struct dm_pool *mem, struct volume_group *vg, struct dm_list *pvds) --- LVM2/lib/format_pool/import_export.c 2009/05/13 21:22:57 1.26 +++ LVM2/lib/format_pool/import_export.c 2009/05/13 21:25:02 1.27 @@ -57,22 +57,14 @@ int import_pool_lvs(struct volume_group *vg, struct dm_pool *mem, struct dm_list *pls) { struct pool_list *pl; - struct lv_list *lvl = dm_pool_zalloc(mem, sizeof(*lvl)); struct logical_volume *lv; - if (!lvl) { - log_error("Unable to allocate lv list structure"); - return 0; - } - - if (!(lvl->lv = dm_pool_zalloc(mem, sizeof(*lvl->lv)))) { + if (!(lv = dm_pool_zalloc(mem, sizeof(*lv)))) { log_error("Unable to allocate logical volume structure"); return 0; } - lv = lvl->lv; lv->status = 0; - lv->vg = vg; lv->alloc = ALLOC_NORMAL; lv->size = 0; lv->name = NULL; @@ -114,10 +106,8 @@ } lv->le_count = lv->size / POOL_PE_SIZE; - lvl->lv = lv; - dm_list_add(&vg->lvs, &lvl->list); - return 1; + return link_lv_to_vg(vg, lv); } int import_pool_pvs(const struct format_type *fmt, struct volume_group *vg, --- LVM2/lib/format_text/import_vsn1.c 2009/05/13 21:22:57 1.60 +++ LVM2/lib/format_text/import_vsn1.c 2009/05/13 21:25:02 1.61 @@ -495,15 +495,11 @@ struct dm_hash_table *pv_hash __attribute((unused))) { struct logical_volume *lv; - struct lv_list *lvl; struct config_node *cn; - if (!(lvl = dm_pool_zalloc(mem, sizeof(*lvl))) || - !(lvl->lv = dm_pool_zalloc(mem, sizeof(*lvl->lv)))) + if (!(lv = dm_pool_zalloc(mem, sizeof(*lv)))) return_0; - lv = lvl->lv; - if (!(lv->name = dm_pool_strdup(mem, lvn->key))) return_0; @@ -561,10 +557,7 @@ return 0; } - lv->vg = vg; - dm_list_add(&vg->lvs, &lvl->list); - - return 1; + return link_lv_to_vg(vg, lv); } static int _read_lvsegs(struct format_instance *fid __attribute((unused)), --- LVM2/lib/metadata/lv_manip.c 2009/05/13 21:22:57 1.167 +++ LVM2/lib/metadata/lv_manip.c 2009/05/13 21:25:02 1.168 @@ -402,7 +402,6 @@ */ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete) { - struct lv_list *lvl; struct lv_segment *seg; uint32_t count = extents; uint32_t reduction; @@ -433,12 +432,9 @@ return 1; /* Remove the LV if it is now empty */ - if (!lv->le_count) { - if (!(lvl = find_lv_in_vg(lv->vg, lv->name))) - return_0; - - dm_list_del(&lvl->list); - } else if (lv->vg->fid->fmt->ops->lv_setup && + if (!lv->le_count && !unlink_lv_from_vg(lv)) + return_0; + else if (lv->vg->fid->fmt->ops->lv_setup && !lv->vg->fid->fmt->ops->lv_setup(lv->vg->fid, lv)) return_0; @@ -1819,8 +1815,6 @@ struct volume_group *vg) { struct format_instance *fi = vg->fid; - struct cmd_context *cmd = vg->cmd; - struct lv_list *ll = NULL; struct logical_volume *lv; char dname[NAME_LEN]; @@ -1840,23 +1834,11 @@ if (!import) log_verbose("Creating logical volume %s", name); - if (!(ll = dm_pool_zalloc(cmd->mem, sizeof(*ll))) || - !(ll->lv = dm_pool_zalloc(cmd->mem, sizeof(*ll->lv)))) { - log_error("lv_list allocation failed"); - if (ll) - dm_pool_free(cmd->mem, ll); - return NULL; - } + if (!(lv = dm_pool_zalloc(vg->vgmem, sizeof(*lv)))) + return_NULL; - lv = ll->lv; - lv->vg = vg; - - if (!(lv->name = dm_pool_strdup(cmd->mem, name))) { - log_error("lv name strdup failed"); - if (ll) - dm_pool_free(cmd->mem, ll); - return NULL; - } + if (!(lv->name = dm_pool_strdup(vg->vgmem, name))) + goto_bad; lv->status = status; lv->alloc = alloc; @@ -1874,15 +1856,16 @@ if (lvid) lv->lvid = *lvid; - if (fi->fmt->ops->lv_setup && !fi->fmt->ops->lv_setup(fi, lv)) { - if (ll) - dm_pool_free(cmd->mem, ll); - return_NULL; - } - - dm_list_add(&vg->lvs, &ll->list); - + if (!link_lv_to_vg(vg, lv)) + goto_bad; + + if (fi->fmt->ops->lv_setup && !fi->fmt->ops->lv_setup(fi, lv)) + goto_bad; + return lv; +bad: + dm_pool_free(vg->vgmem, lv); + return NULL; } static int _add_pvs(struct cmd_context *cmd, struct pv_segment *peg, @@ -1951,6 +1934,32 @@ return parallel_areas; } +int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv) +{ + struct lv_list *lvl; + + if (!(lvl = dm_pool_zalloc(vg->vgmem, sizeof(*lvl)))) + return_0; + + lvl->lv = lv; + lv->vg = vg; + dm_list_add(&vg->lvs, &lvl->list); + + return 1; +} + +int unlink_lv_from_vg(struct logical_volume *lv) +{ + struct lv_list *lvl; + + if (!(lvl = find_lv_in_vg(lv->vg, lv->name))) + return_0; + + dm_list_del(&lvl->list); + + return 1; +} + int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, const force_t force) { --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:22:57 1.68 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:25:02 1.69 @@ -368,6 +368,12 @@ int warnings, int scan_label_only); struct dm_list *get_pvs(struct cmd_context *cmd); +/* + * Add/remove LV to/from volume group + */ +int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv); +int unlink_lv_from_vg(struct logical_volume *lv); + /* Set full_scan to 1 to re-read every (filtered) device label */ struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan); struct dm_list *get_vgids(struct cmd_context *cmd, int full_scan); From mbroz@sourceware.org Wed May 13 21:25:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:25:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/snapshot_manip.c Message-ID: <20090513212546.27791.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:25:46 Modified files: . : WHATS_NEW lib/metadata : snapshot_manip.c Log message: Fix lv_is_visible to handle virtual origin. Snapshot is visible if its origin is marked visible, or if the origin is virtual. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1106&r2=1.1107 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39 --- LVM2/WHATS_NEW 2009/05/13 21:25:01 1.1106 +++ LVM2/WHATS_NEW 2009/05/13 21:25:45 1.1107 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix lv_is_visible to handle virtual origin. Introduce link_lv_to_vg and unlink_lv_from_vg functions. Remove lv_count from VG and use counter function instead. Fix snapshot segment import to not use duplicate segments & replace. --- LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:22:57 1.38 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:25:46 1.39 @@ -30,8 +30,15 @@ int lv_is_visible(const struct logical_volume *lv) { - if (lv_is_cow(lv)) - return lv_is_visible(find_cow(lv)->lv); + if (lv->status & SNAPSHOT) + return 0; + + if (lv_is_cow(lv)) { + if (lv_is_virtual_origin(origin_from_cow(lv))) + return 1; + + return lv_is_visible(origin_from_cow(lv)); + } return lv->status & VISIBLE_LV ? 1 : 0; } From mbroz@sourceware.org Wed May 13 21:26:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:26:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/m ... Message-ID: <20090513212646.28822.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:26:45 Modified files: . : WHATS_NEW lib/activate : activate.c lib/metadata : lv_manip.c metadata-exported.h mirror.c snapshot_manip.c Log message: Introduce lv_set_visible & lv_set_invisible and use lv_is_visible always. The vg->lv_count parameter now includes always number of visible logical volumes. Note that virtual snapshot volume (snapshotX) is never visible, but it is stored in metadata with visible flag. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1107&r2=1.1108 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.145&r2=1.146 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.168&r2=1.169 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.69&r2=1.70 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40 --- LVM2/WHATS_NEW 2009/05/13 21:25:45 1.1107 +++ LVM2/WHATS_NEW 2009/05/13 21:26:45 1.1108 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Introduce lv_set_visible & lv_set_invisible functions. Fix lv_is_visible to handle virtual origin. Introduce link_lv_to_vg and unlink_lv_from_vg functions. Remove lv_count from VG and use counter function instead. --- LVM2/lib/activate/activate.c 2009/04/10 10:00:04 1.145 +++ LVM2/lib/activate/activate.c 2009/05/13 21:26:45 1.146 @@ -647,7 +647,7 @@ return 0; dm_list_iterate_items(lvl, &vg->lvs) { - if (lvl->lv->status & VISIBLE_LV) + if (lv_is_visible(lvl->lv)) count += (_lv_active(vg->cmd, lvl->lv, by_uuid_only) == 1); } @@ -996,7 +996,7 @@ goto out; } - if (info.open_count && (lv->status & VISIBLE_LV)) { + if (info.open_count && lv_is_visible(lv)) { log_error("LV %s/%s in use: not deactivating", lv->vg->name, lv->name); goto out; --- LVM2/lib/metadata/lv_manip.c 2009/05/13 21:25:02 1.168 +++ LVM2/lib/metadata/lv_manip.c 2009/05/13 21:26:45 1.169 @@ -1503,7 +1503,7 @@ if (!set_lv_segment_area_lv(seg, m, sub_lvs[m - old_area_count], 0, status)) return_0; - sub_lvs[m - old_area_count]->status &= ~VISIBLE_LV; + lv_set_invisible(sub_lvs[m - old_area_count]); } lv->status |= MIRRORED; @@ -1960,6 +1960,26 @@ return 1; } +void lv_set_visible(struct logical_volume *lv) +{ + if (lv_is_visible(lv)) + return; + + lv->status |= VISIBLE_LV; + + log_debug("LV %s in VG %s is now visible.", lv->name, lv->vg->name); +} + +void lv_set_invisible(struct logical_volume *lv) +{ + if (!lv_is_visible(lv)) + return; + + lv->status &= ~VISIBLE_LV; + + log_debug("LV %s in VG %s is now invisible.", lv->name, lv->vg->name); +} + int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, const force_t force) { --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:25:02 1.69 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:26:45 1.70 @@ -373,6 +373,8 @@ */ int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv); int unlink_lv_from_vg(struct logical_volume *lv); +void lv_set_visible(struct logical_volume *lv); +void lv_set_invisible(struct logical_volume *lv); /* Set full_scan to 1 to re-read every (filtered) device label */ struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan); --- LVM2/lib/metadata/mirror.c 2009/04/23 16:43:01 1.85 +++ LVM2/lib/metadata/mirror.c 2009/05/13 21:26:45 1.86 @@ -260,7 +260,7 @@ } /* Temporary make it visible for set_lv() */ - log_lv->status |= VISIBLE_LV; + lv_set_visible(log_lv); /* Temporary tag mirror log for activation */ dm_list_iterate_items(sl, tags) @@ -303,7 +303,7 @@ return 0; } - log_lv->status &= ~VISIBLE_LV; + lv_set_invisible(log_lv); if (was_active && !activate_lv(cmd, log_lv)) return_0; @@ -410,7 +410,7 @@ log_lv = mirrored_seg->log_lv; mirrored_seg->log_lv = NULL; - log_lv->status |= VISIBLE_LV; + lv_set_visible(log_lv); log_lv->status &= ~MIRROR_LOG; remove_seg_from_segs_using_this_lv(log_lv, mirrored_seg); @@ -536,7 +536,7 @@ dm_list_init(&tmp_orphan_lvs); for (m = new_area_count; m < mirrored_seg->area_count; m++) { seg_lv(mirrored_seg, m)->status &= ~MIRROR_IMAGE; - seg_lv(mirrored_seg, m)->status |= VISIBLE_LV; + lv_set_visible(seg_lv(mirrored_seg, m)); if (!(lvl = dm_pool_alloc(lv->vg->cmd->mem, sizeof(*lvl)))) { log_error("lv_list alloc failed"); return 0; @@ -554,7 +554,7 @@ if (new_area_count == 1 && !is_temporary_mirror_layer(lv)) { lv1 = seg_lv(mirrored_seg, 0); lv1->status &= ~MIRROR_IMAGE; - lv1->status |= VISIBLE_LV; + lv_set_visible(lv1); detached_log_lv = detach_mirror_log(mirrored_seg); if (!remove_layer_from_lv(lv, lv1)) return_0; @@ -1340,7 +1340,7 @@ { seg->log_lv = log_lv; log_lv->status |= MIRROR_LOG; - log_lv->status &= ~VISIBLE_LV; + lv_set_invisible(log_lv); return add_seg_to_segs_using_this_lv(log_lv, seg); } --- LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:25:46 1.39 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:26:45 1.40 @@ -76,7 +76,8 @@ seg->origin = origin; seg->cow = cow; - cow->status &= ~VISIBLE_LV; + lv_set_invisible(cow); + cow->snapshot = seg; origin->origin_count++; @@ -137,7 +138,7 @@ } cow->snapshot = NULL; - cow->status |= VISIBLE_LV; + lv_set_visible(cow); return 1; } From mbroz@sourceware.org Wed May 13 21:27:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:27:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/d ... Message-ID: <20090513212747.29680.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:27:45 Modified files: . : WHATS_NEW lib/activate : activate.c lib/display : display.c lib/format1 : import-export.c lib/format_text: export.c lib/metadata : lv_manip.c metadata-exported.h metadata.c metadata.h snapshot_manip.c lib/report : report.c tools : lvchange.c lvdisplay.c lvscan.c reporter.c vgchange.c Log message: Merge lv_is_displayable and lv_is_visible. Displayable and visible is the same thing. volumes_count(vg) is now vg_visible_lvs() and always returns number of LVs from user perspective. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1108&r2=1.1109 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.105&r2=1.106 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.169&r2=1.170 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.70&r2=1.71 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.217&r2=1.218 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.193&r2=1.194 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.99&r2=1.100 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvdisplay.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvscan.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71 --- LVM2/WHATS_NEW 2009/05/13 21:26:45 1.1108 +++ LVM2/WHATS_NEW 2009/05/13 21:27:43 1.1109 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Merge lv_is_displayable and lv_is_visible functions. Introduce lv_set_visible & lv_set_invisible functions. Fix lv_is_visible to handle virtual origin. Introduce link_lv_to_vg and unlink_lv_from_vg functions. --- LVM2/lib/activate/activate.c 2009/05/13 21:26:45 1.146 +++ LVM2/lib/activate/activate.c 2009/05/13 21:27:43 1.147 @@ -673,7 +673,7 @@ return 0; dm_list_iterate_items(lvl, &vg->lvs) { - if (lv_is_displayable(lvl->lv)) + if (lv_is_visible(lvl->lv)) count += (_lv_open_count(vg->cmd, lvl->lv) > 0); } --- LVM2/lib/display/display.c 2008/12/04 15:54:27 1.96 +++ LVM2/lib/display/display.c 2009/05/13 21:27:43 1.97 @@ -606,7 +606,7 @@ } log_print("MAX LV %u", vg->max_lv); - log_print("Cur LV %u", displayable_lvs_in_vg(vg)); + log_print("Cur LV %u", vg_visible_lvs(vg)); log_print("Open LV %u", lvs_in_vg_opened(vg)); /****** FIXME Max LV Size log_print ( "MAX LV Size %s", @@ -681,7 +681,7 @@ vg->status, /* internal volume group number; obsolete */ vg->max_lv, - displayable_lvs_in_vg(vg), + vg_visible_lvs(vg), lvs_in_vg_opened(vg), /* FIXME: maximum logical volume size */ vg->max_pv, --- LVM2/lib/format1/import-export.c 2009/05/13 21:25:01 1.105 +++ LVM2/lib/format1/import-export.c 2009/05/13 21:27:43 1.106 @@ -282,7 +282,7 @@ vgd->vg_status |= VG_EXTENDABLE; vgd->lv_max = vg->max_lv; - vgd->lv_cur = volumes_count(vg) + snapshot_count(vg); + vgd->lv_cur = vg_visible_lvs(vg) + snapshot_count(vg); vgd->pv_max = vg->max_pv; vgd->pv_cur = vg->pv_count; --- LVM2/lib/format_text/export.c 2009/02/22 22:11:58 1.67 +++ LVM2/lib/format_text/export.c 2009/05/13 21:27:43 1.68 @@ -592,14 +592,14 @@ * Write visible LVs first */ dm_list_iterate_items(lvl, &vg->lvs) { - if (!(lv_is_displayable(lvl->lv))) + if (!(lv_is_visible(lvl->lv))) continue; if (!_print_lv(f, lvl->lv)) return_0; } dm_list_iterate_items(lvl, &vg->lvs) { - if ((lv_is_displayable(lvl->lv))) + if ((lv_is_visible(lvl->lv))) continue; if (!_print_lv(f, lvl->lv)) return_0; --- LVM2/lib/metadata/lv_manip.c 2009/05/13 21:26:45 1.169 +++ LVM2/lib/metadata/lv_manip.c 2009/05/13 21:27:43 1.170 @@ -1732,7 +1732,7 @@ int r = 0; /* rename is not allowed on sub LVs */ - if (!lv_is_displayable(lv)) { + if (!lv_is_visible(lv)) { log_error("Cannot rename internal LV \"%s\".", lv->name); return 0; } @@ -1818,7 +1818,7 @@ struct logical_volume *lv; char dname[NAME_LEN]; - if (vg->max_lv && (vg->max_lv == volumes_count(vg))) { + if (vg->max_lv && (vg->max_lv == vg_visible_lvs(vg))) { log_error("Maximum number of logical volumes (%u) reached " "in volume group %s", vg->max_lv, vg->name); return NULL; --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:26:45 1.70 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:27:43 1.71 @@ -238,18 +238,16 @@ /* * logical volumes * The following relationship should always hold: - * dm_list_size(lvs) = lv_count + 2 * snapshot_count + * dm_list_size(lvs) = user visible lv_count + snapshot_count + other invisible LVs * * Snapshots consist of 2 instances of "struct logical_volume": * - cow (lv_name is visible to the user) * - snapshot (lv_name is 'snapshotN') - * Neither of these instances is reflected in lv_count. * * Mirrors consist of multiple instances of "struct logical_volume": * - one for the mirror log * - one for each mirror leg * - one for the user-visible mirror LV - * all of the instances are reflected in lv_count. */ struct dm_list lvs; @@ -539,10 +537,9 @@ int lv_is_origin(const struct logical_volume *lv); int lv_is_virtual_origin(const struct logical_volume *lv); int lv_is_cow(const struct logical_volume *lv); -int lv_is_visible(const struct logical_volume *lv); /* Test if given LV is visible from user's perspective */ -int lv_is_displayable(const struct logical_volume *lv); +int lv_is_visible(const struct logical_volume *lv); int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv); @@ -563,7 +560,10 @@ int vg_check_status(const struct volume_group *vg, uint32_t status); -unsigned volumes_count(const struct volume_group *vg); +/* + * Returns visible LV count - number of LVs from user perspective + */ +unsigned vg_visible_lvs(const struct volume_group *vg); /* * Mirroring functions --- LVM2/lib/metadata/metadata.c 2009/05/13 21:22:57 1.217 +++ LVM2/lib/metadata/metadata.c 2009/05/13 21:27:43 1.218 @@ -376,7 +376,7 @@ if (!vg_check_status(vg, EXPORTED_VG)) return 0; - lv_count = displayable_lvs_in_vg(vg); + lv_count = vg_visible_lvs(vg); if (lv_count) { if ((force == PROMPT) && @@ -391,8 +391,8 @@ return 0; } - lv_count = displayable_lvs_in_vg(vg); - + lv_count = vg_visible_lvs(vg); + if (lv_count) { log_error("Volume group \"%s\" still contains %u " "logical volume(s)", vg_name, lv_count); @@ -1140,18 +1140,6 @@ return 1; } -unsigned displayable_lvs_in_vg(const struct volume_group *vg) -{ - struct lv_list *lvl; - unsigned lv_count = 0; - - dm_list_iterate_items(lvl, &vg->lvs) - if (lv_is_displayable(lvl->lv)) - lv_count++; - - return lv_count; -} - unsigned snapshot_count(const struct volume_group *vg) { struct lv_list *lvl; @@ -1164,17 +1152,14 @@ return num_snapshots; } -unsigned volumes_count(const struct volume_group *vg) +unsigned vg_visible_lvs(const struct volume_group *vg) { struct lv_list *lvl; unsigned lv_count = 0; dm_list_iterate_items(lvl, &vg->lvs) { - if (lv_is_cow(lvl->lv)) - continue; - if (lvl->lv->status & SNAPSHOT) - continue; - lv_count++; + if (lv_is_visible(lvl->lv)) + lv_count++; } return lv_count; @@ -1214,7 +1199,7 @@ } if (vg_to->max_lv && - (vg_to->max_lv < volumes_count(vg_to) + volumes_count(vg_from))) { + (vg_to->max_lv < vg_visible_lvs(vg_to) + vg_visible_lvs(vg_from))) { log_error("Maximum number of logical volumes (%d) exceeded " " for \"%s\" and \"%s\"", vg_to->max_lv, vg_to->name, vg_from->name); @@ -1469,12 +1454,38 @@ r = 0; } - if ((lv_count = (uint32_t) dm_list_size(&vg->lvs)) != - volumes_count(vg) + 2 * snapshot_count(vg)) { + /* + * Count all non-snapshot invisible LVs + */ + lv_count = 0; + dm_list_iterate_items(lvl, &vg->lvs) { + if (lvl->lv->status & VISIBLE_LV) + continue; + + /* snapshots */ + if (lv_is_cow(lvl->lv) || lv_is_origin(lvl->lv)) + continue; + + /* count other non-snapshot invisible volumes */ + lv_count++; + + /* + * FIXME: add check for unreferenced invisible LVs + * - snapshot cow & origin + * - mirror log & images + * - mirror conversion volumes (_mimagetmp*) + */ + } + + /* + * all volumes = visible LVs + snapshot_cows + invisible LVs + */ + if (((uint32_t) dm_list_size(&vg->lvs)) != + vg_visible_lvs(vg) + snapshot_count(vg) + lv_count) { log_error("Internal error: #internal LVs (%u) != #LVs (%" - PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s", - dm_list_size(&vg->lvs), volumes_count(vg), - snapshot_count(vg), vg->name); + PRIu32 ") + #snapshots (%" PRIu32 ") + #invisible LVs %u in VG %s", + dm_list_size(&vg->lvs), vg_visible_lvs(vg), + snapshot_count(vg), lv_count, vg->name); r = 0; } @@ -1517,10 +1528,10 @@ r = 0; } - if (vg->max_lv && (vg->max_lv < volumes_count(vg))) { + if (vg->max_lv && (vg->max_lv < vg_visible_lvs(vg))) { log_error("Internal error: Volume group %s contains %u volumes" " but the limit is set to %u.", - vg->name, volumes_count(vg), vg->max_lv); + vg->name, vg_visible_lvs(vg), vg->max_lv); r = 0; } --- LVM2/lib/metadata/metadata.h 2009/05/12 19:12:10 1.193 +++ LVM2/lib/metadata/metadata.h 2009/05/13 21:27:43 1.194 @@ -340,11 +340,6 @@ struct lv_segment *get_only_segment_using_this_lv(struct logical_volume *lv); /* - * Count LVs that are visible from user's perspective. - */ -unsigned displayable_lvs_in_vg(const struct volume_group *vg); - -/* * Count snapshot LVs. */ unsigned snapshot_count(const struct volume_group *vg); --- LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:26:45 1.40 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:27:43 1.41 @@ -43,14 +43,6 @@ return lv->status & VISIBLE_LV ? 1 : 0; } -int lv_is_displayable(const struct logical_volume *lv) -{ - if (lv->status & SNAPSHOT) - return 0; - - return (lv->status & VISIBLE_LV) || lv_is_cow(lv) ? 1 : 0; -} - int lv_is_virtual_origin(const struct logical_volume *lv) { return (lv->status & VIRTUAL_ORIGIN) ? 1 : 0; --- LVM2/lib/report/report.c 2009/05/12 19:12:10 1.98 +++ LVM2/lib/report/report.c 2009/05/13 21:27:44 1.99 @@ -497,7 +497,7 @@ char *repstr, *lvname; size_t len; - if (lv_is_displayable(lv)) { + if (lv_is_visible(lv)) { repstr = lv->name; return dm_report_field_string(rh, field, (const char **) &repstr); } @@ -974,7 +974,7 @@ const struct volume_group *vg = (const struct volume_group *) data; uint32_t count; - count = displayable_lvs_in_vg(vg); + count = vg_visible_lvs(vg); return _uint32_disp(rh, mem, field, &count, private); } --- LVM2/tools/lvchange.c 2009/04/25 01:18:00 1.99 +++ LVM2/tools/lvchange.c 2009/05/13 21:27:44 1.100 @@ -584,7 +584,7 @@ return ECMD_FAILED; } - if (!(lv_is_displayable(lv))) { + if (!(lv_is_visible(lv))) { log_error("Unable to change internal LV %s directly", lv->name); return ECMD_FAILED; --- LVM2/tools/lvdisplay.c 2008/12/04 15:54:27 1.21 +++ LVM2/tools/lvdisplay.c 2009/05/13 21:27:44 1.22 @@ -18,7 +18,7 @@ static int _lvdisplay_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - if (!arg_count(cmd, all_ARG) && !lv_is_displayable(lv)) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; if (arg_count(cmd, colon_ARG)) --- LVM2/tools/lvscan.c 2008/12/04 15:54:27 1.37 +++ LVM2/tools/lvscan.c 2009/05/13 21:27:44 1.38 @@ -27,7 +27,7 @@ const char *active_str, *snapshot_str; - if (!arg_count(cmd, all_ARG) && !lv_is_displayable(lv)) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; inkernel = lv_info(cmd, lv, &info, 1, 0) && info.exists; --- LVM2/tools/reporter.c 2009/04/21 12:59:19 1.47 +++ LVM2/tools/reporter.c 2009/05/13 21:27:44 1.48 @@ -36,7 +36,7 @@ static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - if (!arg_count(cmd, all_ARG) && !lv_is_displayable(lv)) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL)) @@ -113,7 +113,7 @@ static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - if (!arg_count(cmd, all_ARG) && !lv_is_displayable(lv)) + if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv)) return ECMD_PROCESSED; return process_each_segment_in_lv(cmd, lv, handle, _segs_single); --- LVM2/tools/vgchange.c 2009/05/13 21:22:57 1.70 +++ LVM2/tools/vgchange.c 2009/05/13 21:27:44 1.71 @@ -308,9 +308,9 @@ } } - if (max_lv && max_lv < volumes_count(vg)) { + if (max_lv && max_lv < vg_visible_lvs(vg)) { log_error("MaxLogicalVolume is less than the current number " - "%d of LVs for %s", volumes_count(vg), + "%d of LVs for %s", vg_visible_lvs(vg), vg->name); return ECMD_FAILED; } From mbroz@sourceware.org Wed May 13 21:28:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:28:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ... Message-ID: <20090513212832.30225.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:28:31 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c metadata-exported.h mirror.c snapshot_manip.c tools : lvcreate.c pvmove.c Log message: Remove unneeded import parameter from lv_create_empty. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1109&r2=1.1110 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.170&r2=1.171 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.186&r2=1.187 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58 --- LVM2/WHATS_NEW 2009/05/13 21:27:43 1.1109 +++ LVM2/WHATS_NEW 2009/05/13 21:28:31 1.1110 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Remove unneeded import parameter from lv_create_empty. Merge lv_is_displayable and lv_is_visible functions. Introduce lv_set_visible & lv_set_invisible functions. Fix lv_is_visible to handle virtual origin. --- LVM2/lib/metadata/lv_manip.c 2009/05/13 21:27:43 1.170 +++ LVM2/lib/metadata/lv_manip.c 2009/05/13 21:28:31 1.171 @@ -1811,7 +1811,6 @@ union lvid *lvid, uint32_t status, alloc_policy_t alloc, - int import, struct volume_group *vg) { struct format_instance *fi = vg->fid; @@ -1831,8 +1830,7 @@ return NULL; } - if (!import) - log_verbose("Creating logical volume %s", name); + log_verbose("Creating logical volume %s", name); if (!(lv = dm_pool_zalloc(vg->vgmem, sizeof(*lv)))) return_NULL; @@ -2417,7 +2415,7 @@ } if (!(layer_lv = lv_create_empty(name, NULL, LVM_READ | LVM_WRITE, - ALLOC_INHERIT, 0, lv_where->vg))) { + ALLOC_INHERIT, lv_where->vg))) { log_error("Creation of layer LV failed"); return NULL; } --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:27:43 1.71 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:28:31 1.72 @@ -448,7 +448,6 @@ union lvid *lvid, uint32_t status, alloc_policy_t alloc, - int import, struct volume_group *vg); /* Write out LV contents */ --- LVM2/lib/metadata/mirror.c 2009/05/13 21:26:45 1.86 +++ LVM2/lib/metadata/mirror.c 2009/05/13 21:28:31 1.87 @@ -932,7 +932,7 @@ for (m = 0; m < num_mirrors; m++) { if (!(img_lvs[m] = lv_create_empty(img_name, NULL, LVM_READ | LVM_WRITE, - ALLOC_INHERIT, 0, lv->vg))) { + ALLOC_INHERIT, lv->vg))) { log_error("Aborting. Failed to create mirror image LV. " "Remove new LV and retry."); return 0; @@ -1266,7 +1266,7 @@ if (!(log_lv = lv_create_empty(log_name, NULL, VISIBLE_LV | LVM_READ | LVM_WRITE, - alloc, 0, lv->vg))) + alloc, lv->vg))) return_NULL; if (!lv_add_log_segment(ah, log_lv)) --- LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:27:43 1.41 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:28:31 1.42 @@ -105,7 +105,7 @@ if (!(snap = lv_create_empty("snapshot%d", lvid, LVM_READ | LVM_WRITE | VISIBLE_LV, - ALLOC_INHERIT, 1, origin->vg))) + ALLOC_INHERIT, origin->vg))) return_0; snap->le_count = extent_count; --- LVM2/tools/lvcreate.c 2009/05/13 21:21:59 1.186 +++ LVM2/tools/lvcreate.c 2009/05/13 21:28:31 1.187 @@ -577,7 +577,7 @@ } if (!(lv = lv_create_empty(vorigin_name, NULL, permission, - ALLOC_INHERIT, 0, vg))) + ALLOC_INHERIT, vg))) return_0; if (!lv_extend(lv, segtype, 1, 0, 1, voriginextents, NULL, 0u, 0u, @@ -824,7 +824,7 @@ } if (!(lv = lv_create_empty(lv_name ? lv_name : "lvol%d", NULL, - status, lp->alloc, 0, vg))) + status, lp->alloc, vg))) return_0; if (lp->read_ahead) { --- LVM2/tools/pvmove.c 2009/04/21 14:31:58 1.57 +++ LVM2/tools/pvmove.c 2009/05/13 21:28:31 1.58 @@ -191,7 +191,7 @@ /* FIXME Cope with non-contiguous => splitting existing segments */ if (!(lv_mirr = lv_create_empty("pvmove%d", NULL, LVM_READ | LVM_WRITE, - ALLOC_CONTIGUOUS, 0, vg))) { + ALLOC_CONTIGUOUS, vg))) { log_error("Creation of temporary pvmove LV failed"); return NULL; } From mbroz@sourceware.org Wed May 13 21:29:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 13 May 2009 21:29:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ... Message-ID: <20090513212911.30422.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-13 21:29:10 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c metadata-exported.h metadata.c test : t-lvcreate-usage.sh test-utils.sh tools : lvcreate.c Log message: Check max_lv on only place and force the check only for new volume. We can temporarily violate max_lv during mirror conversion etc. (If the operation fails, orphan mirror images are visible to administrator for manual remove for example. Not that this should ever happen:-) Force limit only for lvcreate (and vg merge) command. Patch also adds simple max_lv tests into testsuite Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1110&r2=1.1111 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.171&r2=1.172 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.72&r2=1.73 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.218&r2=1.219 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.187&r2=1.188 --- LVM2/WHATS_NEW 2009/05/13 21:28:31 1.1110 +++ LVM2/WHATS_NEW 2009/05/13 21:29:10 1.1111 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Force max_lv restriction only for newly created LV. Remove unneeded import parameter from lv_create_empty. Merge lv_is_displayable and lv_is_visible functions. Introduce lv_set_visible & lv_set_invisible functions. --- LVM2/lib/metadata/lv_manip.c 2009/05/13 21:28:31 1.171 +++ LVM2/lib/metadata/lv_manip.c 2009/05/13 21:29:10 1.172 @@ -1804,6 +1804,20 @@ return buffer; } +int vg_max_lv_reached(struct volume_group *vg) +{ + if (!vg->max_lv) + return 0; + + if (vg->max_lv > vg_visible_lvs(vg)) + return 0; + + log_verbose("Maximum number of logical volumes (%u) reached " + "in volume group %s", vg->max_lv, vg->name); + + return 1; +} + /* * Create a new empty LV. */ @@ -1817,11 +1831,8 @@ struct logical_volume *lv; char dname[NAME_LEN]; - if (vg->max_lv && (vg->max_lv == vg_visible_lvs(vg))) { - log_error("Maximum number of logical volumes (%u) reached " - "in volume group %s", vg->max_lv, vg->name); - return NULL; - } + if (vg_max_lv_reached(vg)) + stack; if (strstr(name, "%d") && !(name = generate_lv_name(vg, name, dname, sizeof(dname)))) { @@ -1936,6 +1947,9 @@ { struct lv_list *lvl; + if (vg_max_lv_reached(vg)) + stack; + if (!(lvl = dm_pool_zalloc(vg->vgmem, sizeof(*lvl)))) return_0; --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:28:31 1.72 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:29:10 1.73 @@ -565,6 +565,11 @@ unsigned vg_visible_lvs(const struct volume_group *vg); /* + * Check if the VG reached maximal LVs count (if set) + */ +int vg_max_lv_reached(struct volume_group *vg); + +/* * Mirroring functions */ struct lv_segment *find_mirror_seg(struct lv_segment *seg); --- LVM2/lib/metadata/metadata.c 2009/05/13 21:27:43 1.218 +++ LVM2/lib/metadata/metadata.c 2009/05/13 21:29:10 1.219 @@ -1528,12 +1528,8 @@ r = 0; } - if (vg->max_lv && (vg->max_lv < vg_visible_lvs(vg))) { - log_error("Internal error: Volume group %s contains %u volumes" - " but the limit is set to %u.", - vg->name, vg_visible_lvs(vg), vg->max_lv); - r = 0; - } + if (vg_max_lv_reached(vg)) + stack; return r; } --- LVM2/test/t-lvcreate-usage.sh 2009/05/08 21:50:20 1.12 +++ LVM2/test/t-lvcreate-usage.sh 2009/05/13 21:29:10 1.13 @@ -55,12 +55,33 @@ case $(lvdisplay $vg) in "") true ;; *) false ;; esac # Setting max_lv works. (bz490298) -vgchange -l 4 $vg +lvremove -ff $vg +vgchange -l 3 $vg lvcreate -l1 -n $lv1 $vg lvcreate -l1 -s -n $lv2 $vg/$lv1 lvcreate -l1 -n $lv3 $vg not lvcreate -l1 -n $lv4 $vg + +lvremove -ff $vg/$lv3 +lvcreate -l1 -s -n $lv3 $vg/$lv1 +not lvcreate -l1 -n $lv4 $vg +not lvcreate -l1 -m1 -n $lv4 $vg + +lvremove -ff $vg/$lv3 +lvcreate -l1 -m1 -n $lv3 $vg +lvs +vgs -o +max_lv +not lvcreate -l1 -n $lv4 $vg +not lvcreate -l1 -m1 -n $lv4 $vg + +lvconvert -m0 $vg/$lv3 +lvconvert -m2 -i 1 $vg/$lv3 +lvconvert -m1 $vg/$lv3 + +not vgchange -l 2 +vgchange -l 4 vgs $vg + lvremove -ff $vg vgchange -l 0 $vg --- LVM2/test/test-utils.sh 2009/05/13 19:18:47 1.12 +++ LVM2/test/test-utils.sh 2009/05/13 21:29:10 1.13 @@ -130,6 +130,7 @@ lv1=LV1 lv2=LV2 lv3=LV3 + lv4=LV4 } disable_dev() { --- LVM2/tools/lvcreate.c 2009/05/13 21:28:31 1.187 +++ LVM2/tools/lvcreate.c 2009/05/13 21:29:10 1.188 @@ -613,6 +613,12 @@ return 0; } + if (vg_max_lv_reached(vg)) { + log_error("Maximum number of logical volumes (%u) reached " + "in volume group %s", vg->max_lv, vg->name); + return 0; + } + if (lp->mirrors > 1 && !(vg->fid->fmt->features & FMT_SEGMENTS)) { log_error("Metadata does not support mirroring."); return 0; From snitzer@sourceware.org Thu May 14 16:46:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Thu, 14 May 2009 16:46:00 -0000 Subject: LVM2 ./WHATS_NEW man/Makefile.in man/lvm.8.in ... Message-ID: <20090514164616.29131.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-05-14 16:46:13 Modified files: . : WHATS_NEW man : Makefile.in lvm.8.in scripts : Makefile.in Added files: man : vgimportclone.8.in scripts : vgimportclone.sh Log message: Add vgimportclone and install it and the man page by default. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1111&r2=1.1112 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgimportclone.8.in.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/Makefile.in.diff?cvsroot=lvm2&r1=1.26&r2=1.27 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvm.8.in.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/vgimportclone.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/Makefile.in.diff?cvsroot=lvm2&r1=1.8&r2=1.9 --- LVM2/WHATS_NEW 2009/05/13 21:29:10 1.1111 +++ LVM2/WHATS_NEW 2009/05/14 16:46:12 1.1112 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Add vgimportclone and install it and the man page by default. Force max_lv restriction only for newly created LV. Remove unneeded import parameter from lv_create_empty. Merge lv_is_displayable and lv_is_visible functions. /cvs/lvm2/LVM2/man/vgimportclone.8.in,v --> standard output revision 1.1 --- LVM2/man/vgimportclone.8.in +++ - 2009-05-14 16:46:15.152373000 +0000 @@ -0,0 +1,58 @@ +.TH VGIMPORTCLONE 8 "LVM TOOLS #VERSION#" "Red Hat, Inc." \" -*- nroff -*- +.SH NAME +vgimportclone \- import and rename duplicated volume group (e.g. a hardware snapshot) +.SH SYNOPSIS +.B vgimportclone +[\-n|\-\-basevgname VolumeGroupName] +[\-i|\-\-import] +PhysicalVolume [PhysicalVolume...] +.SH DESCRIPTION +.B vgimportclone +is used to import a duplicated VG (e.g. hardware snapshot). Duplicate VG(s) +and PV(s) are not able to be used until they are made to coexist with +the origin VG(s) and PV(s). +.B vgimportclone +renames the VG associated with the specified PV(s) and changes the +associated VG and PV UUIDs. +.SH OPTIONS +See \fBlvm\fP for common options. +.TP +.I \-n|\-\-basevgname VolumeGroupName +By default the snapshot VG will be renamed to the original name plus a +numeric suffix to avoid duplicate naming (e.g. 'test_vg' would be renamed +to 'test_vg1'). This option will override the base VG name that is +used for all VG renames. If a VG already exists with the specified name +a numeric suffix will be added (like the previous example) to make it unique. +.TP +.I \-i|\-\-import +Import exported Volume Groups. Otherwise VGs that have been exported +will not be changed (nor will their associated PVs). +.SH ENVIRONMENT VARIABLES +.TP +\fBLVM_BINARY\fP +The LVM2 binary to use. +Defaults to "lvm". +.SH EXAMPLES +If origin VG +.B test_vg +has PVs +.BR /dev/loop0 " and " /dev/loop1 +and +.BR /dev/loop2 " and " /dev/loop3 +are respective snapshot PVs of the origin PVs. +To rename the VG +associated with +.BR /dev/loop2 " and " /dev/loop3 +from +.B test_vg +to +.B test_vg_snap +(and change associated VG and PV UUIDs): +.nf + +\ vgimportclone --basevgname test_vg_snap /dev/loop2 /dev/loop3 + +.fi +.SH SEE ALSO +.BR lvm (8) + --- LVM2/man/Makefile.in 2009/05/11 10:28:46 1.26 +++ LVM2/man/Makefile.in 2009/05/14 16:46:13 1.27 @@ -29,8 +29,8 @@ lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \ pvresize.8 pvs.8 pvscan.8 vgcfgbackup.8 vgcfgrestore.8 vgchange.8 \ vgck.8 vgcreate.8 vgconvert.8 vgdisplay.8 vgexport.8 vgextend.8 \ - vgimport.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 vgrename.8 \ - vgs.8 vgscan.8 vgsplit.8 $(FSADMMAN) + vgimport.8 vgimportclone.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 \ + vgrename.8 vgs.8 vgscan.8 vgsplit.8 $(FSADMMAN) MAN8CLUSTER=clvmd.8 MAN8DM=dmsetup.8 MAN5DIR=${mandir}/man5 --- LVM2/man/lvm.8.in 2009/02/20 01:47:02 1.2 +++ LVM2/man/lvm.8.in 2009/05/14 16:46:13 1.3 @@ -95,6 +95,8 @@ .TP \fBvgimport\fP \(em Make exported volume groups known to the system. .TP +\fBvgimportclone\fP \(em Import and rename duplicated volume group (e.g. a hardware snapshot). +.TP \fBvgmerge\fP \(em Merge two volume groups. .TP \fBvgmknodes\fP \(em Recreate volume group directory and logical volume special files @@ -307,6 +309,7 @@ .BR vgdisplay (8), .BR vgextend (8), .BR vgimport (8), +.BR vgimportclone (8), .BR vgmerge (8), .BR vgmknodes (8), .BR vgreduce (8), /cvs/lvm2/LVM2/scripts/vgimportclone.sh,v --> standard output revision 1.1 --- LVM2/scripts/vgimportclone.sh +++ - 2009-05-14 16:46:16.074811000 +0000 @@ -0,0 +1,334 @@ +#!/bin/sh + +# Copyright (C) 2009 Chris Procter All rights reserved. +# Copyright (C) 2009 Red Hat, Inc. All rights reserved. +# +# This file is part of LVM2. +# +# 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 +# +# vgimportclone: This script is used to rename the VG and change the associated +# VG and PV UUIDs (primary application being HW snapshot restore) + +# following external commands are used throughout the script +# echo and test are internal in bash at least +RM=rm +BASENAME=basename +MKTEMP=mktemp +AWK=awk +CUT=cut +TR=tr +READLINK=readlink +GREP=grep +GETOPT=getopt + +# user may override lvm location by setting LVM_BINARY +LVM="${LVM_BINARY:-lvm}" + +die() { + code=$1; shift + echo "Fatal: $@" 1>&2 + exit $code +} + +"$LVM" version >& /dev/null || die 2 "Could not run lvm binary '$LVM'" + + +function getvgname { +### get a unique vg name +### $1 = list of exists VGs +### $2 = the name we want + VGLIST=$1 + VG=$2 + NEWVG=$3 + + BNAME="${NEWVG:-${VG}}" + NAME="${BNAME}" + I=0 + + while [[ "${VGLIST}" =~ "${NAME}" ]] + do + I=$(($I+1)) + NAME="${BNAME}$I" + done + echo "${NAME}" +} + + +function checkvalue { +### check return value and error if non zero + if [ $1 -ne 0 ] + then + die $1 "$2, error: $1" + fi +} + + +function usage { +### display usage message + echo "Usage: ${SCRIPTNAME} [options] PhysicalVolume [PhysicalVolume...]" + echo " -n|--basevgname - Base name for the new volume group(s)" + echo " -i|--import - Import any exported volume groups found" + echo " -t|--test - Run in test mode" + echo " --quiet - Suppress output" + echo " -v|--verbose - Set verbose level" + echo " -d|--debug - Set debug level" + echo " --version - Display version information" + echo " -h|--help - Display this help message" + echo "" + exit 1 +} + + +function cleanup { + #set to use old lvm.conf + LVM_SYSTEM_DIR=${ORIG_LVM_SYS_DIR} + + "$RM" -rf -- "${TMP_LVM_SYSTEM_DIR}" +} + +SCRIPTNAME=`"$BASENAME" $0` + + +if [ "$UID" != "0" -a "$EUID" != "0" ] +then + die 3 "${SCRIPTNAME} must be run as root." +fi + +LVM_OPTS="" +TEST_OPT="" +DISKS="" +# for compatibility: using mktemp -t rather than --tmpdir +TMP_LVM_SYSTEM_DIR=`"$MKTEMP" -d -t snap.XXXXXXXX` +IMPORT=0 +DEBUG="" +VERBOSE="" +DEVNO=0 + +if [ -n "${LVM_SYSTEM_DIR}" ]; then + export ORIG_LVM_SYS_DIR="${LVM_SYSTEM_DIR}" +fi + +trap cleanup 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 + +##################################################################### +### Get and check arguments +##################################################################### +OPTIONS=`"$GETOPT" -o n:dhitv \ + -l basevgname:,debug,help,import,quiet,test,verbose,version \ + -n "${SCRIPTNAME}" -- "$@"` +[ $? -ne 0 ] && usage +eval set -- "$OPTIONS" + +while true +do + case $1 in + -n|--basevgname) + NEWVG="$2"; shift; shift + ;; + -i|--import) + IMPORT=1; shift + ;; + -t|--test) + TEST_OPT="-t" + shift + ;; + --quiet) + LVM_OPTS="--quiet ${LVM_OPTS}" + shift + ;; + -v|--verbose) + if [ -z "$VERBOSE" ] + then + VERBOSE="-v" + else + VERBOSE="${VERBOSE}v" + fi + shift + ;; + -d|--debug) + if [ -z "$DEBUG" ] + then + DEBUG="-d" + set -x + else + DEBUG="${DEBUG}d" + fi + shift + ;; + --version) + "$LVM" version + shift + exit 0 + ;; + -h|--help) + usage; shift + ;; + --) + shift; break + ;; + *) + usage + ;; + esac +done + +# process remaining arguments (which should be disks) +for ARG +do + if [ -b "$ARG" ] + then + ln -s "$ARG" ${TMP_LVM_SYSTEM_DIR}/vgimport${DEVNO} + DISKS="${DISKS} ${TMP_LVM_SYSTEM_DIR}/vgimport${DEVNO}" + DEVNO=$((${DEVNO}+1)) + else + die 3 "$ARG is not a block device." + fi +done + +# setup LVM_OPTS +if [ -n "${DEBUG}" -o -n "${VERBOSE}" ] +then + LVM_OPTS="${LVM_OPTS} ${DEBUG} ${VERBOSE}" +fi + +### check we have suitable values for important variables +if [ -z "${DISKS}" ] +then + usage +fi + +##################################################################### +### Get the existing state so we can use it later +##################################################################### + +OLDVGS=`"${LVM}" vgs ${LVM_OPTS} -o name --noheadings 2>/dev/null` +checkvalue $? "Current VG names could not be collected without errors" + +##################################################################### +### Prepare the temporary lvm environment +##################################################################### + +for BLOCK in ${DISKS} +do + FILTER="\"a|^${BLOCK}$|\", ${FILTER}" +done +export FILTER="filter=[ ${FILTER} \"r|.*|\" ]" + +LVMCONF=${TMP_LVM_SYSTEM_DIR}/lvm.conf + +"$LVM" dumpconfig ${LVM_OPTS} | \ +"$AWK" -v DEV=${TMP_LVM_SYSTEM_DIR} -v CACHE=${TMP_LVM_SYSTEM_DIR}/.cache \ + -v CACHE_DIR=${TMP_LVM_SYSTEM_DIR}/cache \ + '/^[[:space:]]*filter[[:space:]]*=/{print ENVIRON["FILTER"];next} \ + /^[[:space:]]*scan[[:space:]]*=/{print "scan = [ \"" DEV "\" ]";next} \ + /^[[:space:]]*cache[[:space:]]*=/{print "cache = \"" CACHE "\"";next} \ + /^[[:space:]]*cache_dir[[:space:]]*=/{print "cache_dir = \"" CACHE_DIR "\"";next} \ + {print $0}' > ${LVMCONF} + +checkvalue $? "Failed to generate ${LVMCONF}" + +# verify the config contains the filter, scan and cache_dir (or cache) config keywords +"$GREP" -q '^[[:space:]]*filter[[:space:]]*=' ${LVMCONF} || \ + die 5 "Temporary lvm.conf must contain 'filter' config." +"$GREP" -q '^[[:space:]]*scan[[:space:]]*=' ${LVMCONF} || \ + die 6 "Temporary lvm.conf must contain 'scan' config." + +# check for either 'cache' or 'cache_dir' config values +"$GREP" -q '[[:space:]]*cache[[:space:]]*=' ${LVMCONF} +CACHE_RET=$? +"$GREP" -q '^[[:space:]]*cache_dir' ${LVMCONF} +CACHE_DIR_RET=$? +[ $CACHE_RET -eq 0 -o $CACHE_DIR_RET -eq 0 ] || \ + die 7 "Temporary lvm.conf must contain 'cache' or 'cache_dir' config." + +### set to use new lvm.conf +export LVM_SYSTEM_DIR=${TMP_LVM_SYSTEM_DIR} + + +##################################################################### +### Rename the VG(s) and change the VG and PV UUIDs. +##################################################################### + +PVINFO=`"${LVM}" pvs ${LVM_OPTS} -o pv_name,vg_name,vg_attr --noheadings --separator : 2>/dev/null` +checkvalue $? "PV info could not be collected without errors" + +# output VG info so each line looks like: name:exported?:disk1,disk2,... +VGINFO=`echo "${PVINFO}" | \ + "$AWK" -F : '{{sub(/^[[:space:]]*/,"")} \ + {vg[$2]=$1","vg[$2]} if($3 ~ /^..x/){x[$2]="x"}} \ + END{for(k in vg){printf("%s:%s:%s\n", k, x[k], vg[k])}}'` +checkvalue $? "PV info could not be parsed without errors" + +for VG in ${VGINFO} +do + VGNAME=`echo "${VG}" | "$CUT" -d: -f1` + EXPORTED=`echo "${VG}" | "$CUT" -d: -f2` + PVLIST=`echo "${VG}" | "$CUT" -d: -f3- | "$TR" , ' '` + + if [ -z "${VGNAME}" ] + then + FOLLOWLIST="" + for DEV in $PVLIST; do + FOLLOW=`"$READLINK" $DEV` + FOLLOWLIST="$FOLLOW $FOLLOWLIST" + done + die 8 "Specified PV(s) ($FOLLOWLIST) don't belong to a VG." + fi + + if [ -n "${EXPORTED}" ] + then + if [ ${IMPORT} -eq 1 ] + then + "$LVM" vgimport ${LVM_OPTS} ${TEST_OPT} "${VGNAME}" + checkvalue $? "Volume Group ${VGNAME} could not be imported" + else + echo "Volume Group ${VGNAME} exported, skipping." + continue + fi + fi + + ### change the pv uuids + if [[ "${PVLIST}" =~ "unknown" ]] + then + echo "Volume Group ${VGNAME} incomplete, skipping." + continue + fi + + for BLOCKDEV in ${PVLIST} + do + "$LVM" pvchange ${LVM_OPTS} ${TEST_OPT} --uuid ${BLOCKDEV} --config 'global{activation=0}' + checkvalue $? "Unable to change PV uuid for ${BLOCKDEV}" + done + + NEWVGNAME=`getvgname "${OLDVGS}" "${VGNAME}" "${NEWVG}"` + + "$LVM" vgchange ${LVM_OPTS} ${TEST_OPT} --uuid "${VGNAME}" --config 'global{activation=0}' + checkvalue $? "Unable to change VG uuid for ${VGNAME}" + + ## if the name isn't going to get changed dont even try. + if [ "${VGNAME}" != "${NEWVGNAME}" ] + then + "$LVM" vgrename ${LVM_OPTS} ${TEST_OPT} "${VGNAME}" "${NEWVGNAME}" + checkvalue $? "Unable to rename ${VGNAME} to ${NEWVGNAME}" + fi + +done + +##################################################################### +### Restore the old environment +##################################################################### +### set to use old lvm.conf +LVM_SYSTEM_DIR=${ORIG_LVM_SYS_DIR} + +### update the device cache and make sure all +### the device nodes we need are straight +"$LVM" vgscan ${LVM_OPTS} --mknodes + +exit 0 --- LVM2/scripts/Makefile.in 2009/05/11 10:35:00 1.8 +++ LVM2/scripts/Makefile.in 2009/05/14 16:46:13 1.9 @@ -20,6 +20,8 @@ install: $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) lvm_dump.sh \ $(sbindir)/lvmdump + $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) vgimportclone.sh \ + $(sbindir)/vgimportclone ifeq ("@FSADM@", "yes") $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) fsadm.sh \ $(sbindir)/fsadm From mbroz@sourceware.org Tue May 19 09:45:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 09:45:00 -0000 Subject: LVM2/lib/format_text archiver.c Message-ID: <20090519094534.28044.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 09:45:34 Modified files: lib/format_text: archiver.c Log message: vgcfgrestore should not quietly fail when backup file has missing PVs. (fixes previous commit: Fix segfault for vgcfgrestore on VG with missing PVs.) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/archiver.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25 --- LVM2/lib/format_text/archiver.c 2009/04/22 09:39:46 1.24 +++ LVM2/lib/format_text/archiver.c 2009/05/19 09:45:33 1.25 @@ -335,7 +335,7 @@ const char *file) { struct volume_group *vg; - int r = 0; + int missing_pvs, r = 0; /* * Read in the volume group from the text file. @@ -343,11 +343,12 @@ if (!(vg = backup_read_vg(cmd, vg_name, file))) return_0; - /* - * If PV is missing, there is already message from read above - */ - if (!vg_missing_pv_count(vg)) + missing_pvs = vg_missing_pv_count(vg); + if (missing_pvs == 0) r = backup_restore_vg(cmd, vg); + else + log_error("Cannot restore Volume Group %s with %i PVs " + "marked as missing.", vg->name, missing_pvs); vg_release(vg); return r; From mbroz@sourceware.org Tue May 19 09:48:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 09:48:00 -0000 Subject: LVM2 ./WHATS_NEW lib/format_text/export.c test ... Message-ID: <20090519094832.29152.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 09:48:32 Modified files: . : WHATS_NEW lib/format_text: export.c test : t-vgcfgbackup-usage.sh Log message: Use PV UUID in hash for device name when exporting metadata. Currently code uses pv_dev_name() for hash when getting internal "pvX" name. This produce corrupted metadata if PVs are missing, pv->dev is NULL and all these missing devices returns one name (using "unknown device" for all missing devices as hash key). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1112&r2=1.1113 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.68&r2=1.69 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgcfgbackup-usage.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2 --- LVM2/WHATS_NEW 2009/05/14 16:46:12 1.1112 +++ LVM2/WHATS_NEW 2009/05/19 09:48:32 1.1113 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix metadata export for VG with missing PVs. Add vgimportclone and install it and the man page by default. Force max_lv restriction only for newly created LV. Remove unneeded import parameter from lv_create_empty. --- LVM2/lib/format_text/export.c 2009/05/13 21:27:43 1.68 +++ LVM2/lib/format_text/export.c 2009/05/19 09:48:32 1.69 @@ -378,10 +378,19 @@ * Get the pv%d name from the formatters hash * table. */ +static const char *_get_pv_name_from_uuid(struct formatter *f, char *uuid) +{ + return dm_hash_lookup(f->pv_names, uuid); +} + static const char *_get_pv_name(struct formatter *f, struct physical_volume *pv) { - return (pv) ? (const char *) - dm_hash_lookup(f->pv_names, pv_dev_name(pv)) : "Missing"; + char uuid[64] __attribute((aligned(8))); + + if (!pv || !id_write_format(&pv->id, uuid, sizeof(uuid))) + return_NULL; + + return _get_pv_name_from_uuid(f, uuid); } static int _print_pvs(struct formatter *f, struct volume_group *vg) @@ -398,16 +407,16 @@ dm_list_iterate_items(pvl, &vg->pvs) { pv = pvl->pv; - if (!(name = _get_pv_name(f, pv))) + if (!id_write_format(&pv->id, buffer, sizeof(buffer))) + return_0; + + if (!(name = _get_pv_name_from_uuid(f, buffer))) return_0; outnl(f); outf(f, "%s {", name); _inc_indent(f); - if (!id_write_format(&pv->id, buffer, sizeof(buffer))) - return_0; - outf(f, "id = \"%s\"", buffer); if (!(buf = alloca(escaped_len(pv_dev_name(pv))))) { @@ -621,7 +630,7 @@ int count = 0; struct pv_list *pvl; struct physical_volume *pv; - char buffer[32], *name; + char buffer[32], *uuid, *name; if (!(f->mem = dm_pool_create("text pv_names", 512))) return_0; @@ -639,7 +648,11 @@ if (!(name = dm_pool_strdup(f->mem, buffer))) return_0; - if (!dm_hash_insert(f->pv_names, pv_dev_name(pv), name)) + if (!(uuid = dm_pool_zalloc(f->mem, 64)) || + !id_write_format(&pv->id, uuid, 64)) + return_0; + + if (!dm_hash_insert(f->pv_names, uuid, name)) return_0; } --- LVM2/test/t-vgcfgbackup-usage.sh 2008/11/11 15:29:24 1.1 +++ LVM2/test/t-vgcfgbackup-usage.sh 2009/05/19 09:48:32 1.2 @@ -11,14 +11,32 @@ . ./test-utils.sh -aux prepare_pvs 2 +aux prepare_pvs 4 # vgcfgbackup handles similar VG names (bz458941) vg1=${PREFIX}vg00 -vg1=${PREFIX}vg01 +vg2=${PREFIX}vg01 vgcreate $vg1 $dev1 vgcreate $vg2 $dev2 vgcfgbackup -f /tmp/bak-%s >out grep "Volume group \"$vg1\" successfully backed up." out grep "Volume group \"$vg2\" successfully backed up." out +vgremove -ff $vg1 +vgremove -ff $vg2 +# vgcfgbackup correctly stores metadata with missing PVs +# and vgcfgrestore able to restore them when device reappears +pv1_uuid=$(pvs --noheadings -o pv_uuid $dev1) +pv2_uuid=$(pvs --noheadings -o pv_uuid $dev2) +vgcreate $vg $devs +lvcreate -l1 -n $lv1 $vg $dev1 +lvcreate -l1 -n $lv2 $vg $dev2 +lvcreate -l1 -n $lv3 $vg $dev3 +vgchange -a n $vg +pvcreate -ff -y $dev1 +pvcreate -ff -y $dev2 +vgcfgbackup -f "$(pwd)/backup.$$" $vg +sed 's/flags = \[\"MISSING\"\]/flags = \[\]/' "$(pwd)/backup.$$" > "$(pwd)/backup.$$1" +pvcreate -ff -y -u $pv1_uuid $dev1 +pvcreate -ff -y -u $pv2_uuid $dev2 +vgcfgrestore -f "$(pwd)/backup.$$1" $vg From mbroz@sourceware.org Tue May 19 09:51:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 09:51:00 -0000 Subject: LVM2 ./WHATS_NEW test/t-pvmove-basic.sh tools/ ... Message-ID: <20090519095103.29853.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 09:51:03 Modified files: . : WHATS_NEW test : t-pvmove-basic.sh tools : pvmove.c Log message: If pvmove fails activating mirror volume, try restore to previous state. pvmove now keep suspended devices if temporary mirror creation fails. We can try to restore previous state if it is first attempt to activate pvmove (code basically run the same code as --abort automatically). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1113&r2=1.1114 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvmove-basic.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59 --- LVM2/WHATS_NEW 2009/05/19 09:48:32 1.1113 +++ LVM2/WHATS_NEW 2009/05/19 09:51:02 1.1114 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix pvmove to revert operation if temporary mirror creation fails. Fix metadata export for VG with missing PVs. Add vgimportclone and install it and the man page by default. Force max_lv restriction only for newly created LV. --- LVM2/test/t-pvmove-basic.sh 2008/11/10 12:41:52 1.4 +++ LVM2/test/t-pvmove-basic.sh 2009/05/19 09:51:03 1.5 @@ -370,3 +370,8 @@ lvcreate -l4 -n $lv1 $vg $dev1 pvmove $dev1 +#COMM "pvmove fails activating mirror, properly restores state before pvmove" +dmsetup create "$vg-pvmove0" --notable +not pvmove -i 1 $dev2 +test $(dmsetup info --noheadings -c -o suspended "$vg-$lv1") = "Active" +dmsetup remove "$vg-pvmove0" --- LVM2/tools/pvmove.c 2009/05/13 21:28:31 1.58 +++ LVM2/tools/pvmove.c 2009/05/19 09:51:03 1.59 @@ -274,6 +274,10 @@ return activate_lv(cmd, lv_mirr); } +static int _finish_pvmove(struct cmd_context *cmd, struct volume_group *vg, + struct logical_volume *lv_mirr, + struct dm_list *lvs_changed); + static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg, struct logical_volume *lv_mirr, struct dm_list *lvs_changed, unsigned flags) @@ -315,12 +319,16 @@ /* FIXME: Add option to use a log */ if (first_time) { if (!_activate_lv(cmd, lv_mirr, exclusive)) { - if (!test_mode()) - log_error("ABORTING: Temporary mirror " - "activation failed. " - "Run pvmove --abort."); - /* FIXME Resume using *original* metadata here! */ - resume_lvs(cmd, lvs_changed); + if (test_mode()) + goto out; + + /* + * Nothing changed yet, try to revert pvmove. + */ + log_error("Temporary pvmove mirror activation failed."); + if (!_finish_pvmove(cmd, vg, lv_mirr, lvs_changed)) + log_error("ABORTING: Restoring original configuration " + "before pvmove failed. Run pvmove --abort."); goto out; } } else if (!resume_lv(cmd, lv_mirr)) { From mbroz@sourceware.org Tue May 19 10:12:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 10:12:00 -0000 Subject: LVM2/tools lvconvert.c Message-ID: <20090519101241.16877.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 10:12:41 Modified files: tools : lvconvert.c Log message: Fix compilation warning. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74 --- LVM2/tools/lvconvert.c 2009/05/13 21:21:59 1.73 +++ LVM2/tools/lvconvert.c 2009/05/19 10:12:41 1.74 @@ -442,7 +442,7 @@ int r = 0; struct logical_volume *log_lv; int failed_mirrors = 0, failed_log = 0; - struct dm_list *old_pvh, *remove_pvs = NULL; + struct dm_list *old_pvh = NULL, *remove_pvs = NULL; seg = first_seg(lv); existing_mirrors = lv_mirror_count(lv); From mbroz@sourceware.org Tue May 19 10:25:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 10:25:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/dmeventd/plugins/mirr ... Message-ID: <20090519102517.19842.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 10:25:17 Modified files: . : WHATS_NEW daemons/dmeventd/plugins/mirror: dmeventd_mirror.c Log message: Use lvconvert --repair in dmeventd DSO (mornfall) This means two things: 1) Non-mirrored LVs will be no longer affected by mirror monitoring. (Before, if you had a LV that went partially missing on a VG where a mirror leg failed, this LV would be removed automatically by dmeventd... Probably not an unrecoverable dataloss bug, but still quite unpleasant.) 2) If enough parallel PV space is available at the time of the mirror failure, the failed devices will be automatically replaced using this spare space. Which (and whether) free space may be used is still not configurable, but is a planned feature. Since it is relatively easy to undo the action by converting the mirror manually, I don't consider this to be a showstopper. In fact, I think the compromise is much better than what we have now. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1114&r2=1.1115 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21 --- LVM2/WHATS_NEW 2009/05/19 09:51:02 1.1114 +++ LVM2/WHATS_NEW 2009/05/19 10:25:16 1.1115 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Use lvconvert --repair in dmeventd mirror DSO. Fix pvmove to revert operation if temporary mirror creation fails. Fix metadata export for VG with missing PVs. Add vgimportclone and install it and the man page by default. --- LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2008/09/25 15:52:29 1.20 +++ LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009/05/19 10:25:16 1.21 @@ -152,7 +152,7 @@ } /* FIXME Is any sanity-checking required on %s? */ - if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing --force %s", vg)) { + if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "lvconvert --config devices{ignore_suspended_devices=1} --repair %s/%s", vg, lv)) { /* this error should be caught above, but doesn't hurt to check again */ syslog(LOG_ERR, "Unable to form LVM command: Device name too long"); dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */ From mbroz@sourceware.org Tue May 19 10:27:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 10:27:00 -0000 Subject: LVM2/tools lvconvert.c Message-ID: <20090519102747.21668.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 10:27:47 Modified files: tools : lvconvert.c Log message: Fix lvconvert check for multiple-segment mirrors (mornfall) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.74&r2=1.75 --- LVM2/tools/lvconvert.c 2009/05/19 10:12:41 1.74 +++ LVM2/tools/lvconvert.c 2009/05/19 10:27:47 1.75 @@ -542,11 +542,10 @@ } /* - * FIXME This check used to precede mirror->mirror conversion - * but didn't affect mirror->linear or linear->mirror. I do - * not understand what is its intention, in fact. + * For the most part, we cannot handle multi-segment mirrors. Bail out + * early if we have encountered one. */ - if (dm_list_size(&lv->segments) != 1) { + if ((lv->status & MIRRORED) && dm_list_size(&lv->segments) != 1) { log_error("Logical volume %s has multiple " "mirror segments.", lv->name); return 0; From mbroz@sourceware.org Tue May 19 10:39:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Tue, 19 May 2009 10:39:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvm.h daemons/ ... Message-ID: <20090519103905.25884.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-19 10:39:01 Modified files: . : WHATS_NEW daemons/clvmd : clvm.h clvmd-command.c clvmd.c lvm-functions.c lvm-functions.h lib/activate : activate.c lib/locking : cluster_locking.c locking.c locking.h locking_types.h Log message: Add infrastructure for queriying for remote locks. Current code, when need to ensure that volume is not active on remote node, it need to try to exclusive activate volume. Patch adds simple clvmd command which queries all nodes for lock for given resource. The lock type is returned in reply in text. (But code currently uses CR and EX modes only.) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1115&r2=1.1116 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvm.h.diff?cvsroot=lvm2&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.147&r2=1.148 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.45&r2=1.46 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking_types.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16 --- LVM2/WHATS_NEW 2009/05/19 10:25:16 1.1115 +++ LVM2/WHATS_NEW 2009/05/19 10:38:58 1.1116 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. Use lvconvert --repair in dmeventd mirror DSO. Fix pvmove to revert operation if temporary mirror creation fails. Fix metadata export for VG with missing PVs. --- LVM2/daemons/clvmd/clvm.h 2007/12/04 15:39:26 1.6 +++ LVM2/daemons/clvmd/clvm.h 2009/05/19 10:38:58 1.7 @@ -62,6 +62,7 @@ /* Lock/Unlock commands */ #define CLVMD_CMD_LOCK_LV 50 #define CLVMD_CMD_LOCK_VG 51 +#define CLVMD_CMD_LOCK_QUERY 52 /* Misc functions */ #define CLVMD_CMD_REFRESH 40 --- LVM2/daemons/clvmd/clvmd-command.c 2009/04/22 09:39:45 1.27 +++ LVM2/daemons/clvmd/clvmd-command.c 2009/05/19 10:39:00 1.28 @@ -90,6 +90,7 @@ int arglen = msglen - sizeof(struct clvm_header) - strlen(msg->node); int status = 0; char *lockname; + const char *locktype; struct utsname nodeinfo; unsigned char lock_cmd; unsigned char lock_flags; @@ -144,6 +145,14 @@ } break; + case CLVMD_CMD_LOCK_QUERY: + lockname = &args[2]; + if (buflen < 3) + return EIO; + if ((locktype = do_lock_query(lockname))) + *retlen = 1 + snprintf(*buf, buflen, "%s", locktype); + break; + case CLVMD_CMD_REFRESH: do_refresh_cache(); break; @@ -278,6 +287,7 @@ case CLVMD_CMD_GET_CLUSTERNAME: case CLVMD_CMD_SET_DEBUG: case CLVMD_CMD_VG_BACKUP: + case CLVMD_CMD_LOCK_QUERY: break; default: @@ -308,6 +318,7 @@ case CLVMD_CMD_LOCK_VG: case CLVMD_CMD_VG_BACKUP: + case CLVMD_CMD_LOCK_QUERY: /* Nothing to do here */ break; --- LVM2/daemons/clvmd/clvmd.c 2009/04/22 10:38:16 1.57 +++ LVM2/daemons/clvmd/clvmd.c 2009/05/19 10:39:00 1.58 @@ -257,6 +257,9 @@ case CLVMD_CMD_UNLOCK: command = "UNLOCK"; break; + case CLVMD_CMD_LOCK_QUERY: + command = "LOCK_QUERY"; + break; default: command = "unknown"; break; --- LVM2/daemons/clvmd/lvm-functions.c 2009/04/21 13:11:28 1.60 +++ LVM2/daemons/clvmd/lvm-functions.c 2009/05/19 10:39:00 1.61 @@ -434,6 +434,26 @@ return 0; } +const char *do_lock_query(char *resource) +{ + int mode; + const char *type = NULL; + + mode = get_current_lock(resource); + switch (mode) { + case LKM_NLMODE: type = "NL"; break; + case LKM_CRMODE: type = "CR"; break; + case LKM_CWMODE: type = "CW"; break; + case LKM_PRMODE: type = "PR"; break; + case LKM_PWMODE: type = "PW"; break; + case LKM_EXMODE: type = "EX"; break; + } + + DEBUGLOG("do_lock_query: resource '%s', mode %i (%s)\n", resource, mode, type ?: "?"); + + return type; +} + /* This is the LOCK_LV part that happens on all nodes in the cluster - it is responsible for the interaction with device-mapper and LVM */ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource) --- LVM2/daemons/clvmd/lvm-functions.h 2009/04/21 13:11:28 1.9 +++ LVM2/daemons/clvmd/lvm-functions.h 2009/05/19 10:39:00 1.10 @@ -22,6 +22,7 @@ char *resource); extern int do_lock_lv(unsigned char lock_cmd, unsigned char lock_flags, char *resource); +extern const char *do_lock_query(char *resource); extern int post_lock_lv(unsigned char lock_cmd, unsigned char lock_flags, char *resource); extern int do_check_lvm1(const char *vgname); --- LVM2/lib/activate/activate.c 2009/05/13 21:27:43 1.147 +++ LVM2/lib/activate/activate.c 2009/05/19 10:39:00 1.148 @@ -695,21 +695,7 @@ if (!vg_is_clustered(lv->vg)) return 0; - /* - * FIXME: Cluster does not report per-node LV activation status. - * Currently the best we can do is try exclusive local activation. - * If that succeeds, we know the LV is not active elsewhere in the - * cluster. - */ - if (activate_lv_excl(lv->vg->cmd, lv)) { - deactivate_lv(lv->vg->cmd, lv); - return 0; - } - - /* - * Exclusive local activation failed so assume it is active elsewhere. - */ - return 1; + return remote_lock_held(lv->lvid.s); } /* --- LVM2/lib/locking/cluster_locking.c 2009/04/22 09:39:46 1.33 +++ LVM2/lib/locking/cluster_locking.c 2009/05/19 10:39:00 1.34 @@ -1,6 +1,6 @@ /* * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -33,6 +33,7 @@ #ifndef CLUSTER_LOCKING_INTERNAL int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags); +int lock_resource_query(const char *resource, int *mode); void locking_end(void); int locking_init(int type, struct config_tree *cf, uint32_t *flags); #endif @@ -455,6 +456,69 @@ return _lock_for_cluster(clvmd_cmd, flags, lockname); } +static int decode_lock_type(const char *response) +{ + if (!response) + return LCK_NULL; + else if (strcmp(response, "EX")) + return LCK_EXCL; + else if (strcmp(response, "CR")) + return LCK_READ; + else if (strcmp(response, "PR")) + return LCK_PREAD; + + stack; + return 0; +} + +#ifdef CLUSTER_LOCKING_INTERNAL +static int _lock_resource_query(const char *resource, int *mode) +#else +int lock_resource_query(const char *resource, int *mode) +#endif +{ + int i, status, len, num_responses, saved_errno; + const char *node = ""; + char *args; + lvm_response_t *response = NULL; + + saved_errno = errno; + len = strlen(resource) + 3; + args = alloca(len); + strcpy(args + 2, resource); + + args[0] = 0; + args[1] = LCK_CLUSTER_VG; + + status = _cluster_request(CLVMD_CMD_LOCK_QUERY, node, args, len, + &response, &num_responses); + *mode = LCK_NULL; + for (i = 0; i < num_responses; i++) { + if (response[i].status == EHOSTDOWN) + continue; + + if (!response[i].response[0]) + continue; + + /* + * All nodes should use CR, or exactly one node + * should held EX. (PR is obsolete) + * If two nodes node reports different locks, + * something is broken - just return more important mode. + */ + if (decode_lock_type(response[i].response) > *mode) + *mode = decode_lock_type(response[i].response); + + log_debug("Lock held for %s, node %s : %s", resource, + response[i].node, response[i].response); + } + + _cluster_free_request(response, num_responses); + errno = saved_errno; + + return status; +} + #ifdef CLUSTER_LOCKING_INTERNAL static void _locking_end(void) #else @@ -485,6 +549,7 @@ int init_cluster_locking(struct locking_type *locking, struct cmd_context *cmd) { locking->lock_resource = _lock_resource; + locking->lock_resource_query = _lock_resource_query; locking->fin_locking = _locking_end; locking->reset_locking = _reset_locking; locking->flags = LCK_PRE_MEMLOCK | LCK_CLUSTERED; --- LVM2/lib/locking/locking.c 2009/05/13 13:02:55 1.57 +++ LVM2/lib/locking/locking.c 2009/05/19 10:39:00 1.58 @@ -482,3 +482,21 @@ return (_locking.flags & LCK_CLUSTERED) ? 1 : 0; } +int remote_lock_held(const char *vol) +{ + int mode = LCK_NULL; + + if (!locking_is_clustered()) + return 0; + + /* + * If an error occured, expect that volume is active + */ + if (!_locking.lock_resource_query || + !_locking.lock_resource_query(vol, &mode)) { + stack; + return 1; + } + + return mode == LCK_NULL ? 0 : 1; +} --- LVM2/lib/locking/locking.h 2009/04/22 09:39:46 1.45 +++ LVM2/lib/locking/locking.h 2009/05/19 10:39:00 1.46 @@ -25,6 +25,8 @@ int vg_write_lock_held(void); int locking_is_clustered(void); +int remote_lock_held(const char *vol); + /* * LCK_VG: * Lock/unlock on-disk volume group data. --- LVM2/lib/locking/locking_types.h 2007/08/22 14:38:17 1.15 +++ LVM2/lib/locking/locking_types.h 2009/05/19 10:39:00 1.16 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -18,6 +18,7 @@ typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, uint32_t flags); +typedef int (*lock_resource_query_fn) (const char *resource, int *mode); typedef void (*fin_lock_fn) (void); typedef void (*reset_lock_fn) (void); @@ -28,6 +29,7 @@ struct locking_type { uint32_t flags; lock_resource_fn lock_resource; + lock_resource_query_fn lock_resource_query; reset_lock_fn reset_locking; fin_lock_fn fin_locking; From wysochanski@sourceware.org Tue May 19 15:47:00 2009 From: wysochanski@sourceware.org (wysochanski@sourceware.org) Date: Tue, 19 May 2009 15:47:00 -0000 Subject: LVM2/test t-mirror-lvconvert.sh Message-ID: <20090519154752.27013.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-05-19 15:47:50 Modified files: test : t-mirror-lvconvert.sh Log message: Add test - lvconvert from linear (on multiple PVs) to mirror. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mirror-lvconvert.sh.diff?cvsroot=lvm2&r1=1.7&r2=1.8 --- LVM2/test/t-mirror-lvconvert.sh 2008/11/10 12:41:52 1.7 +++ LVM2/test/t-mirror-lvconvert.sh 2009/05/19 15:47:50 1.8 @@ -312,4 +312,12 @@ lvconvert -m0 $vg/$lv1 lvconvert -m1 $vg/$lv1 lvs --noheadings -o attr $vg/$lv1 | grep '^ *m' +check_and_cleanup_lvs_ +# lvconvert from linear (on multiple PVs) to mirror +prepare_lvs_ +lvcreate -l 8 -n $lv1 $vg $dev1:0-3 $dev2:0-3 +lvconvert -m1 $vg/$lv1 +check_mirror_count_ $vg/$lv1 2 +check_mirror_log_ $vg/$lv1 +check_and_cleanup_lvs_ From mbroz@sourceware.org Wed May 20 09:52:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 20 May 2009 09:52:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ... Message-ID: <20090520095238.12545.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-20 09:52:37 Modified files: . : WHATS_NEW lib/activate : activate.c dev_manager.c dev_manager.h libdm : .exported_symbols libdevmapper.h libdm-deptree.c tools : lvresize.c Log message: Use suspend with flush when device size was changed during table preload. This allows online mirror resize, also removes condition to preventing code to do this. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1116&r2=1.1117 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.148&r2=1.149 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.148&r2=1.149 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.h.diff?cvsroot=lvm2&r1=1.28&r2=1.29 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/.exported_symbols.diff?cvsroot=lvm2&r1=1.34&r2=1.35 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.86&r2=1.87 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108 --- LVM2/WHATS_NEW 2009/05/19 10:38:58 1.1116 +++ LVM2/WHATS_NEW 2009/05/20 09:52:37 1.1117 @@ -1,5 +1,7 @@ Version 2.02.46 - ================================ + Enable online resizing of mirrors. + Use suspend with flush when device size was changed during table preload. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. Use lvconvert --repair in dmeventd mirror DSO. Fix pvmove to revert operation if temporary mirror creation fails. --- LVM2/lib/activate/activate.c 2009/05/19 10:39:00 1.148 +++ LVM2/lib/activate/activate.c 2009/05/20 09:52:37 1.149 @@ -589,7 +589,7 @@ return r; } -static int _lv_preload(struct logical_volume *lv) +static int _lv_preload(struct logical_volume *lv, int *flush_required) { int r; struct dev_manager *dm; @@ -597,7 +597,7 @@ if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name))) return_0; - if (!(r = dev_manager_preload(dm, lv))) + if (!(r = dev_manager_preload(dm, lv, flush_required))) stack; dev_manager_destroy(dm); @@ -619,7 +619,7 @@ return r; } -static int _lv_suspend_lv(struct logical_volume *lv, int lockfs) +static int _lv_suspend_lv(struct logical_volume *lv, int lockfs, int flush_required) { int r; struct dev_manager *dm; @@ -627,7 +627,7 @@ if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name))) return_0; - if (!(r = dev_manager_suspend(dm, lv, lockfs))) + if (!(r = dev_manager_suspend(dm, lv, lockfs, flush_required))) stack; dev_manager_destroy(dm); @@ -831,7 +831,7 @@ { struct logical_volume *lv = NULL, *lv_pre = NULL; struct lvinfo info; - int r = 0, lockfs = 0; + int r = 0, lockfs = 0, flush_required = 0; if (!activation()) return 1; @@ -859,7 +859,7 @@ /* If VG was precommitted, preload devices for the LV */ if ((lv_pre->vg->status & PRECOMMITTED)) { - if (!_lv_preload(lv_pre)) { + if (!_lv_preload(lv_pre, &flush_required)) { /* FIXME Revert preloading */ goto_out; } @@ -874,7 +874,7 @@ if (lv_is_origin(lv_pre) || lv_is_cow(lv_pre)) lockfs = 1; - if (!_lv_suspend_lv(lv, lockfs)) { + if (!_lv_suspend_lv(lv, lockfs, flush_required)) { memlock_dec(); fs_unlock(); goto out; --- LVM2/lib/activate/dev_manager.c 2009/05/13 14:13:55 1.148 +++ LVM2/lib/activate/dev_manager.c 2009/05/20 09:52:37 1.149 @@ -49,6 +49,7 @@ void *target_state; uint32_t pvmove_mirror_count; + int flush_required; char *vg_name; }; @@ -1164,7 +1165,7 @@ break; case SUSPEND: dm_tree_skip_lockfs(root); - if ((lv->status & MIRRORED) && !(lv->status & PVMOVE)) + if (!dm->flush_required && (lv->status & MIRRORED) && !(lv->status & PVMOVE)) dm_tree_use_no_flush_suspend(root); case SUSPEND_WITH_LOCKFS: if (!dm_tree_suspend_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) @@ -1180,6 +1181,9 @@ if (!dm_tree_preload_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) goto_out; + if (dm_tree_node_size_changed(root)) + dm->flush_required = 1; + if ((action == ACTIVATE) && !dm_tree_activate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1)) goto_out; @@ -1210,13 +1214,19 @@ return _tree_action(dm, lv, CLEAN); } -int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv) +int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, + int *flush_required) { /* FIXME Update the pvmove implementation! */ if ((lv->status & PVMOVE) || (lv->status & LOCKED)) return 1; - return _tree_action(dm, lv, PRELOAD); + if (!_tree_action(dm, lv, PRELOAD)) + return 0; + + *flush_required = dm->flush_required; + + return 1; } int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv) @@ -1231,8 +1241,10 @@ } int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv, - int lockfs) + int lockfs, int flush_required) { + dm->flush_required = flush_required; + return _tree_action(dm, lv, lockfs ? SUSPEND_WITH_LOCKFS : SUSPEND); } --- LVM2/lib/activate/dev_manager.h 2007/11/12 20:51:53 1.28 +++ LVM2/lib/activate/dev_manager.h 2009/05/20 09:52:37 1.29 @@ -49,9 +49,10 @@ struct logical_volume *lv, int wait, float *percent, uint32_t *event_nr); int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv, - int lockfs); + int lockfs, int flush_required); int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv); -int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv); +int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, + int *flush_required); int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv); int dev_manager_lv_mknodes(const struct logical_volume *lv); --- LVM2/libdm/.exported_symbols 2008/11/03 20:03:00 1.34 +++ LVM2/libdm/.exported_symbols 2009/05/20 09:52:37 1.35 @@ -49,6 +49,7 @@ dm_tree_node_get_uuid dm_tree_node_get_info dm_tree_node_get_context +dm_tree_node_size_changed dm_tree_node_num_children dm_tree_node_num_parents dm_tree_find_node --- LVM2/libdm/libdevmapper.h 2008/11/04 15:07:45 1.86 +++ LVM2/libdm/libdevmapper.h 2009/05/20 09:52:37 1.87 @@ -288,6 +288,7 @@ const char *dm_tree_node_get_uuid(struct dm_tree_node *node); const struct dm_info *dm_tree_node_get_info(struct dm_tree_node *node); void *dm_tree_node_get_context(struct dm_tree_node *node); +int dm_tree_node_size_changed(struct dm_tree_node *dnode); /* * Returns the number of children of the given node (excluding the root node). --- LVM2/libdm/libdm-deptree.c 2008/12/12 18:45:58 1.49 +++ LVM2/libdm/libdm-deptree.c 2009/05/20 09:52:37 1.50 @@ -640,6 +640,11 @@ return node->context; } +int dm_tree_node_size_changed(struct dm_tree_node *dnode) +{ + return dnode->props.size_changed; +} + int dm_tree_node_num_children(struct dm_tree_node *node, uint32_t inverted) { if (inverted) { @@ -1481,6 +1486,10 @@ } } + /* Propagate device size change change */ + if (child->props.size_changed) + dnode->props.size_changed = 1; + /* Resume device immediately if it has parents and its size changed */ if (!dm_tree_node_num_children(child, 1) || !child->props.size_changed) continue; --- LVM2/tools/lvresize.c 2009/04/21 14:31:58 1.107 +++ LVM2/tools/lvresize.c 2009/05/20 09:52:37 1.108 @@ -550,12 +550,6 @@ lp->resize = LV_EXTEND; } - if (lp->mirrors && activation() && - lv_info(cmd, lv, &info, 0, 0) && info.exists) { - log_error("Mirrors cannot be resized while active yet."); - return ECMD_FAILED; - } - if (lv_is_origin(lv)) { if (lp->resize == LV_REDUCE) { log_error("Snapshot origin volumes cannot be reduced " From mbroz@sourceware.org Wed May 20 09:55:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 20 May 2009 09:55:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ... Message-ID: <20090520095535.13608.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-20 09:55:34 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c tools : lvchange.c Log message: Use lock query instead of activate_lv_excl - switch lvremove to not force activate volume when removing - ditto for force resync - fix some wrong return codes in lvchange_resync() Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1117&r2=1.1118 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.172&r2=1.173 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101 --- LVM2/WHATS_NEW 2009/05/20 09:52:37 1.1117 +++ LVM2/WHATS_NEW 2009/05/20 09:55:33 1.1118 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Use lock query instead of activate_lv_excl. Enable online resizing of mirrors. Use suspend with flush when device size was changed during table preload. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. --- LVM2/lib/metadata/lv_manip.c 2009/05/13 21:29:10 1.172 +++ LVM2/lib/metadata/lv_manip.c 2009/05/20 09:55:34 1.173 @@ -2036,28 +2036,13 @@ return 0; } - /* - * Check for confirmation prompts in the following cases: - * 1) Clustered VG, and some remote nodes have the LV active - * 2) Non-clustered VG, but LV active locally - */ - if (vg_is_clustered(vg) && !activate_lv_excl(cmd, lv) && - (force == PROMPT)) { - if (yes_no_prompt("Logical volume \"%s\" is active on other " - "cluster nodes. Really remove? [y/n]: ", - lv->name) == 'n') { - log_print("Logical volume \"%s\" not removed", - lv->name); - return 0; - } - } else if (info.exists && (force == PROMPT)) { - if (yes_no_prompt("Do you really want to remove active " - "logical volume \"%s\"? [y/n]: ", - lv->name) == 'n') { - log_print("Logical volume \"%s\" not removed", - lv->name); - return 0; - } + if (lv_is_active(lv) && (force == PROMPT) && + yes_no_prompt("Do you really want to remove active " + "%slogical volume %s? [y/n]: ", + vg_is_clustered(vg) ? "clustered " : "", + lv->name) == 'n') { + log_print("Logical volume %s not removed", lv->name); + return 0; } } --- LVM2/tools/lvchange.c 2009/05/13 21:27:44 1.100 +++ LVM2/tools/lvchange.c 2009/05/20 09:55:34 1.101 @@ -201,7 +201,7 @@ if (info.open_count) { log_error("Can't resync open logical volume \"%s\"", lv->name); - return ECMD_FAILED; + return 0; } if (info.exists) { @@ -211,11 +211,11 @@ lv->name) == 'n') { log_print("Logical volume \"%s\" not resynced", lv->name); - return ECMD_FAILED; + return 0; } if (sigint_caught()) - return ECMD_FAILED; + return 0; active = 1; } @@ -225,17 +225,17 @@ monitored = dmeventd_monitor_mode(); init_dmeventd_monitor(0); - if (vg_is_clustered(lv->vg) && !activate_lv_excl(cmd, lv)) { - log_error("Can't get exclusive access to clustered volume %s", - lv->name); - return ECMD_FAILED; - } - if (!deactivate_lv(cmd, lv)) { log_error("Unable to deactivate %s for resync", lv->name); return 0; } + if (vg_is_clustered(lv->vg) && lv_is_active(lv)) { + log_error("Can't get exclusive access to clustered volume %s", + lv->name); + return 0; + } + init_dmeventd_monitor(monitored); log_lv = first_seg(lv)->log_lv; From mbroz@sourceware.org Wed May 20 11:09:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 20 May 2009 11:09:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/activate.c lib/a ... Message-ID: <20090520110951.1224.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-20 11:09:50 Modified files: . : WHATS_NEW lib/activate : activate.c dev_manager.c lib/device : dev-cache.c dev-io.c device.h lib/metadata : metadata.c metadata.h test : t-read-ahead.sh Log message: Use readahead of underlying device and not default (smaller) one. When we are stacking LV over device, which has for some reason increased read_ahead (e.g. MD RAID), the read_ahead hint for libdevmapper is wrong (it is zero). If the calculated read_ahead hint is zero, patch uses read_ahead of underlying device (if first segment is PV) when setting DM_READ_AHEAD_MINIMUM_FLAG. Because we are using dev-cache, it also store this value to cache for future use (if several LVs are over one PV, BLKRAGET is called only once for underlying device.) This should fix all the reamining problems with readahead mismatch reported for DM over MD configurations (and similar cases). Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1118&r2=1.1119 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.149&r2=1.150 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.149&r2=1.150 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-io.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.38&r2=1.39 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.219&r2=1.220 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.194&r2=1.195 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-read-ahead.sh.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/WHATS_NEW 2009/05/20 09:55:33 1.1118 +++ LVM2/WHATS_NEW 2009/05/20 11:09:49 1.1119 @@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Inherit read ahead from underlying device. Use lock query instead of activate_lv_excl. Enable online resizing of mirrors. Use suspend with flush when device size was changed during table preload. --- LVM2/lib/activate/activate.c 2009/05/20 09:52:37 1.149 +++ LVM2/lib/activate/activate.c 2009/05/20 11:09:49 1.150 @@ -469,6 +469,11 @@ info->live_table = dminfo.live_table; info->inactive_table = dminfo.inactive_table; + /* + * Cache read ahead value for PV devices now (before possible suspend) + */ + (void)lv_calculate_readhead(lv); + if (name) dm_pool_free(cmd->mem, name); --- LVM2/lib/activate/dev_manager.c 2009/05/20 09:52:37 1.149 +++ LVM2/lib/activate/dev_manager.c 2009/05/20 11:09:49 1.150 @@ -1022,6 +1022,8 @@ if (read_ahead == DM_READ_AHEAD_AUTO) { /* we need RA at least twice a whole stripe - see the comment in md/raid0.c */ read_ahead = max_stripe_size * 2; + if (!read_ahead) + read_ahead = lv_calculate_readhead(lv); read_ahead_flags = DM_READ_AHEAD_MINIMUM_FLAG; } --- LVM2/lib/device/dev-cache.c 2008/11/03 22:14:27 1.54 +++ LVM2/lib/device/dev-cache.c 2009/05/20 11:09:49 1.55 @@ -104,6 +104,7 @@ dev->fd = -1; dev->open_count = 0; dev->block_size = -1; + dev->read_ahead = -1; memset(dev->pvid, 0, sizeof(dev->pvid)); dm_list_init(&dev->open_list); @@ -124,6 +125,7 @@ dev->fd = -1; dev->open_count = 0; dev->block_size = -1; + dev->read_ahead = -1; dev->end = UINT64_C(0); memset(dev->pvid, 0, sizeof(dev->pvid)); dm_list_init(&dev->open_list); --- LVM2/lib/device/dev-io.c 2009/01/10 02:43:51 1.64 +++ LVM2/lib/device/dev-io.c 2009/05/20 11:09:49 1.65 @@ -262,6 +262,37 @@ return 1; } +static int _dev_read_ahead_dev(struct device *dev, uint32_t *read_ahead) +{ + long read_ahead_long; + + if (dev->read_ahead != -1) { + *read_ahead = (uint32_t) dev->read_ahead; + return 1; + } + + if (!dev_open(dev)) + return_0; + + if (ioctl(dev->fd, BLKRAGET, &read_ahead_long) < 0) { + log_sys_error("ioctl BLKRAGET", dev_name(dev)); + if (!dev_close(dev)) + stack; + return 0; + } + + if (!dev_close(dev)) + stack; + + *read_ahead = (uint32_t) read_ahead_long; + dev->read_ahead = read_ahead_long; + + log_very_verbose("%s: read_ahead is %u sectors", + dev_name(dev), *read_ahead); + + return 1; +} + /*----------------------------------------------------------------- * Public functions *---------------------------------------------------------------*/ @@ -277,6 +308,19 @@ return _dev_get_size_dev(dev, size); } +int dev_get_read_ahead(struct device *dev, uint32_t *read_ahead) +{ + if (!dev) + return 0; + + if (dev->flags & DEV_REGULAR) { + *read_ahead = 0; + return 1; + } + + return _dev_read_ahead_dev(dev, read_ahead); +} + /* FIXME Unused int dev_get_sectsize(struct device *dev, uint32_t *size) { --- LVM2/lib/device/device.h 2009/03/17 13:59:56 1.38 +++ LVM2/lib/device/device.h 2009/05/20 11:09:49 1.39 @@ -40,6 +40,7 @@ int fd; int open_count; int block_size; + int read_ahead; uint32_t flags; uint64_t end; struct dm_list open_list; @@ -64,6 +65,7 @@ */ int dev_get_size(const struct device *dev, uint64_t *size); int dev_get_sectsize(struct device *dev, uint32_t *size); +int dev_get_read_ahead(struct device *dev, uint32_t *read_ahead); /* Use quiet version if device number could change e.g. when opening LV */ int dev_open(struct device *dev); --- LVM2/lib/metadata/metadata.c 2009/05/13 21:29:10 1.219 +++ LVM2/lib/metadata/metadata.c 2009/05/20 11:09:49 1.220 @@ -1414,6 +1414,35 @@ return 1; } +/* + * Be sure that all PV devices have cached read ahead in dev-cache + * Currently it takes read_ahead from first PV segment only + */ +static int _lv_read_ahead_single(struct logical_volume *lv, void *data) +{ + struct lv_segment *seg = first_seg(lv); + uint32_t seg_read_ahead = 0, *read_ahead = data; + + if (seg && seg_type(seg, 0) == AREA_PV) + dev_get_read_ahead(seg_pv(seg, 0)->dev, &seg_read_ahead); + + if (seg_read_ahead > *read_ahead) + *read_ahead = seg_read_ahead; + + return 1; +} + +uint32_t lv_calculate_readhead(const struct logical_volume *lv) +{ + uint32_t read_ahead = 0; + + if (lv->read_ahead == DM_READ_AHEAD_AUTO) + _lv_postorder((struct logical_volume *)lv, _lv_read_ahead_single, &read_ahead); + + log_debug("Calculated readahead of LV %s is %u", lv->name, read_ahead); + return read_ahead; +} + int vg_validate(struct volume_group *vg) { struct pv_list *pvl, *pvl2; --- LVM2/lib/metadata/metadata.h 2009/05/13 21:27:43 1.194 +++ LVM2/lib/metadata/metadata.h 2009/05/20 11:09:49 1.195 @@ -345,6 +345,11 @@ unsigned snapshot_count(const struct volume_group *vg); /* + * Calculate readahead from underlying PV devices + */ +uint32_t lv_calculate_readhead(const struct logical_volume *lv); + +/* * For internal metadata caching. */ int export_vg_to_buffer(struct volume_group *vg, char **buf); --- LVM2/test/t-read-ahead.sh 2009/05/11 16:17:12 1.5 +++ LVM2/test/t-read-ahead.sh 2009/05/20 11:09:50 1.6 @@ -32,17 +32,21 @@ aux prepare_vg 5 #COMM "test various read ahead settings (bz450922)" -lvcreate -n "$lv" -l 100%FREE -i5 -I256 "$vg" +lvcreate -n "$lv" -l 100%FREE -i5 -I256 "$vg" ra="$(get_lvs_ lv_kernel_read_ahead)" test "$(( ( $ra / 5 ) * 5 ))" -eq $ra -lvdisplay "$vg"/"$lv" -lvchange -r auto "$vg"/"$lv" 2>&1 | grep auto -check_lvs_ lv_read_ahead auto -check_lvs_ lv_kernel_read_ahead 5120 -lvchange -r 400 "$vg/$lv" -check_lvs_ lv_read_ahead 400 +lvdisplay "$vg"/"$lv" +lvchange -r auto "$vg"/"$lv" 2>&1 | grep auto +check_lvs_ lv_read_ahead auto +check_lvs_ lv_kernel_read_ahead 5120 +lvchange -r 400 "$vg/$lv" +check_lvs_ lv_read_ahead 400 lvremove -ff "$vg" +#COMM "read ahead is properly inherited from underlying PV" +blockdev --setra 768 $dev1 +lvcreate -n $lv -L4M $vg $dev1 +test $(blockdev --getra $G_dev_/$vg/$lv) -eq 768 # Check default, active/inactive values for read_ahead / kernel_read_ahead lvcreate -n $lv -l 50%FREE $vg lvchange -an $vg/$lv From mbroz@sourceware.org Wed May 20 11:27:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 20 May 2009 11:27:00 -0000 Subject: LVM2/test t-read-ahead.sh Message-ID: <20090520112715.8784.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-20 11:27:15 Modified files: test : t-read-ahead.sh Log message: Fix readahead test. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-read-ahead.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7 --- LVM2/test/t-read-ahead.sh 2009/05/20 11:09:50 1.6 +++ LVM2/test/t-read-ahead.sh 2009/05/20 11:27:14 1.7 @@ -47,6 +47,8 @@ blockdev --setra 768 $dev1 lvcreate -n $lv -L4M $vg $dev1 test $(blockdev --getra $G_dev_/$vg/$lv) -eq 768 +lvremove -ff $vg + # Check default, active/inactive values for read_ahead / kernel_read_ahead lvcreate -n $lv -l 50%FREE $vg lvchange -an $vg/$lv From mbroz@sourceware.org Wed May 20 12:58:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Wed, 20 May 2009 12:58:00 -0000 Subject: LVM2/lib activate/activate.c locking/.exported ... Message-ID: <20090520125805.17982.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-20 12:58:04 Modified files: lib/activate : activate.c lib/locking : .exported_symbols external_locking.c locking.c Log message: Fix locking query compatibility with old external locking libraries. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.150&r2=1.151 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/.exported_symbols.diff?cvsroot=lvm2&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/external_locking.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59 --- LVM2/lib/activate/activate.c 2009/05/20 11:09:49 1.150 +++ LVM2/lib/activate/activate.c 2009/05/20 12:58:03 1.151 @@ -694,13 +694,30 @@ */ int lv_is_active(struct logical_volume *lv) { + int ret; + if (_lv_active(lv->vg->cmd, lv, 0)) return 1; if (!vg_is_clustered(lv->vg)) return 0; - return remote_lock_held(lv->lvid.s); + if ((ret = remote_lock_held(lv->lvid.s)) >= 0) + return ret; + + /* + * Old compatibility code if locking doesn't support lock query + * FIXME: check status to not deactivate already activate device + */ + if (activate_lv_excl(lv->vg->cmd, lv)) { + deactivate_lv(lv->vg->cmd, lv); + return 0; + } + + /* + * Exclusive local activation failed so assume it is active elsewhere. + */ + return 1; } /* --- LVM2/lib/locking/.exported_symbols 2004/06/24 08:16:09 1.1 +++ LVM2/lib/locking/.exported_symbols 2009/05/20 12:58:04 1.2 @@ -1,4 +1,5 @@ locking_init locking_end lock_resource +lock_resource_query reset_locking --- LVM2/lib/locking/external_locking.c 2008/01/30 13:59:59 1.15 +++ LVM2/lib/locking/external_locking.c 2009/05/20 12:58:04 1.16 @@ -26,6 +26,7 @@ uint32_t flags) = NULL; static int (*_init_fn) (int type, struct config_tree * cft, uint32_t *flags) = NULL; +static int (*_lock_query_fn) (const char *resource, int *mode) = NULL; static int _lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags) @@ -88,6 +89,10 @@ return 0; } + if (!(_lock_query_fn = dlsym(_locking_lib, "lock_resource_query"))) + log_warn("WARNING: %s: _lock_resource_query() missing: " + "Using inferior activation method.", libname); + log_verbose("Loaded external locking library %s", libname); return _init_fn(2, cmd->cft, &locking->flags); } --- LVM2/lib/locking/locking.c 2009/05/19 10:39:00 1.58 +++ LVM2/lib/locking/locking.c 2009/05/20 12:58:04 1.59 @@ -489,11 +489,13 @@ if (!locking_is_clustered()) return 0; + if (!_locking.lock_resource_query) + return -1; + /* * If an error occured, expect that volume is active */ - if (!_locking.lock_resource_query || - !_locking.lock_resource_query(vol, &mode)) { + if (!_locking.lock_resource_query(vol, &mode)) { stack; return 1; } From agk@sourceware.org Wed May 20 22:24:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 20 May 2009 22:24:00 -0000 Subject: LVM2 ./WHATS_NEW daemons/dmeventd/plugins/mirr ... Message-ID: <20090520222449.32576.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-20 22:24:49 Modified files: . : WHATS_NEW daemons/dmeventd/plugins/mirror: dmeventd_mirror.c Log message: Revert: Use lvconvert --repair in dmeventd mirror DSO. for now. It replaces bad behaviour in one set of circumstances with bad behaviour in a different set. We think the behaviour needs to be more configurable. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1119&r2=1.1120 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 --- LVM2/WHATS_NEW 2009/05/20 11:09:49 1.1119 +++ LVM2/WHATS_NEW 2009/05/20 22:24:48 1.1120 @@ -5,7 +5,6 @@ Enable online resizing of mirrors. Use suspend with flush when device size was changed during table preload. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. - Use lvconvert --repair in dmeventd mirror DSO. Fix pvmove to revert operation if temporary mirror creation fails. Fix metadata export for VG with missing PVs. Add vgimportclone and install it and the man page by default. --- LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009/05/19 10:25:16 1.21 +++ LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c 2009/05/20 22:24:49 1.22 @@ -152,7 +152,7 @@ } /* FIXME Is any sanity-checking required on %s? */ - if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "lvconvert --config devices{ignore_suspended_devices=1} --repair %s/%s", vg, lv)) { + if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing --force %s", vg)) { /* this error should be caught above, but doesn't hurt to check again */ syslog(LOG_ERR, "Unable to form LVM command: Device name too long"); dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */ From agk@sourceware.org Wed May 20 22:44:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 20 May 2009 22:44:00 -0000 Subject: LVM2 WHATS_NEW_DM Message-ID: <20090520224411.6015.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-20 22:44:11 Modified files: . : WHATS_NEW_DM Log message: Missing entries. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.266&r2=1.267 --- LVM2/WHATS_NEW_DM 2009/04/24 11:30:49 1.266 +++ LVM2/WHATS_NEW_DM 2009/05/20 22:44:10 1.267 @@ -1,6 +1,10 @@ Version 1.02.32 - ================================ - Fix segfault when using -U, -G and -M options in dmsetup. + Only generate libdevmapper.a when configured to link statically. + Export dm_tree_node_size_changed() from libdevmapper. + Propagate the table size_changed property up the dm device tree. + Detect failure to free memory pools when releasing the library. + Fix segfault when getopt processes dmsetup -U, -G and -M options. Version 1.02.31 - 3rd March 2009 ================================ From agk@sourceware.org Thu May 21 03:05:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 21 May 2009 03:05:00 -0000 Subject: LVM2 ./VERSION ./VERSION_DM ./WHATS_NEW ./WHAT ... Message-ID: <20090521030459.20466.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-21 03:04:54 Modified files: . : VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM lib/activate : activate.c lib/locking : .exported_symbols cluster_locking.c external_locking.c locking.c locking.h locking_types.h lib/metadata : lv_manip.c metadata-exported.h metadata.c mirror.c snapshot_manip.c lib/report : columns.h tools : lvconvert.c lvcreate.c lvrename.c lvresize.c polldaemon.c pvchange.c pvmove.c toollib.c vgchange.c vgconvert.c vgextend.c vgmerge.c vgreduce.c vgrename.c vgscan.c vgsplit.c Log message: Pre-release cleanups. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.193&r2=1.194 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1120&r2=1.1121 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.267&r2=1.268 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.151&r2=1.152 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/.exported_symbols.diff?cvsroot=lvm2&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.34&r2=1.35 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/external_locking.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.46&r2=1.47 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking_types.h.diff?cvsroot=lvm2&r1=1.16&r2=1.17 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.173&r2=1.174 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.73&r2=1.74 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.220&r2=1.221 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.36&r2=1.37 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.188&r2=1.189 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.108&r2=1.109 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvchange.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.59&r2=1.60 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.152&r2=1.153 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgscan.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74 --- LVM2/VERSION 2009/03/03 18:25:05 1.193 +++ LVM2/VERSION 2009/05/21 03:04:52 1.194 @@ -1 +1 @@ -2.02.46-cvs (2009-03-03) +2.02.46-cvs (2009-05-21) --- LVM2/VERSION_DM 2009/03/03 18:25:05 1.7 +++ LVM2/VERSION_DM 2009/05/21 03:04:52 1.8 @@ -1 +1 @@ -1.02.32-cvs (2009-03-03) +1.02.32-cvs (2009-05-21) --- LVM2/WHATS_NEW 2009/05/20 22:24:48 1.1120 +++ LVM2/WHATS_NEW 2009/05/21 03:04:52 1.1121 @@ -1,9 +1,11 @@ -Version 2.02.46 - -================================ - Inherit read ahead from underlying device. - Use lock query instead of activate_lv_excl. +Version 2.02.46 - 21st May 2009 +=============================== + Inherit readahead setting from underlying devices during activation. + Detect LVs active on remote nodes by querying locks if supported. Enable online resizing of mirrors. Use suspend with flush when device size was changed during table preload. + Implement query_resource_fn for cluster_locking. + Support query_resource_fn in locking modules. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. Fix pvmove to revert operation if temporary mirror creation fails. Fix metadata export for VG with missing PVs. @@ -11,7 +13,7 @@ Force max_lv restriction only for newly created LV. Remove unneeded import parameter from lv_create_empty. Merge lv_is_displayable and lv_is_visible functions. - Introduce lv_set_visible & lv_set_invisible functions. + Introduce lv_set_visible & lv_set_hidden functions. Fix lv_is_visible to handle virtual origin. Introduce link_lv_to_vg and unlink_lv_from_vg functions. Remove lv_count from VG and use counter function instead. @@ -20,15 +22,18 @@ Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. Remove snapshot_count from VG and use function instead. Fix first_seg() call for empty segment list. - Add make install_lvm2 as complement to device-mapper install. + Add install_lvm2 makefile target to install only the LVM2 components. Reject missing PVs from allocation in toollib. Fix PV datalignment for values starting prior to MDA area. (2.02.45) Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). + Fix minimum width of devices column in reports. Add lvs origin_size field. Fix linux configure --enable-debug to exclude -O2. - Implement lvconvert --repair, for repairing partially failed mirrors. + Implement lvconvert --repair for repairing partially-failed mirrors. Fix vgreduce --removemissing failure exit code. Fix remote metadata backup for clvmd. + Introduce unlock_and_release_vg macro. + Introduce vg_release() to be called to free every struct volume_group. Alloc PV internal structure from VG mempool if possible. Fix metadata backup to run after vg_commit always. Tidy clvmd volume lock cache functions. @@ -36,12 +41,11 @@ Fix pvs -a output to not read volume groups from non-PV devices. Add MMC (mmcblk) device type to filters. Introduce memory pools per volume group (to reduce memory for large VGs). - Add memory pool leaks detection. - Use copy of PV structure when manipulating with global PV lists. + Use copy of PV structure when manipulating global PV lists. Always return exit error status when locking of volume group fails. Fix mirror log convert validation question. Avoid referencing files from DESTDIR during build process. - Avoid creating some static libraries without static_link. + Avoid creating some static libraries unless configured --enable-static_link. Enable use of cached metadata for pvs and pvdisplay commands. Add missing 'device-mapper' internal subdir build dependency. Fix memory leak in mirror allocation code. @@ -52,14 +56,15 @@ Block SIGTERM & SIGINT in clvmd subthreads. Detect and conditionally wipe swapspace signatures in pvcreate. Fix maximal volume count check for snapshots if max_lv set for volume group. - Fix lvcreate to remove cow volume if the snapshot creation fails. + Fix lvcreate to remove unused cow volume if the snapshot creation fails. Fix error messages when PV uuid or pe_start reading fails. - Rename liblvm.a to liblvm-internal.a and build new application library. + Build new liblvm application-level library. + Rename liblvm.a to liblvm-internal.a. Flush memory pool and fix locking in clvmd refresh and backup command. - Fix unlocks in clvmd-corosync. Broken in 2.02.45. + Fix unlocks in clvmd-corosync. (2.02.45) Fix error message when adding metadata directory to internal list fails. Fix size and error message of memory allocation at backup initialization. - Remove old metadata backup file after renaming vg. + Remove old metadata backup file after renaming VG. Restore log_suppress state when metadata backup file is up-to-date. Version 2.02.45 - 3rd March 2009 --- LVM2/WHATS_NEW_DM 2009/05/20 22:44:10 1.267 +++ LVM2/WHATS_NEW_DM 2009/05/21 03:04:52 1.268 @@ -1,5 +1,5 @@ -Version 1.02.32 - -================================ +Version 1.02.32 - 21st May 2009 +=============================== Only generate libdevmapper.a when configured to link statically. Export dm_tree_node_size_changed() from libdevmapper. Propagate the table size_changed property up the dm device tree. --- LVM2/lib/activate/activate.c 2009/05/20 12:58:03 1.151 +++ LVM2/lib/activate/activate.c 2009/05/21 03:04:52 1.152 @@ -711,7 +711,7 @@ */ if (activate_lv_excl(lv->vg->cmd, lv)) { deactivate_lv(lv->vg->cmd, lv); - return 0; + return 0; } /* --- LVM2/lib/locking/.exported_symbols 2009/05/20 12:58:04 1.2 +++ LVM2/lib/locking/.exported_symbols 2009/05/21 03:04:53 1.3 @@ -1,5 +1,5 @@ locking_init locking_end lock_resource -lock_resource_query +query_resource reset_locking --- LVM2/lib/locking/cluster_locking.c 2009/05/19 10:39:00 1.34 +++ LVM2/lib/locking/cluster_locking.c 2009/05/21 03:04:53 1.35 @@ -33,7 +33,7 @@ #ifndef CLUSTER_LOCKING_INTERNAL int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags); -int lock_resource_query(const char *resource, int *mode); +int query_resource(const char *resource, int *mode); void locking_end(void); int locking_init(int type, struct config_tree *cf, uint32_t *flags); #endif @@ -472,9 +472,9 @@ } #ifdef CLUSTER_LOCKING_INTERNAL -static int _lock_resource_query(const char *resource, int *mode) +static int _query_resource(const char *resource, int *mode) #else -int lock_resource_query(const char *resource, int *mode) +int query_resource(const char *resource, int *mode) #endif { int i, status, len, num_responses, saved_errno; @@ -549,7 +549,7 @@ int init_cluster_locking(struct locking_type *locking, struct cmd_context *cmd) { locking->lock_resource = _lock_resource; - locking->lock_resource_query = _lock_resource_query; + locking->query_resource = _query_resource; locking->fin_locking = _locking_end; locking->reset_locking = _reset_locking; locking->flags = LCK_PRE_MEMLOCK | LCK_CLUSTERED; --- LVM2/lib/locking/external_locking.c 2009/05/20 12:58:04 1.16 +++ LVM2/lib/locking/external_locking.c 2009/05/21 03:04:53 1.17 @@ -89,8 +89,8 @@ return 0; } - if (!(_lock_query_fn = dlsym(_locking_lib, "lock_resource_query"))) - log_warn("WARNING: %s: _lock_resource_query() missing: " + if (!(_lock_query_fn = dlsym(_locking_lib, "query_resource"))) + log_warn("WARNING: %s: _query_resource() missing: " "Using inferior activation method.", libname); log_verbose("Loaded external locking library %s", libname); --- LVM2/lib/locking/locking.c 2009/05/20 12:58:04 1.59 +++ LVM2/lib/locking/locking.c 2009/05/21 03:04:53 1.60 @@ -489,13 +489,13 @@ if (!locking_is_clustered()) return 0; - if (!_locking.lock_resource_query) + if (!_locking.query_resource) return -1; /* * If an error occured, expect that volume is active */ - if (!_locking.lock_resource_query(vol, &mode)) { + if (!_locking.query_resource(vol, &mode)) { stack; return 1; } --- LVM2/lib/locking/locking.h 2009/05/19 10:39:00 1.46 +++ LVM2/lib/locking/locking.h 2009/05/21 03:04:53 1.47 @@ -118,9 +118,11 @@ lock_vol(cmd, (lv)->lvid.s, flags | LCK_LV_CLUSTERED(lv)) #define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK) -#define unlock_release_vg(cmd, vg, vol) do { unlock_vg(cmd, vol); \ - vg_release(vg); \ - } while (0) +#define unlock_and_release_vg(cmd, vg, vol) \ + do { \ + unlock_vg(cmd, vol); \ + vg_release(vg); \ + } while (0) #define resume_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_RESUME) #define suspend_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD) --- LVM2/lib/locking/locking_types.h 2009/05/19 10:39:00 1.16 +++ LVM2/lib/locking/locking_types.h 2009/05/21 03:04:53 1.17 @@ -18,7 +18,7 @@ typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, uint32_t flags); -typedef int (*lock_resource_query_fn) (const char *resource, int *mode); +typedef int (*query_resource_fn) (const char *resource, int *mode); typedef void (*fin_lock_fn) (void); typedef void (*reset_lock_fn) (void); @@ -29,7 +29,7 @@ struct locking_type { uint32_t flags; lock_resource_fn lock_resource; - lock_resource_query_fn lock_resource_query; + query_resource_fn query_resource; reset_lock_fn reset_locking; fin_lock_fn fin_locking; --- LVM2/lib/metadata/lv_manip.c 2009/05/20 09:55:34 1.173 +++ LVM2/lib/metadata/lv_manip.c 2009/05/21 03:04:53 1.174 @@ -1503,7 +1503,7 @@ if (!set_lv_segment_area_lv(seg, m, sub_lvs[m - old_area_count], 0, status)) return_0; - lv_set_invisible(sub_lvs[m - old_area_count]); + lv_set_hidden(sub_lvs[m - old_area_count]); } lv->status |= MIRRORED; @@ -1982,14 +1982,14 @@ log_debug("LV %s in VG %s is now visible.", lv->name, lv->vg->name); } -void lv_set_invisible(struct logical_volume *lv) +void lv_set_hidden(struct logical_volume *lv) { if (!lv_is_visible(lv)) return; lv->status &= ~VISIBLE_LV; - log_debug("LV %s in VG %s is now invisible.", lv->name, lv->vg->name); + log_debug("LV %s in VG %s is now hidden.", lv->name, lv->vg->name); } int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, --- LVM2/lib/metadata/metadata-exported.h 2009/05/13 21:29:10 1.73 +++ LVM2/lib/metadata/metadata-exported.h 2009/05/21 03:04:53 1.74 @@ -372,7 +372,7 @@ int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv); int unlink_lv_from_vg(struct logical_volume *lv); void lv_set_visible(struct logical_volume *lv); -void lv_set_invisible(struct logical_volume *lv); +void lv_set_hidden(struct logical_volume *lv); /* Set full_scan to 1 to re-read every (filtered) device label */ struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan); @@ -442,7 +442,12 @@ int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from, struct volume_group *vg_to); +/* + * vg_release() must be called on every struct volume_group allocated + * by vg_create() or vg_read_internal() to free it when no longer required. + */ void vg_release(struct volume_group *vg); + /* Manipulate LVs */ struct logical_volume *lv_create_empty(const char *name, union lvid *lvid, --- LVM2/lib/metadata/metadata.c 2009/05/20 11:09:49 1.220 +++ LVM2/lib/metadata/metadata.c 2009/05/21 03:04:53 1.221 @@ -2633,12 +2633,12 @@ if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)) || ((misc_flags & FAIL_INCONSISTENT) && !consistent)) { log_error("Volume group \"%s\" not found", vg_name); - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return NULL; } if (!vg_check_status(vg, status_flags)) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return NULL; } --- LVM2/lib/metadata/mirror.c 2009/05/13 21:28:31 1.87 +++ LVM2/lib/metadata/mirror.c 2009/05/21 03:04:53 1.88 @@ -303,7 +303,7 @@ return 0; } - lv_set_invisible(log_lv); + lv_set_hidden(log_lv); if (was_active && !activate_lv(cmd, log_lv)) return_0; @@ -1340,7 +1340,7 @@ { seg->log_lv = log_lv; log_lv->status |= MIRROR_LOG; - lv_set_invisible(log_lv); + lv_set_hidden(log_lv); return add_seg_to_segs_using_this_lv(log_lv, seg); } @@ -1466,7 +1466,7 @@ !(log_lv = _set_up_mirror_log(cmd, ah, lv, log_count, region_size, alloc, mirror_in_sync()))) { stack; - goto out_remove_imgs; + goto out_remove_images; } /* The log initialization involves vg metadata commit. @@ -1498,7 +1498,7 @@ region_size)) { log_error("Aborting. Failed to add mirror segment. " "Remove new LV and retry."); - goto out_remove_imgs; + goto out_remove_images; } if (log_count && !attach_mirror_log(first_seg(lv), log_lv)) @@ -1517,7 +1517,7 @@ else backup(log_lv->vg); } - out_remove_imgs: + out_remove_images: alloc_destroy(ah); return 0; } --- LVM2/lib/metadata/snapshot_manip.c 2009/05/13 21:28:31 1.42 +++ LVM2/lib/metadata/snapshot_manip.c 2009/05/21 03:04:53 1.43 @@ -68,7 +68,7 @@ seg->origin = origin; seg->cow = cow; - lv_set_invisible(cow); + lv_set_hidden(cow); cow->snapshot = seg; --- LVM2/lib/report/columns.h 2009/05/12 19:12:10 1.36 +++ LVM2/lib/report/columns.h 2009/05/21 03:04:53 1.37 @@ -29,18 +29,17 @@ * 3. Field type. This must be either 'STR' or 'NUM'. * 4. Report heading. This is the field heading that is displayed by the * reporting commands. - * 5. Data value pointer. This argument is is always a member of the - * containing struct. In some cases, the member points to the data value - * of the field (for example, lv_uuid - see _uuid_disp()). In other cases - * it is pointer that may be used to derive the data value (for example, - * seg_count - see _lvsegcount_disp()). In the FIELD macro definition, - * this is used in an offset calculation to derive the offset to the - * data value from the containing struct base address. Note that in some + * 5. Data value pointer. This argument is always a member of the + * containing struct. It may point directly to the data value (for example, + * lv_uuid - see _uuid_disp()) or may be used to derive the data value (for + * example, seg_count - see _lvsegcount_disp()). In the FIELD macro + * definition, it is used in an offset calculation to derive the offset to + * the data value from the containing struct base address. Note that in some * cases, the argument is the first member of the struct, in which case the * data value pointer points to the start of the struct itself (for example, * 'lvid' field of struct 'lv'). * 6. Minimum display width. This is the minimum width used to display - * the field value. + * the field value, typically matching the width of the column heading. * 7. Display function identifier. Used to derive the full name of the * function that displays this field. Derivation is done by appending '_' * then prepending this argument to '_disp'. For example, if this argument --- LVM2/tools/lvconvert.c 2009/05/19 10:27:47 1.75 +++ LVM2/tools/lvconvert.c 2009/05/21 03:04:53 1.76 @@ -371,56 +371,61 @@ if (seg_type(lvseg, s) == AREA_LV) { if (seg_lv(lvseg, s)->status & PARTIAL_LV) return 1; - } else if (seg_type(lvseg, s) == AREA_PV) { - if (seg_pv(lvseg, s)->status & MISSING_PV) - return 1; - } + } else if ((seg_type(lvseg, s) == AREA_PV) && + (seg_pv(lvseg, s)->status & MISSING_PV)) + return 1; + return 0; } /* FIXME we want to handle mirror stacks here... */ -static int _count_failed_mirrors(struct logical_volume *lv) +static int _failed_mirrors_count(struct logical_volume *lv) { struct lv_segment *lvseg; int ret = 0; int s; + dm_list_iterate_items(lvseg, &lv->segments) { if (!seg_is_mirrored(lvseg)) return -1; - for(s = 0; s < lvseg->area_count; ++s) { + for (s = 0; s < lvseg->area_count; s++) if (_area_missing(lvseg, s)) - ++ ret; - } + ret++; } + return ret; } static struct dm_list *_failed_pv_list(struct volume_group *vg) { - struct dm_list *r; + struct dm_list *failed_pvs; struct pv_list *pvl, *new_pvl; - if (!(r = dm_pool_alloc(vg->vgmem, sizeof(*r)))) { - log_error("Allocation of list failed"); - return_0; + if (!(failed_pvs = dm_pool_alloc(vg->vgmem, sizeof(*failed_pvs)))) { + log_error("Allocation of list of failed_pvs failed."); + return_NULL; } - dm_list_init(r); + dm_list_init(failed_pvs); + dm_list_iterate_items(pvl, &vg->pvs) { if (!(pvl->pv->status & MISSING_PV)) continue; if (!(new_pvl = dm_pool_alloc(vg->vgmem, sizeof(*new_pvl)))) { - log_error("Unable to allocate physical volume list."); - return_0; + log_error("Allocation of failed_pvs list entry failed."); + return_NULL; } new_pvl->pv = pvl->pv; - dm_list_add(r, &new_pvl->list); + dm_list_add(failed_pvs, &new_pvl->list); } - return r; + + return failed_pvs; } -/* walk down the stacked mirror LV to the original mirror LV */ +/* + * Walk down the stacked mirror LV to the original mirror LV. + */ static struct logical_volume *_original_lv(struct logical_volume *lv) { struct logical_volume *next_lv = lv, *tmp_lv; @@ -431,8 +436,8 @@ return next_lv; } -static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * lv, - struct lvconvert_params *lp) +static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv, + struct lvconvert_params *lp) { struct lv_segment *seg; uint32_t existing_mirrors; @@ -485,7 +490,7 @@ log_error("The mirror is consistent, nothing to repair."); return 0; } - if ((failed_mirrors = _count_failed_mirrors(lv)) < 0) + if ((failed_mirrors = _failed_mirrors_count(lv)) < 0) return_0; lp->mirrors -= failed_mirrors; log_error("Mirror status: %d/%d legs failed.", @@ -828,7 +833,7 @@ } else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) { if (!archive(lv->vg)) return ECMD_FAILED; - if (!lvconvert_mirrors(cmd, lv, lp)) + if (!_lvconvert_mirrors(cmd, lv, lp)) return ECMD_FAILED; } --- LVM2/tools/lvcreate.c 2009/05/13 21:29:10 1.188 +++ LVM2/tools/lvcreate.c 2009/05/21 03:04:53 1.189 @@ -998,6 +998,6 @@ if (!_lvcreate(cmd, vg, &lp)) r = ECMD_FAILED; - unlock_release_vg(cmd, vg, lp.vg_name); + unlock_and_release_vg(cmd, vg, lp.vg_name); return r; } --- LVM2/tools/lvrename.c 2009/04/10 10:01:38 1.49 +++ LVM2/tools/lvrename.c 2009/05/21 03:04:53 1.50 @@ -121,6 +121,6 @@ r = ECMD_PROCESSED; error: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return r; } --- LVM2/tools/lvresize.c 2009/05/20 09:52:37 1.108 +++ LVM2/tools/lvresize.c 2009/05/21 03:04:53 1.109 @@ -681,7 +681,7 @@ if (!(r = _lvresize(cmd, vg, &lp))) stack; - unlock_release_vg(cmd, vg, lp.vg_name); + unlock_and_release_vg(cmd, vg, lp.vg_name); return r; } --- LVM2/tools/polldaemon.c 2009/04/10 10:01:38 1.12 +++ LVM2/tools/polldaemon.c 2009/05/21 03:04:53 1.13 @@ -157,17 +157,17 @@ parms->lv_type))) { log_error("ABORTING: Can't find mirror LV in %s for %s", vg->name, name); - unlock_release_vg(cmd, vg, vg->name); + unlock_and_release_vg(cmd, vg, vg->name); return 0; } if (!_check_mirror_status(cmd, vg, lv_mirr, name, parms, &finished)) { - unlock_release_vg(cmd, vg, vg->name); + unlock_and_release_vg(cmd, vg, vg->name); return 0; } - unlock_release_vg(cmd, vg, vg->name); + unlock_and_release_vg(cmd, vg, vg->name); } return 1; --- LVM2/tools/pvchange.c 2009/04/10 10:01:38 1.65 +++ LVM2/tools/pvchange.c 2009/05/21 03:04:53 1.66 @@ -201,7 +201,7 @@ log_print("Physical volume \"%s\" changed", pv_name); r = 1; out: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return r; } --- LVM2/tools/pvmove.c 2009/05/19 09:51:03 1.59 +++ LVM2/tools/pvmove.c 2009/05/21 03:04:53 1.60 @@ -459,7 +459,7 @@ /* LVs are all in status LOCKED */ r = ECMD_PROCESSED; out: - unlock_release_vg(cmd, vg, pv_vg_name(pv)); + unlock_and_release_vg(cmd, vg, pv_vg_name(pv)); return r; } --- LVM2/tools/toollib.c 2009/04/25 01:18:00 1.152 +++ LVM2/tools/toollib.c 2009/05/21 03:04:53 1.153 @@ -319,7 +319,7 @@ } if (!vg_check_status(vg, CLUSTERED)) { - unlock_release_vg(cmd, vg, vgname); + unlock_and_release_vg(cmd, vg, vgname); if (ret_max < ECMD_FAILED) ret_max = ECMD_FAILED; continue; @@ -350,7 +350,7 @@ ret = process_each_lv_in_vg(cmd, vg, &lvnames, tags_arg, handle, process_single); - unlock_release_vg(cmd, vg, vgname); + unlock_and_release_vg(cmd, vg, vgname); if (ret > ret_max) ret_max = ret; if (sigint_caught()) @@ -469,7 +469,7 @@ } if (!vg_check_status(vg, CLUSTERED)) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ECMD_FAILED; } @@ -477,7 +477,7 @@ /* Only process if a tag matches or it's on arg_vgnames */ if (!str_list_match_item(arg_vgnames, vg_name) && !str_list_match_list(tags, &vg->tags)) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ret_max; } } @@ -487,7 +487,7 @@ ret_max = ret; } - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ret_max; } @@ -771,12 +771,12 @@ continue; } if (!consistent) { - unlock_release_vg(cmd, vg, sll->str); + unlock_and_release_vg(cmd, vg, sll->str); continue; } if (!vg_check_status(vg, CLUSTERED)) { - unlock_release_vg(cmd, vg, sll->str); + unlock_and_release_vg(cmd, vg, sll->str); continue; } @@ -784,7 +784,7 @@ handle, process_single); - unlock_release_vg(cmd, vg, sll->str); + unlock_and_release_vg(cmd, vg, sll->str); if (ret > ret_max) ret_max = ret; --- LVM2/tools/vgchange.c 2009/05/13 21:27:44 1.71 +++ LVM2/tools/vgchange.c 2009/05/21 03:04:53 1.72 @@ -532,7 +532,7 @@ } if (!consistent) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); dev_close_all(); log_error("Volume group \"%s\" inconsistent", vg_name); if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE))) --- LVM2/tools/vgconvert.c 2009/04/10 10:01:39 1.33 +++ LVM2/tools/vgconvert.c 2009/05/21 03:04:53 1.34 @@ -38,7 +38,7 @@ } if (!consistent) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); dev_close_all(); log_error("Volume group \"%s\" inconsistent", vg_name); if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE))) --- LVM2/tools/vgextend.c 2009/05/13 13:02:56 1.39 +++ LVM2/tools/vgextend.c 2009/05/21 03:04:53 1.40 @@ -76,7 +76,7 @@ r = ECMD_PROCESSED; error: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); unlock_vg(cmd, VG_ORPHANS); return r; } --- LVM2/tools/vgmerge.c 2009/05/13 21:22:57 1.54 +++ LVM2/tools/vgmerge.c 2009/05/21 03:04:54 1.55 @@ -38,7 +38,7 @@ LCK_VG_WRITE, CLUSTERED | EXPORTED_VG | LVM_WRITE, CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { - unlock_release_vg(cmd, vg_to, vg_name_to); + unlock_and_release_vg(cmd, vg_to, vg_name_to); return ECMD_FAILED; } @@ -116,8 +116,8 @@ vg_from->name, vg_to->name); r = ECMD_PROCESSED; bad: - unlock_release_vg(cmd, vg_from, vg_name_from); - unlock_release_vg(cmd, vg_to, vg_name_to); + unlock_and_release_vg(cmd, vg_from, vg_name_from); + unlock_and_release_vg(cmd, vg_to, vg_name_to); return r; } --- LVM2/tools/vgreduce.c 2009/05/13 13:02:56 1.90 +++ LVM2/tools/vgreduce.c 2009/05/21 03:04:54 1.91 @@ -454,7 +454,7 @@ log_print("Removed \"%s\" from volume group \"%s\"", name, vg->name); r = ECMD_PROCESSED; bad: - unlock_release_vg(cmd, orphan_vg, VG_ORPHANS); + unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS); return r; } @@ -574,7 +574,7 @@ } out: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ret; --- LVM2/tools/vgrename.c 2009/05/13 13:02:56 1.61 +++ LVM2/tools/vgrename.c 2009/05/21 03:04:54 1.62 @@ -83,7 +83,7 @@ } if (!vg_check_status(vg, CLUSTERED | LVM_WRITE)) { - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg, vg_name_old); return 0; } @@ -91,7 +91,7 @@ vg_check_status(vg, EXPORTED_VG); if (lvs_in_vg_activated_by_uuid_only(vg)) { - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg, vg_name_old); log_error("Volume group \"%s\" still has active LVs", vg_name_old); /* FIXME Remove this restriction */ @@ -101,7 +101,7 @@ log_verbose("Checking for new volume group \"%s\"", vg_name_new); if (!lock_vol(cmd, vg_name_new, LCK_VG_WRITE)) { - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg, vg_name_old); log_error("Can't get lock for %s", vg_name_new); return 0; } @@ -151,8 +151,8 @@ backup(vg); backup_remove(cmd, vg_name_old); - unlock_release_vg(cmd, vg_new, vg_name_new); - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg_new, vg_name_new); + unlock_and_release_vg(cmd, vg, vg_name_old); log_print("Volume group \"%s\" successfully renamed to \"%s\"", vg_name_old, vg_name_new); @@ -164,8 +164,8 @@ return 1; error: - unlock_release_vg(cmd, vg_new, vg_name_new); - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg_new, vg_name_new); + unlock_and_release_vg(cmd, vg, vg_name_old); return 0; } --- LVM2/tools/vgscan.c 2009/04/10 10:01:39 1.31 +++ LVM2/tools/vgscan.c 2009/05/21 03:04:54 1.32 @@ -25,7 +25,7 @@ } if (!consistent) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); dev_close_all(); log_error("Volume group \"%s\" inconsistent", vg_name); /* Don't allow partial switch to this program */ --- LVM2/tools/vgsplit.c 2009/05/13 21:22:57 1.73 +++ LVM2/tools/vgsplit.c 2009/05/21 03:04:54 1.74 @@ -323,7 +323,7 @@ log_verbose("Checking for new volume group \"%s\"", vg_name_to); if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) { log_error("Can't get lock for %s", vg_name_to); - unlock_release_vg(cmd, vg_from, vg_name_from); + unlock_and_release_vg(cmd, vg_from, vg_name_from); return ECMD_FAILED; } @@ -466,7 +466,7 @@ r = ECMD_PROCESSED; bad: - unlock_release_vg(cmd, vg_from, vg_name_from); - unlock_release_vg(cmd, vg_to, vg_name_to); + unlock_and_release_vg(cmd, vg_from, vg_name_from); + unlock_and_release_vg(cmd, vg_to, vg_name_to); return r; } From agk@sourceware.org Thu May 21 11:11:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 21 May 2009 11:11:00 -0000 Subject: LVM2 tools/Makefile.in ./WHATS_NEW Message-ID: <20090521111130.18729.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-21 11:11:30 Modified files: tools : Makefile.in . : WHATS_NEW Log message: Reinstate version in liblvm2cmd.so soname. (2.02.44) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/Makefile.in.diff?cvsroot=lvm2&r1=1.97&r2=1.98 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1121&r2=1.1122 --- LVM2/tools/Makefile.in 2009/05/11 10:28:46 1.97 +++ LVM2/tools/Makefile.in 2009/05/21 11:11:29 1.98 @@ -81,6 +81,7 @@ endif LVMLIBS = -llvm-internal +LIB_VERSION = $(LIB_VERSION_LVM) CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) liblvm2cmd.a liblvm2cmd-static.a lvm lvm.o \ lvm2cmd.o lvm2cmd-static.o lvm2cmdlib.o lvm.static \ @@ -160,15 +161,15 @@ install_cmdlib_dynamic: liblvm2cmd.$(LIB_SUFFIX) $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd.$(LIB_SUFFIX) \ - $(libdir)/liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION_LVM) - $(LN_S) -f liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION_LVM) $(libdir)/liblvm2cmd.$(LIB_SUFFIX) + $(libdir)/liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) + $(LN_S) -f liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) $(libdir)/liblvm2cmd.$(LIB_SUFFIX) $(INSTALL) -D $(OWNER) $(GROUP) -m 444 lvm2cmd.h \ $(includedir)/lvm2cmd.h install_cmdlib_static: liblvm2cmd-static.a $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd-static.a \ - $(libdir)/liblvm2cmd.a.$(LIB_VERSION_LVM) - $(LN_S) -f liblvm2cmd.a.$(LIB_VERSION_LVM) $(libdir)/liblvm2cmd.a + $(libdir)/liblvm2cmd.a.$(LIB_VERSION) + $(LN_S) -f liblvm2cmd.a.$(LIB_VERSION) $(libdir)/liblvm2cmd.a $(INSTALL) -D $(OWNER) $(GROUP) -m 444 lvm2cmd.h \ $(includedir)/lvm2cmd.h --- LVM2/WHATS_NEW 2009/05/21 03:04:52 1.1121 +++ LVM2/WHATS_NEW 2009/05/21 11:11:30 1.1122 @@ -1,3 +1,7 @@ +Version 2.02.47 - 21st May 2009 +=============================== + Reinstate version in liblvm2cmd.so soname. (2.02.44) + Version 2.02.46 - 21st May 2009 =============================== Inherit readahead setting from underlying devices during activation. From agk@sourceware.org Fri May 22 14:45:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 22 May 2009 14:45:00 -0000 Subject: LVM2 ./Makefile.in ./VERSION ./WHATS_NEW ./con ... Message-ID: <20090522144501.13295.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-22 14:45:00 Modified files: . : Makefile.in VERSION WHATS_NEW configure configure.in liblvm : Makefile.in test/api : Makefile.in Log message: Rename liblvm.so to liblvm2app.so and use configure --enable-applib. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/Makefile.in.diff?cvsroot=lvm2&r1=1.32&r2=1.33 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.194&r2=1.195 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1122&r2=1.1123 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.93&r2=1.94 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.98&r2=1.99 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/Makefile.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/api/Makefile.in.diff?cvsroot=lvm2&r1=1.5&r2=1.6 --- LVM2/Makefile.in 2009/03/16 18:28:04 1.32 +++ LVM2/Makefile.in 2009/05/22 14:44:59 1.33 @@ -22,7 +22,11 @@ SUBDIRS += po endif -SUBDIRS += lib tools daemons libdm liblvm +SUBDIRS += lib tools daemons libdm + +ifeq ("@APPLIB@", "yes") + SUBDIRS += liblvm +endif ifeq ($(MAKECMDGOALS),distclean) SUBDIRS += daemons/clvmd \ @@ -46,7 +50,7 @@ lib: libdm liblvm: lib daemons: lib tools -tools: lib device-mapper liblvm +tools: lib device-mapper po: tools daemons libdm.device-mapper: include.device-mapper --- LVM2/VERSION 2009/05/21 03:04:52 1.194 +++ LVM2/VERSION 2009/05/22 14:44:59 1.195 @@ -1 +1 @@ -2.02.46-cvs (2009-05-21) +2.02.47-cvs (2009-05-22) --- LVM2/WHATS_NEW 2009/05/21 11:11:30 1.1122 +++ LVM2/WHATS_NEW 2009/05/22 14:44:59 1.1123 @@ -1,5 +1,6 @@ -Version 2.02.47 - 21st May 2009 +Version 2.02.47 - 22nd May 2009 =============================== + Rename liblvm.so to liblvm2app.so and use configure --enable-applib. Reinstate version in liblvm2cmd.so soname. (2.02.44) Version 2.02.46 - 21st May 2009 --- LVM2/configure 2009/04/24 21:44:15 1.93 +++ LVM2/configure 2009/05/22 14:44:59 1.94 @@ -690,9 +690,11 @@ CLDNOWHOLEARCHIVE CLDFLAGS BUILD_DMEVENTD +APPLIB MODPROBE_CMD MSGFMT LVM2CMD_LIB +LVM2APP_LIB GENHTML LCOV CPG_LIBS @@ -800,6 +802,7 @@ enable_compat enable_ioctl enable_o_direct +enable_applib enable_cmdlib enable_pkgconfig enable_fsadm @@ -1467,6 +1470,7 @@ --enable-compat Enable support for old device-mapper versions --disable-driver Disable calls to device-mapper in the kernel --disable-o_direct Disable O_DIRECT + --enable-applib Build application library --enable-cmdlib Build shared command library --enable-pkgconfig Install pkgconfig support --enable-fsadm Enable fsadm @@ -9707,6 +9711,23 @@ fi ################################################################################ +{ $as_echo "$as_me:$LINENO: checking whether to build liblvm2app.so application library" >&5 +$as_echo_n "checking whether to build liblvm2app.so application library... " >&6; } +# Check whether --enable-applib was given. +if test "${enable_applib+set}" = set; then + enableval=$enable_applib; APPLIB=$enableval +else + APPLIB=no +fi + +{ $as_echo "$as_me:$LINENO: result: $APPLIB" >&5 +$as_echo "$APPLIB" >&6; } + +test x$APPLIB = xyes \ + && LVM2APP_LIB=-llvm2app \ + || LVM2APP_LIB= + +################################################################################ { $as_echo "$as_me:$LINENO: checking whether to compile liblvm2cmd.so" >&5 $as_echo_n "checking whether to compile liblvm2cmd.so... " >&6; } # Check whether --enable-cmdlib was given. @@ -12659,6 +12680,7 @@ + ################################################################################ ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/misc/lvm-version.h lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile" --- LVM2/configure.in 2009/04/24 21:44:15 1.98 +++ LVM2/configure.in 2009/05/22 14:44:59 1.99 @@ -424,6 +424,18 @@ fi ################################################################################ +dnl -- Enable liblvm2app.so +AC_MSG_CHECKING(whether to build liblvm2app.so application library) +AC_ARG_ENABLE(applib, + [ --enable-applib Build application library], + APPLIB=$enableval, APPLIB=no) +AC_MSG_RESULT($APPLIB) +AC_SUBST([LVM2APP_LIB]) +test x$APPLIB = xyes \ + && LVM2APP_LIB=-llvm2app \ + || LVM2APP_LIB= + +################################################################################ dnl -- Enable cmdlib AC_MSG_CHECKING(whether to compile liblvm2cmd.so) AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library], @@ -747,6 +759,7 @@ LVM_PATCHLEVEL=`echo "$VER" | $AWK -F '.' '{print $3}'` ################################################################################ +AC_SUBST(APPLIB) AC_SUBST(BUILD_DMEVENTD) AC_SUBST(CFLAGS) AC_SUBST(CFLOW_CMD) --- LVM2/liblvm/Makefile.in 2009/04/08 14:04:35 1.5 +++ LVM2/liblvm/Makefile.in 2009/05/22 14:45:00 1.6 @@ -19,7 +19,7 @@ SOURCES =\ lvm_base.c -LIB_NAME = liblvm +LIB_NAME = liblvm2app LIB_VERSION = $(LIB_VERSION_LVM) VERSIONED_SHLIB = $(LIB_NAME).$(LIB_SUFFIX).$(LIB_VERSION_LVM) --- LVM2/test/api/Makefile.in 2009/04/28 19:08:25 1.5 +++ LVM2/test/api/Makefile.in 2009/05/22 14:45:00 1.6 @@ -25,7 +25,7 @@ TARGETS = test -LVMLIBS = -llvm -ldevmapper +LVMLIBS = @LVM2APP_LIB@ -ldevmapper DEFS += -D_REENTRANT CFLAGS += -fno-strict-aliasing @@ -35,6 +35,6 @@ LDFLAGS = -L$(top_srcdir)/libdm -L$(top_srcdir)/liblvm CLDFLAGS = -L$(top_srcdir)/libdm -L$(top_srcdir)/liblvm -test: $(OBJECTS) $(top_srcdir)/liblvm/liblvm.so $(top_srcdir)/libdm/libdevmapper.so +test: $(OBJECTS) $(top_srcdir)/liblvm/liblvm2app.so $(top_srcdir)/libdm/libdevmapper.so $(CC) -o test $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS) From mbroz@sourceware.org Fri May 22 14:56:00 2009 From: mbroz@sourceware.org (mbroz@sourceware.org) Date: Fri, 22 May 2009 14:56:00 -0000 Subject: LVM2/test t-mirror-lvconvert.sh Message-ID: <20090522145617.21457.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2009-05-22 14:56:17 Modified files: test : t-mirror-lvconvert.sh Log message: Temporary disable one of lvconvert tests. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mirror-lvconvert.sh.diff?cvsroot=lvm2&r1=1.8&r2=1.9 --- LVM2/test/t-mirror-lvconvert.sh 2009/05/19 15:47:50 1.8 +++ LVM2/test/t-mirror-lvconvert.sh 2009/05/22 14:56:17 1.9 @@ -280,19 +280,20 @@ check_and_cleanup_lvs_ # "remove from original mirror (the original becomes linear)" -prepare_lvs_ -lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1 -check_mirror_count_ $vg/$lv1 2 -check_mirror_log_ $vg/$lv1 -lvconvert -m+1 -b $vg/$lv1 $dev4 -lvconvert -m-1 $vg/$lv1 $dev2 -lvconvert -i1 $vg/$lv1 -wait_conversion_ $vg/$lv1 -check_no_tmplvs_ $vg/$lv1 -check_mirror_count_ $vg/$lv1 2 -mimages_are_redundant_ $vg $lv1 -mirrorlog_is_on_ $vg/$lv1 $dev3 -check_and_cleanup_lvs_ +# FIXME: enable this test later +#prepare_lvs_ +#lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1 +#check_mirror_count_ $vg/$lv1 2 +#check_mirror_log_ $vg/$lv1 +#lvconvert -m+1 -b $vg/$lv1 $dev4 +#lvconvert -m-1 $vg/$lv1 $dev2 +#lvconvert -i1 $vg/$lv1 +#wait_conversion_ $vg/$lv1 +#check_no_tmplvs_ $vg/$lv1 +#check_mirror_count_ $vg/$lv1 2 +#mimages_are_redundant_ $vg $lv1 +#mirrorlog_is_on_ $vg/$lv1 $dev3 +#check_and_cleanup_lvs_ # --------------------------------------------------------------------- From agk@sourceware.org Fri May 22 15:23:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Fri, 22 May 2009 15:23:00 -0000 Subject: LVM2 VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Message-ID: <20090522152311.19268.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-22 15:23:11 Modified files: . : VERSION VERSION_DM WHATS_NEW WHATS_NEW_DM Log message: post-release Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION.diff?cvsroot=lvm2&r1=1.195&r2=1.196 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/VERSION_DM.diff?cvsroot=lvm2&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1123&r2=1.1124 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.268&r2=1.269 --- LVM2/VERSION 2009/05/22 14:44:59 1.195 +++ LVM2/VERSION 2009/05/22 15:23:10 1.196 @@ -1 +1 @@ -2.02.47-cvs (2009-05-22) +2.02.48-cvs (2009-05-22) --- LVM2/VERSION_DM 2009/05/21 03:04:52 1.8 +++ LVM2/VERSION_DM 2009/05/22 15:23:10 1.9 @@ -1 +1 @@ -1.02.32-cvs (2009-05-21) +1.02.33-cvs (2009-05-22) --- LVM2/WHATS_NEW 2009/05/22 14:44:59 1.1123 +++ LVM2/WHATS_NEW 2009/05/22 15:23:11 1.1124 @@ -1,3 +1,6 @@ +Version 2.02.48 - +=============================== + Version 2.02.47 - 22nd May 2009 =============================== Rename liblvm.so to liblvm2app.so and use configure --enable-applib. --- LVM2/WHATS_NEW_DM 2009/05/21 03:04:52 1.268 +++ LVM2/WHATS_NEW_DM 2009/05/22 15:23:11 1.269 @@ -1,3 +1,6 @@ +Version 1.02.33 - +=============================== + Version 1.02.32 - 21st May 2009 =============================== Only generate libdevmapper.a when configured to link statically. From agk@sourceware.org Wed May 27 13:05:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 27 May 2009 13:05:00 -0000 Subject: LVM2 ./WHATS_NEW lib/zero/zero.c Message-ID: <20090527130555.20595.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-27 13:05:54 Modified files: . : WHATS_NEW lib/zero : zero.c Log message: Attempt to load dm-zero module if zero target needed but not present. (mbroz) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1124&r2=1.1125 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/zero/zero.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21 --- LVM2/WHATS_NEW 2009/05/22 15:23:11 1.1124 +++ LVM2/WHATS_NEW 2009/05/27 13:05:53 1.1125 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Attempt to load dm-zero module if zero target needed but not present. Version 2.02.47 - 22nd May 2009 =============================== --- LVM2/lib/zero/zero.c 2009/02/28 20:04:25 1.20 +++ LVM2/lib/zero/zero.c 2009/05/27 13:05:54 1.21 @@ -58,7 +58,7 @@ static int _zero_present = 0; if (!_zero_checked) - _zero_present = target_present(cmd, "zero", 0); + _zero_present = target_present(cmd, "zero", 1); _zero_checked = 1; From agk@sourceware.org Wed May 27 13:07:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 27 May 2009 13:07:00 -0000 Subject: LVM2/tools lvcreate.c Message-ID: <20090527130738.24552.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-27 13:07:37 Modified files: tools : lvcreate.c Log message: 0->NULL (mbroz) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.189&r2=1.190 --- LVM2/tools/lvcreate.c 2009/05/21 03:04:53 1.189 +++ LVM2/tools/lvcreate.c 2009/05/27 13:07:37 1.190 @@ -566,27 +566,27 @@ if (!(segtype = get_segtype_from_string(cmd, "zero"))) { log_error("Zero segment type for virtual origin not found"); - return 0; + return NULL; } len = strlen(lv_name) + 32; if (!(vorigin_name = alloca(len)) || dm_snprintf(vorigin_name, len, "%s_vorigin", lv_name) < 0) { log_error("Virtual origin name allocation failed."); - return 0; + return NULL; } if (!(lv = lv_create_empty(vorigin_name, NULL, permission, ALLOC_INHERIT, vg))) - return_0; + return_NULL; if (!lv_extend(lv, segtype, 1, 0, 1, voriginextents, NULL, 0u, 0u, NULL, ALLOC_INHERIT)) - return_0; + return_NULL; /* store vg on disk(s) */ if (!vg_write(vg) || !vg_commit(vg)) - return_0; + return_NULL; backup(vg); From agk@sourceware.org Wed May 27 13:19:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 27 May 2009 13:19:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c Message-ID: <20090527131935.31284.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-27 13:19:35 Modified files: . : WHATS_NEW lib/metadata : metadata.c Log message: Fix counting of virtual origin LVs in vg_validate. (mbroz) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1125&r2=1.1126 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.221&r2=1.222 --- LVM2/WHATS_NEW 2009/05/27 13:05:53 1.1125 +++ LVM2/WHATS_NEW 2009/05/27 13:19:34 1.1126 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Fix counting of virtual origin LVs in vg_validate. Attempt to load dm-zero module if zero target needed but not present. Version 2.02.47 - 22nd May 2009 --- LVM2/lib/metadata/metadata.c 2009/05/21 03:04:53 1.221 +++ LVM2/lib/metadata/metadata.c 2009/05/27 13:19:34 1.222 @@ -1449,7 +1449,7 @@ struct lv_list *lvl, *lvl2; char uuid[64] __attribute((aligned(8))); int r = 1; - uint32_t lv_count; + uint32_t hidden_lv_count = 0; /* FIXME Also check there's no data/metadata overlap */ @@ -1486,17 +1486,20 @@ /* * Count all non-snapshot invisible LVs */ - lv_count = 0; dm_list_iterate_items(lvl, &vg->lvs) { if (lvl->lv->status & VISIBLE_LV) continue; /* snapshots */ - if (lv_is_cow(lvl->lv) || lv_is_origin(lvl->lv)) + if (lv_is_cow(lvl->lv)) + continue; + + /* virtual origins are always hidden */ + if (lv_is_origin(lvl->lv) && !lv_is_virtual_origin(lvl->lv)) continue; /* count other non-snapshot invisible volumes */ - lv_count++; + hidden_lv_count++; /* * FIXME: add check for unreferenced invisible LVs @@ -1510,11 +1513,11 @@ * all volumes = visible LVs + snapshot_cows + invisible LVs */ if (((uint32_t) dm_list_size(&vg->lvs)) != - vg_visible_lvs(vg) + snapshot_count(vg) + lv_count) { + vg_visible_lvs(vg) + snapshot_count(vg) + hidden_lv_count) { log_error("Internal error: #internal LVs (%u) != #LVs (%" - PRIu32 ") + #snapshots (%" PRIu32 ") + #invisible LVs %u in VG %s", + PRIu32 ") + #snapshots (%" PRIu32 ") + #internal LVs %u in VG %s", dm_list_size(&vg->lvs), vg_visible_lvs(vg), - snapshot_count(vg), lv_count, vg->name); + snapshot_count(vg), hidden_lv_count, vg->name); r = 0; } From agk@sourceware.org Wed May 27 13:23:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 27 May 2009 13:23:00 -0000 Subject: LVM2 ./WHATS_NEW tools/toollib.c Message-ID: <20090527132343.494.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-27 13:23:42 Modified files: . : WHATS_NEW tools : toollib.c Log message: Skip virtual origins in process_each_lv_in_vg(). (mbroz) Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1126&r2=1.1127 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.153&r2=1.154 --- LVM2/WHATS_NEW 2009/05/27 13:19:34 1.1126 +++ LVM2/WHATS_NEW 2009/05/27 13:23:41 1.1127 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Skip virtual origins in process_each_lv_in_vg(). Fix counting of virtual origin LVs in vg_validate. Attempt to load dm-zero module if zero target needed but not present. --- LVM2/tools/toollib.c 2009/05/21 03:04:53 1.153 +++ LVM2/tools/toollib.c 2009/05/27 13:23:42 1.154 @@ -122,6 +122,9 @@ if (lvl->lv->status & SNAPSHOT) continue; + if (lv_is_virtual_origin(lvl->lv)) + continue; + /* Should we process this LV? */ if (process_all) process_lv = 1; From agk@sourceware.org Wed May 27 16:30:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 27 May 2009 16:30:00 -0000 Subject: LVM2 ./WHATS_NEW man/lvcreate.8.in tools/args. ... Message-ID: <20090527163031.9547.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-27 16:30:30 Modified files: . : WHATS_NEW man : lvcreate.8.in tools : args.h commands.h lvcreate.c lvmcmdline.c Log message: Make --snapshot optional with lvcreate --virtualsize. Generalise --virtualoriginsize to --virtualsize. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1127&r2=1.1128 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvcreate.8.in.diff?cvsroot=lvm2&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.63&r2=1.64 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.125&r2=1.126 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.190&r2=1.191 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.95&r2=1.96 --- LVM2/WHATS_NEW 2009/05/27 13:23:41 1.1127 +++ LVM2/WHATS_NEW 2009/05/27 16:30:29 1.1128 @@ -1,5 +1,7 @@ Version 2.02.48 - =============================== + Make --snapshot optional with lvcreate --virtualsize. + Generalise --virtualoriginsize to --virtualsize. Skip virtual origins in process_each_lv_in_vg(). Fix counting of virtual origin LVs in vg_validate. Attempt to load dm-zero module if zero target needed but not present. --- LVM2/man/lvcreate.8.in 2009/04/29 20:14:21 1.6 +++ LVM2/man/lvcreate.8.in 2009/05/27 16:30:30 1.7 @@ -26,8 +26,10 @@ \-L|\-\-size LogicalVolumeSize[kKmMgGtT]} [\-c|\-\-chunksize ChunkSize] \-n|\-\-name SnapshotLogicalVolumeName -\-s|\-\-snapshot -[OriginalLogicalVolumePath | VolumeGroupName \-\-virtualoriginsize VirtualOriginSize] +{{\-s|\-\-snapshot} +OriginalLogicalVolumePath | +[\-s|\-\-snapshot] +VolumeGroupName \-\-virtualsize VirtualSize} .SH DESCRIPTION lvcreate creates a new logical volume in a volume group ( see .B vgcreate(8), vgchange(8) @@ -152,11 +154,11 @@ rate at which the snapshot data is growing so you can avoid running out of space. .TP -.I \-\-virtualoriginsize VirtualOriginSize -In conjunction with \-\-snapshot, create a sparse device of the given size -(in MB by default). Anything written to the device will be returned when -reading from it. Reading from other areas of the device will return -blocks of zeros. It is implemented by creating a hidden virtual device of the +.I \-\-virtualsize VirtualSize +Create a sparse device of the given size (in MB by default) using a snapshot. +Anything written to the device will be returned when reading from it. +Reading from other areas of the device will return blocks of zeros. +It is implemented by creating a hidden virtual device of the requested size using the zero target. A suffix of _vorigin is used for this device. .TP --- LVM2/tools/args.h 2009/04/25 01:18:00 1.63 +++ LVM2/tools/args.h 2009/05/27 16:30:30 1.64 @@ -59,6 +59,7 @@ arg(rows_ARG, '\0', "rows", NULL, 0) arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0) arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0) +arg(virtualsize_ARG, '\0', "virtualsize", size_mb_arg, 0) /* Allow some variations */ arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0) --- LVM2/tools/commands.h 2009/04/25 01:18:00 1.125 +++ LVM2/tools/commands.h 2009/05/27 16:30:30 1.126 @@ -145,7 +145,9 @@ "\t[--version]\n" "\tVolumeGroupName [PhysicalVolumePath...]\n\n" - "lvcreate -s|--snapshot\n" + "lvcreate \n" + "\t{ {-s|--snapshot} OriginalLogicalVolume[Path] |\n" + "\t [-s|--snapshot] VolumeGroupName[Path] --virtualsize VirtualSize}\n" "\t[-c|--chunksize]\n" "\t[-A|--autobackup {y|n}]\n" "\t[--addtag Tag]\n" @@ -163,15 +165,14 @@ "\t[-t|--test]\n" "\t[-v|--verbose]\n" "\t[--version]\n" - "\t[OriginalLogicalVolume[Path] |\n" - "\t VolumeGroupName[Path] --virtualoriginsize VirtualOriginSize]]\n" + "\t[PhysicalVolumePath...]\n\n", addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG, corelog_ARG, extents_ARG, major_ARG, minor_ARG, mirrorlog_ARG, mirrors_ARG, name_ARG, nosync_ARG, permission_ARG, persistent_ARG, readahead_ARG, regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG, - test_ARG, type_ARG, virtualoriginsize_ARG, zero_ARG) + test_ARG, type_ARG, virtualoriginsize_ARG, virtualsize_ARG, zero_ARG) xx(lvdisplay, "Display information about a logical volume", --- LVM2/tools/lvcreate.c 2009/05/27 13:07:37 1.190 +++ LVM2/tools/lvcreate.c 2009/05/27 16:30:30 1.191 @@ -66,7 +66,7 @@ if (arg_count(cmd, name_ARG)) lp->lv_name = arg_value(cmd, name_ARG); - if (lp->snapshot && !arg_count(cmd, virtualoriginsize_ARG)) { + if (lp->snapshot && !arg_count(cmd, virtualsize_ARG)) { if (!argc) { log_err("Please specify a logical volume to act as " "the snapshot origin."); @@ -178,12 +178,12 @@ } /* Size returned in kilobyte units; held in sectors */ - if (arg_count(cmd, virtualoriginsize_ARG)) { - if (arg_sign_value(cmd, virtualoriginsize_ARG, 0) == SIGN_MINUS) { + if (arg_count(cmd, virtualsize_ARG)) { + if (arg_sign_value(cmd, virtualsize_ARG, 0) == SIGN_MINUS) { log_error("Negative virtual origin size is invalid"); return 0; } - lp->voriginsize = arg_uint64_value(cmd, virtualoriginsize_ARG, + lp->voriginsize = arg_uint64_value(cmd, virtualsize_ARG, UINT64_C(0)); if (!lp->voriginsize) { log_error("Virtual origin size may not be zero"); @@ -362,7 +362,8 @@ if (arg_count(cmd, stripes_ARG) && lp->stripes == 1) log_print("Redundant stripes argument: default is 1"); - if (arg_count(cmd, snapshot_ARG) || seg_is_snapshot(lp)) + if (arg_count(cmd, snapshot_ARG) || seg_is_snapshot(lp) || + arg_count(cmd, virtualsize_ARG)) lp->snapshot = 1; lp->mirrors = 1; @@ -406,10 +407,6 @@ log_error("-c is only available with snapshots"); return 0; } - if (arg_count(cmd, virtualoriginsize_ARG)) { - log_error("--virtualoriginsize is only available with snapshots"); - return 0; - } } if (lp->mirrors > 1) { @@ -722,7 +719,7 @@ /* Must zero cow */ status |= LVM_WRITE; - if (arg_count(cmd, virtualoriginsize_ARG)) + if (arg_count(cmd, virtualsize_ARG)) origin_active = 1; else { @@ -733,7 +730,7 @@ } if (lv_is_virtual_origin(org)) { log_error("Can't share virtual origins. " - "Use --virtualoriginsize."); + "Use --virtualsize."); return 0; } if (lv_is_cow(org)) { --- LVM2/tools/lvmcmdline.c 2009/04/02 14:59:48 1.95 +++ LVM2/tools/lvmcmdline.c 2009/05/27 16:30:30 1.96 @@ -816,7 +816,8 @@ /* Handle synonyms */ if (!_merge_synonym(cmd, resizable_ARG, resizeable_ARG) || !_merge_synonym(cmd, allocation_ARG, allocatable_ARG) || - !_merge_synonym(cmd, allocation_ARG, resizeable_ARG)) + !_merge_synonym(cmd, allocation_ARG, resizeable_ARG) || + !_merge_synonym(cmd, virtualoriginsize_ARG, virtualsize_ARG)) return EINVALID_CMD_LINE; /* Zero indicates success */ From agk@sourceware.org Wed May 27 18:19:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Wed, 27 May 2009 18:19:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ... Message-ID: <20090527181922.26249.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-27 18:19:21 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c tools : lvchange.c lvcreate.c toollib.c Log message: Suppress 'removed' messages displayed when internal LVs are removed. Fix lvchange -a and -p for sparse LVs. Fix lvcreate --virtualsize to activate the new device immediately. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1128&r2=1.1129 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.174&r2=1.175 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.191&r2=1.192 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155 --- LVM2/WHATS_NEW 2009/05/27 16:30:29 1.1128 +++ LVM2/WHATS_NEW 2009/05/27 18:19:21 1.1129 @@ -1,8 +1,11 @@ Version 2.02.48 - =============================== + Suppress 'removed' messages displayed when internal LVs are removed. + Fix lvchange -a and -p for sparse LVs. + Fix lvcreate --virtualsize to activate the new device immediately. Make --snapshot optional with lvcreate --virtualsize. Generalise --virtualoriginsize to --virtualsize. - Skip virtual origins in process_each_lv_in_vg(). + Skip virtual origins in process_each_lv_in_vg() without --all. Fix counting of virtual origin LVs in vg_validate. Attempt to load dm-zero module if zero target needed but not present. --- LVM2/lib/metadata/lv_manip.c 2009/05/21 03:04:53 1.174 +++ LVM2/lib/metadata/lv_manip.c 2009/05/27 18:19:21 1.175 @@ -2037,6 +2037,7 @@ } if (lv_is_active(lv) && (force == PROMPT) && + lv_is_visible(lv) && yes_no_prompt("Do you really want to remove active " "%slogical volume %s? [y/n]: ", vg_is_clustered(vg) ? "clustered " : "", @@ -2083,7 +2084,9 @@ log_error("Failed to resume %s.", origin->name); } - log_print("Logical volume \"%s\" successfully removed", lv->name); + if (lv_is_visible(lv)) + log_print("Logical volume \"%s\" successfully removed", lv->name); + return 1; } --- LVM2/tools/lvchange.c 2009/05/20 09:55:34 1.101 +++ LVM2/tools/lvchange.c 2009/05/27 18:19:21 1.102 @@ -540,6 +540,7 @@ { int doit = 0, docmds = 0; int archived = 0; + struct logical_volume *origin; if (!(lv->vg->status & LVM_WRITE) && (arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) || @@ -584,7 +585,12 @@ return ECMD_FAILED; } - if (!(lv_is_visible(lv))) { + /* If LV is sparse, activate origin instead */ + if (arg_count(cmd, available_ARG) && lv_is_cow(lv) && + lv_is_virtual_origin(origin = origin_from_cow(lv))) + lv = origin; + + if (!(lv_is_visible(lv)) && !lv_is_virtual_origin(lv)) { log_error("Unable to change internal LV %s directly", lv->name); return ECMD_FAILED; --- LVM2/tools/lvcreate.c 2009/05/27 16:30:30 1.191 +++ LVM2/tools/lvcreate.c 2009/05/27 18:19:21 1.192 @@ -910,12 +910,16 @@ return 0; } + /* A virtual origin must be activated explicitly. */ if (lp->voriginsize && - !(org = _create_virtual_origin(cmd, vg, lv->name, - lp->permission, - lp->voriginextents))) { + (!(org = _create_virtual_origin(cmd, vg, lv->name, + lp->permission, + lp->voriginextents)) || + !activate_lv(cmd, org))) { log_error("Couldn't create virtual origin for LV %s", lv->name); + if (org && !lv_remove(org)) + stack; goto deactivate_and_revert_new_lv; } --- LVM2/tools/toollib.c 2009/05/27 13:23:42 1.154 +++ LVM2/tools/toollib.c 2009/05/27 18:19:21 1.155 @@ -122,7 +122,7 @@ if (lvl->lv->status & SNAPSHOT) continue; - if (lv_is_virtual_origin(lvl->lv)) + if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG)) continue; /* Should we process this LV? */ From agk@sourceware.org Thu May 28 00:29:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 May 2009 00:29:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c Message-ID: <20090528002915.13084.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-28 00:29:15 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c Log message: Rename internal vorigin LV to match visible LV. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1129&r2=1.1130 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.175&r2=1.176 --- LVM2/WHATS_NEW 2009/05/27 18:19:21 1.1129 +++ LVM2/WHATS_NEW 2009/05/28 00:29:14 1.1130 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Rename internal vorigin LV to match visible LV. Suppress 'removed' messages displayed when internal LVs are removed. Fix lvchange -a and -p for sparse LVs. Fix lvcreate --virtualsize to activate the new device immediately. --- LVM2/lib/metadata/lv_manip.c 2009/05/27 18:19:21 1.175 +++ LVM2/lib/metadata/lv_manip.c 2009/05/28 00:29:15 1.176 @@ -1700,19 +1700,24 @@ void *data), void *data) { + struct logical_volume *org; struct lv_segment *seg; uint32_t s; + if (lv_is_cow(lv) && lv_is_virtual_origin(org = origin_from_cow(lv))) + if (!func(cmd, org, data)) + return_0; + dm_list_iterate_items(seg, &lv->segments) { if (seg->log_lv && !func(cmd, seg->log_lv, data)) - return 0; + return_0; for (s = 0; s < seg->area_count; s++) { if (seg_type(seg, s) != AREA_LV) continue; if (!func(cmd, seg_lv(seg, s), data)) - return 0; + return_0; if (!_for_each_sub_lv(cmd, seg_lv(seg, s), func, data)) - return 0; + return_0; } } From agk@sourceware.org Thu May 28 01:11:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 May 2009 01:11:00 -0000 Subject: LVM2 ./WHATS_NEW lib/activate/dev_manager.c Message-ID: <20090528011131.31361.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-28 01:11:30 Modified files: . : WHATS_NEW lib/activate : dev_manager.c Log message: Remove /dev/vgname/lvname symlink automatically if LV is no longer visible. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1130&r2=1.1131 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.150&r2=1.151 --- LVM2/WHATS_NEW 2009/05/28 00:29:14 1.1130 +++ LVM2/WHATS_NEW 2009/05/28 01:11:29 1.1131 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Remove /dev/vgname/lvname symlink automatically if LV is no longer visible. Rename internal vorigin LV to match visible LV. Suppress 'removed' messages displayed when internal LVs are removed. Fix lvchange -a and -p for sparse LVs. --- LVM2/lib/activate/dev_manager.c 2009/05/20 11:09:49 1.150 +++ LVM2/lib/activate/dev_manager.c 2009/05/28 01:11:30 1.151 @@ -1067,7 +1067,14 @@ } if (!fs_rename_lv(lvlayer->lv, name, old_vgname, old_lvname)) r = 0; - } else if (!dev_manager_lv_mknodes(lvlayer->lv)) + continue; + } + if (lv_is_visible(lvlayer->lv)) { + if (!dev_manager_lv_mknodes(lvlayer->lv)) + r = 0; + continue; + } + if (!dev_manager_lv_rmnodes(lvlayer->lv)) r = 0; } From agk@sourceware.org Thu May 28 01:59:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Thu, 28 May 2009 01:59:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c Message-ID: <20090528015938.2790.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-28 01:59:37 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c Log message: When creating new LV, double-check that name is not already in use. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1131&r2=1.1132 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.176&r2=1.177 --- LVM2/WHATS_NEW 2009/05/28 01:11:29 1.1131 +++ LVM2/WHATS_NEW 2009/05/28 01:59:37 1.1132 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + When creating new LV, double-check that name is not already in use. Remove /dev/vgname/lvname symlink automatically if LV is no longer visible. Rename internal vorigin LV to match visible LV. Suppress 'removed' messages displayed when internal LVs are removed. --- LVM2/lib/metadata/lv_manip.c 2009/05/28 00:29:15 1.176 +++ LVM2/lib/metadata/lv_manip.c 2009/05/28 01:59:37 1.177 @@ -1844,6 +1844,10 @@ log_error("Failed to generate unique name for the new " "logical volume"); return NULL; + } else if (find_lv_in_vg(vg, name)) { + log_error("Unable to create LV %s in Volume Group %s: " + "name already in use.", name, vg->name); + return NULL; } log_verbose("Creating logical volume %s", name); From snitzer@sourceware.org Fri May 29 18:34:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Fri, 29 May 2009 18:34:00 -0000 Subject: LVM2 ./WHATS_NEW scripts/clvmd_init_red_hat.in Message-ID: <20090529183411.18864.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-05-29 18:34:10 Modified files: . : WHATS_NEW scripts : clvmd_init_red_hat.in Log message: Fix rpmlint in clvmd initscript Added missing LSB stanza lines. Added reload capability. Remaining warning (incoherent-init-script-name) is not relevant. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1132&r2=1.1133 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/clvmd_init_red_hat.in.diff?cvsroot=lvm2&r1=1.2&r2=1.3 --- LVM2/WHATS_NEW 2009/05/28 01:59:37 1.1132 +++ LVM2/WHATS_NEW 2009/05/29 18:34:10 1.1133 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Fix rpmlint in clvmd initscript When creating new LV, double-check that name is not already in use. Remove /dev/vgname/lvname symlink automatically if LV is no longer visible. Rename internal vorigin LV to match visible LV. --- LVM2/scripts/clvmd_init_red_hat.in 2009/02/10 11:53:34 1.2 +++ LVM2/scripts/clvmd_init_red_hat.in 2009/05/29 18:34:10 1.3 @@ -6,7 +6,12 @@ # For Red-Hat-based distributions such as Fedora, RHEL, CentOS. # ### BEGIN INIT INFO -# Provides: +# Provides: clvmd +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Clustered LVM Daemon ### END INIT INFO . /etc/init.d/functions @@ -109,6 +114,19 @@ fi } +reload() { + $DAEMON -R +} + +rh_status() { + status $DAEMON +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + rtrn=1 # See how we were called. @@ -134,15 +152,20 @@ rtrn=$? ;; + reload) + rh_status_q || exit 7 + reload + ;; + status) - status $DAEMON + rh_status rtrn=$? vols=$( $LVDISPLAY -C --nohead 2> /dev/null | awk '($3 ~ /....a./) {print $1}' ) echo active volumes: ${vols:-"(none)"} ;; *) - echo $"Usage: $0 {start|stop|restart|status}" + echo $"Usage: $0 {start|stop|restart|reload|status}" ;; esac From snitzer@sourceware.org Fri May 29 18:54:00 2009 From: snitzer@sourceware.org (snitzer@sourceware.org) Date: Fri, 29 May 2009 18:54:00 -0000 Subject: LVM2/scripts clvmd_init_red_hat.in Message-ID: <20090529185449.27305.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2009-05-29 18:54:49 Modified files: scripts : clvmd_init_red_hat.in Log message: Fix 'service-default-enabled' rpmlint in clvmd initscript Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/clvmd_init_red_hat.in.diff?cvsroot=lvm2&r1=1.3&r2=1.4 --- LVM2/scripts/clvmd_init_red_hat.in 2009/05/29 18:34:10 1.3 +++ LVM2/scripts/clvmd_init_red_hat.in 2009/05/29 18:54:48 1.4 @@ -9,7 +9,7 @@ # Provides: clvmd # Required-Start: $local_fs # Required-Stop: $local_fs -# Default-Start: 2 3 4 5 +# Default-Start: # Default-Stop: 0 1 6 # Short-Description: Clustered LVM Daemon ### END INIT INFO From agk@sourceware.org Sat May 30 00:09:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Sat, 30 May 2009 00:09:00 -0000 Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c Message-ID: <20090530000928.27226.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-30 00:09:27 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c Log message: Handle multi-extent mirror log allocation when smallest PV has only 1 extent. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1133&r2=1.1134 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.177&r2=1.178 --- LVM2/WHATS_NEW 2009/05/29 18:34:10 1.1133 +++ LVM2/WHATS_NEW 2009/05/30 00:09:27 1.1134 @@ -1,6 +1,7 @@ Version 2.02.48 - =============================== - Fix rpmlint in clvmd initscript + Handle multi-extent mirror log allocation when smallest PV has only 1 extent. + Add LSB standard headers and functions (incl. reload) to clvmd initscript. When creating new LV, double-check that name is not already in use. Remove /dev/vgname/lvname symlink automatically if LV is no longer visible. Rename internal vorigin LV to match visible LV. --- LVM2/lib/metadata/lv_manip.c 2009/05/28 01:59:37 1.177 +++ LVM2/lib/metadata/lv_manip.c 2009/05/30 00:09:27 1.178 @@ -728,7 +728,8 @@ */ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t needed, struct pv_area **areas, - uint32_t *ix, struct pv_area *log_area) + uint32_t *ix, struct pv_area *log_area, + uint32_t log_len) { uint32_t area_len, remaining; uint32_t s; @@ -763,9 +764,7 @@ if (log_area) { ah->log_area.pv = log_area->map->pv; ah->log_area.pe = log_area->start; - ah->log_area.len = mirror_log_extents(ah->log_region_size, - pv_pe_size(log_area->map->pv), - area_len); + ah->log_area.len = log_len; consume_pv_area(log_area, ah->log_area.len); } @@ -990,11 +989,15 @@ unsigned contiguous = 0, cling = 0, preferred_count = 0; unsigned ix; unsigned ix_offset = 0; /* Offset for non-preferred allocations */ + unsigned too_small_for_log_count; /* How many too small for log? */ uint32_t max_parallel; /* Maximum extents to allocate */ uint32_t next_le; struct seg_pvs *spvs; struct dm_list *parallel_pvs; uint32_t free_pes; + uint32_t log_len; + struct pv_area *log_area; + unsigned log_needs_allocating; /* Is there enough total space? */ free_pes = pv_maps_size(pvms); @@ -1121,25 +1124,49 @@ if ((contiguous || cling) && (preferred_count < ix_offset)) break; - /* Only allocate log_area the first time around */ - if (ix + ix_offset < ah->area_count + - ((ah->log_count && !ah->log_area.len) ? - ah->log_count : 0)) - /* FIXME With ALLOC_ANYWHERE, need to split areas */ - break; - /* sort the areas so we allocate from the biggest */ if (ix > 1) qsort(areas + ix_offset, ix, sizeof(*areas), _comp_area); - /* First time around, use smallest area as log_area */ - /* FIXME decide which PV to use at top of function instead */ - if (!_alloc_parallel_area(ah, max_parallel, areas, - allocated, - (ah->log_count && !ah->log_area.len) ? - *(areas + ix_offset + ix - 1) : - NULL)) + /* + * First time around, if there's a log, allocate it on the + * smallest device that has space for it. + * + * FIXME decide which PV to use at top of function instead + */ + + log_needs_allocating = (ah->log_count && !ah->log_area.len) ? + 1 : 0; + + too_small_for_log_count = 0; + + if (!log_needs_allocating) { + log_len = 0; + log_area = NULL; + } else { + log_len = mirror_log_extents(ah->log_region_size, + pv_pe_size((*areas)->map->pv), + (max_parallel - *allocated) / ah->area_multiple); + + /* How many areas are too small for the log? */ + while (too_small_for_log_count < ix_offset + ix && + (*(areas + ix_offset + ix - 1 - + too_small_for_log_count))->count < log_len) + too_small_for_log_count++; + + log_area = *(areas + ix_offset + ix - 1 - + too_small_for_log_count); + } + + if (ix + ix_offset < ah->area_count + + (log_needs_allocating ? ah->log_count + + too_small_for_log_count : 0)) + /* FIXME With ALLOC_ANYWHERE, need to split areas */ + break; + + if (!_alloc_parallel_area(ah, max_parallel, areas, allocated, + log_area, log_len)) return_0; } while (!contiguous && *allocated != needed && can_split); From agk@sourceware.org Sat May 30 01:54:00 2009 From: agk@sourceware.org (agk@sourceware.org) Date: Sat, 30 May 2009 01:54:00 -0000 Subject: LVM2 lib/metadata/metadata.c ./WHATS_NEW Message-ID: <20090530015430.27065.qmail@sourceware.org> CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-05-30 01:54:29 Modified files: lib/metadata : metadata.c . : WHATS_NEW Log message: Remove verbose 'visited' messages. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.222&r2=1.223 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1134&r2=1.1135 --- LVM2/lib/metadata/metadata.c 2009/05/27 13:19:34 1.222 +++ LVM2/lib/metadata/metadata.c 2009/05/30 01:54:29 1.223 @@ -1330,10 +1330,9 @@ baton.fn = fn; baton.data = data; r = _lv_each_dependency(lv, _lv_postorder_level, &baton); - if (r) { + if (r) r = fn(lv, data); - log_verbose("visited %s", lv->name); - } + return r; } --- LVM2/WHATS_NEW 2009/05/30 00:09:27 1.1134 +++ LVM2/WHATS_NEW 2009/05/30 01:54:29 1.1135 @@ -1,5 +1,6 @@ Version 2.02.48 - =============================== + Remove verbose 'visited' messages. Handle multi-extent mirror log allocation when smallest PV has only 1 extent. Add LSB standard headers and functions (incl. reload) to clvmd initscript. When creating new LV, double-check that name is not already in use.