master - libdm: internal is_selinux_enabled wrapper
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8346f106b448ca...
Commit: 8346f106b448caeb9625d05eb9d196cced860288
Parent: ee89ac7b887bc227f9c4d436c0acaa61c7ee4deb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Feb 20 17:09:55 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Feb 24 20:58:41 2014 +0100
libdm: internal is_selinux_enabled wrapper
There is no point to call this external function more then once.
(As suggested by selinux developer)
---
WHATS_NEW_DM | 1 +
libdm/libdm-common.c | 19 +++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3d7c734..a0b8066 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.85 -
===================================
+ Wrap is_selinux_enabled() to be called just once.
Use correctly signed 64b constant when working with raid volumes.
Exit dmeventd with pidfile cleanup instead of raising SIGKILL on DIE request.
Add new DM_EVENT_GET_PARAMETERS request to dmeventd protocol.
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 5ec5769..2ec66e7 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -868,12 +868,27 @@ static int _selabel_lookup(const char *path, mode_t mode,
}
#endif
+#ifdef HAVE_SELINUX
+static int _is_selinux_enabled(void)
+{
+ static int _tested = 0;
+ static int _enabled;
+
+ if (!_tested) {
+ _tested = 1;
+ _enabled = is_selinux_enabled();
+ }
+
+ return _enabled;
+}
+#endif
+
int dm_prepare_selinux_context(const char *path, mode_t mode)
{
#ifdef HAVE_SELINUX
security_context_t scontext = NULL;
- if (is_selinux_enabled() <= 0)
+ if (_is_selinux_enabled() <= 0)
return 1;
if (path) {
@@ -901,7 +916,7 @@ int dm_set_selinux_context(const char *path, mode_t mode)
#ifdef HAVE_SELINUX
security_context_t scontext = NULL;
- if (is_selinux_enabled() <= 0)
+ if (_is_selinux_enabled() <= 0)
return 1;
if (!_selabel_lookup(path, mode, &scontext))
10 years, 3 months
master - pvmove: Disallow pvmove of cache LVs
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee89ac7b887bc2...
Commit: ee89ac7b887bc227f9c4d436c0acaa61c7ee4deb
Parent: fdb7356d6a9be43678c9d001725aef6dca02d178
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Feb 24 12:25:18 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Feb 24 12:25:18 2014 -0600
pvmove: Disallow pvmove of cache LVs
Skip over LVs that have a cache LV in their tree of LV dependencies
when performing a pvmove.
This means that users cannot move a cache pool or a cache LV's origin -
even when that cache LV is used as part of another LV (e.g. a thin pool).
The new test (pvmove-cache-segtypes.sh) currently builds up various LV
stacks that incorporate cache LVs. pvmove tests are then performed to
ensure that cache related LVs are /not/ moved. Once pvmove is enabled
for cache, those tests will switch to ensuring that the LVs /are/
moved.
---
test/shell/pvmove-cache-segtypes.sh | 178 +++++++++++++++++++++++++++++++++++
tools/pvmove.c | 43 +++++++++
2 files changed, 221 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvmove-cache-segtypes.sh b/test/shell/pvmove-cache-segtypes.sh
new file mode 100644
index 0000000..1c2423e
--- /dev/null
+++ b/test/shell/pvmove-cache-segtypes.sh
@@ -0,0 +1,178 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+test_description="ensure pvmove works with the cache segment types"
+
+. lib/test
+
+# pvmove fails when a RAID LV is the origin of a cache LV
+# pvmoving cache types is currently disabled in tools/pvmove.c
+# So, for now we set everything up and make sure pvmove /isn't/ allowed.
+# This allows us to ensure that it is disallowed even when there are
+# stacking complications to consider.
+
+test -e LOCAL_CLVMD && skip
+which mkfs.ext2 || skip
+which md5sum || skip
+
+aux target_at_least dm-cache 1 3 0 || skip
+# for stacking
+aux target_at_least dm-thin-pool 1 8 0 || skip
+aux target_at_least dm-raid 1 4 2 || skip
+
+aux prepare_vg 5 80
+
+# Each of the following tests does:
+# 1) Create two LVs - one linear and one other segment type
+# The two LVs will share a PV.
+# 2) Move both LVs together
+# 3) Move only the second LV by name
+
+# Testing pvmove of cache-pool LV (can't check contents though)
+###############################################################
+lvcreate -l 2 -n ${lv1}_foo $vg "$dev1"
+lvcreate --type cache-pool -n ${lv1}_pool -l 4 $vg "$dev1"
+check lv_tree_on $vg ${lv1}_foo "$dev1"
+check lv_tree_on $vg ${lv1}_pool "$dev1"
+
+pvmove "$dev1" "$dev5" 2>&1 | tee out
+grep "Skipping cache-pool LV, ${lv1}_pool" out
+grep "Skipping cache-related LV, ${lv1}_pool_cmeta" out
+grep "Skipping cache-related LV, ${lv1}_pool_cdata" out
+check lv_tree_on $vg ${lv1}_foo "$dev5"
+not check lv_tree_on $vg ${lv1}_pool "$dev5"
+
+#pvmove -n ${lv1}_pool "$dev5" "$dev4"
+#check lv_tree_on $vg ${lv1}_pool "$dev4"
+#check lv_tree_on $vg ${lv1}_foo "$dev5"
+
+lvremove -ff $vg
+
+# Testing pvmove of origin LV
+#############################
+lvcreate -l 2 -n ${lv1}_foo $vg "$dev1"
+lvcreate --type cache-pool -n ${lv1}_pool -l 4 $vg "$dev5"
+lvcreate --type cache -n $lv1 -l 8 $vg/${lv1}_pool "$dev1"
+
+check lv_tree_on $vg ${lv1}_foo "$dev1"
+check lv_tree_on $vg ${lv1}_pool "$dev5"
+check lv_tree_on $vg ${lv1} "$dev1"
+
+aux mkdev_md5sum $vg $lv1
+pvmove "$dev1" "$dev3" 2>&1 | tee out
+grep "Skipping cache LV, ${lv1}" out
+check lv_tree_on $vg ${lv1}_foo "$dev3"
+#check lv_tree_on $vg ${lv1}_pool "$dev5"
+lvs -a -o name,attr,devices $vg
+not check lv_tree_on $vg ${lv1} "$dev3"
+#check dev_md5sum $vg $lv1
+
+#pvmove -n $lv1 "$dev3" "$dev1"
+#check lv_tree_on $vg ${lv1}_foo "$dev3"
+#check lv_tree_on $vg ${lv1}_pool "$dev5"
+#check lv_tree_on $vg ${lv1} "$dev1"
+#check dev_md5sum $vg $lv1
+lvremove -ff $vg
+
+# Testing pvmove of a RAID origin LV
+####################################
+lvcreate -l 2 -n ${lv1}_foo $vg "$dev1"
+lvcreate --type raid1 -m 1 -l 8 -n $lv1 $vg "$dev1" "$dev2"
+lvcreate --type cache -l 4 -n ${lv1}_pool $vg/$lv1 "$dev5"
+check lv_tree_on $vg ${lv1}_foo "$dev1"
+check lv_tree_on $vg ${lv1} "$dev1" "$dev2"
+check lv_tree_on $vg ${lv1}_pool "$dev5"
+
+aux mkdev_md5sum $vg $lv1
+pvmove "$dev1" "$dev3" 2>&1 | tee out
+grep "Skipping cache LV, ${lv1}" out
+check lv_tree_on $vg ${lv1}_foo "$dev3"
+not check lv_tree_on $vg ${lv1} "$dev2" "$dev3"
+#check lv_tree_on $vg ${lv1}_pool "$dev5"
+#check dev_md5sum $vg $lv1 -- THIS IS WHERE THINGS FAIL IF PVMOVE NOT DISALLOWED
+
+#pvmove -n $lv1 "$dev3" "$dev1"
+#check lv_tree_on $vg ${lv1}_foo "$dev3"
+#check lv_tree_on $vg ${lv1} "$dev1" "$dev2"
+#check lv_tree_on $vg ${lv1}_pool "$dev5"
+#check dev_md5sum $vg $lv1
+lvremove -ff $vg
+
+# Testing pvmove of a RAID cachepool (metadata and data)
+########################################################
+lvcreate -l 2 -n ${lv1}_foo $vg "$dev1"
+lvcreate --type raid1 -L 2M -n meta $vg "$dev1" "$dev2"
+lvcreate --type raid1 -L 4M -n ${lv1}_pool $vg "$dev1" "$dev2"
+lvconvert --type cache-pool $vg/${lv1}_pool --poolmetadata $vg/meta
+lvcreate --type cache -n $lv1 -L 8M $vg/${lv1}_pool "$dev5"
+
+check lv_tree_on $vg ${lv1}_foo "$dev1"
+check lv_tree_on $vg ${lv1}_pool "$dev1" "$dev2"
+check lv_tree_on $vg ${lv1} "$dev5"
+
+aux mkdev_md5sum $vg $lv1
+# This will move ${lv1}_foo and the cache-pool data & meta
+# LVs, both of which contain a RAID1 _rimage & _rmeta LV - 5 total LVs
+pvmove "$dev1" "$dev3" 2>&1 | tee out
+grep "Skipping cache-pool LV, ${lv1}_pool" out
+grep "Skipping cache-related LV, ${lv1}_pool_cmeta" out
+grep "Skipping cache-related LV, ${lv1}_pool_cdata" out
+check lv_tree_on $vg ${lv1}_foo "$dev3"
+not check lv_tree_on $vg ${lv1}_pool "$dev2" "$dev3"
+#check lv_tree_on $vg ${lv1} "$dev5"
+#check dev_md5sum $vg $lv1
+
+#pvmove -n ${lv1}_pool "$dev3" "$dev1"
+#check lv_tree_on $vg ${lv1}_foo "$dev3"
+#check lv_tree_on $vg ${lv1}_pool "$dev1" "$dev2"
+#check lv_tree_on $vg ${lv1} "$dev5"
+#check dev_md5sum $vg $lv1
+lvremove -ff $vg
+
+# Testing pvmove of Thin-pool on cache LV on RAID
+#################################################
+lvcreate -l 2 -n ${lv1}_foo $vg "$dev1"
+# RAID for cachepool
+lvcreate --type raid1 -m 1 -L 2M -n meta $vg "$dev1" "$dev2"
+lvcreate --type raid1 -m 1 -L 4M -n cachepool $vg "$dev1" "$dev2"
+lvconvert --type cache-pool $vg/cachepool --poolmetadata $vg/meta
+# RAID for thin pool data LV
+lvcreate --type raid1 -m 1 -L 8 -n thinpool $vg "$dev3" "$dev4"
+# Convert thin pool data to a cached LV
+lvconvert --type cache $vg/thinpool --cachepool $vg/cachepool
+# Create simple thin pool meta
+lvcreate -L 2M -n meta $vg "$dev1"
+# Use thin pool data LV to build a thin pool
+lvconvert --thinpool $vg/thinpool --poolmetadata $vg/meta
+# Create a thin lv for fun
+lvcreate -T $vg/thinpool -V 20 -n thin_lv
+
+check lv_tree_on $vg ${lv1}_foo "$dev1"
+check lv_tree_on $vg cachepool "$dev1" "$dev2"
+check lv_tree_on $vg thinpool "$dev1" "$dev3" "$dev4"
+
+aux mkdev_md5sum $vg thin_lv
+lvs -a -o name,attr,devices $vg
+# Should move ${lv1}_foo and thinpool_tmeta from dev1 to dev5
+pvmove "$dev1" "$dev5" 2>&1 | tee out
+lvs -a -o name,attr,devices $vg
+check lv_tree_on $vg ${lv1}_foo "$dev5"
+not check lv_tree_on $vg cachepool "$dev5" "$dev2"
+check lv_tree_on $vg thinpool "$dev3" "$dev4" "$dev5" # Move non-cache tmeta
+#check dev_md5sum $vg/thin_lv
+
+#pvmove -n $vg/cachepool "$dev5" "$dev1"
+#check lv_tree_on $vg ${lv1}_foo "$dev5"
+#check lv_tree_on $vg $vg/cachepool "$dev1" "$dev2"
+#check lv_tree_on $vg $vg/thinpool "$dev3" "$dev4"
+#check dev_md5sum $vg/thin_lv
+
+lvremove -ff $vg
\ No newline at end of file
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 19e1482..a7788ba 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -233,6 +233,32 @@ static int sub_lv_of(struct logical_volume *lv, const char *lv_name)
return sub_lv_of(seg->lv, lv_name);
}
+/*
+ * parent_lv_is_cache_type
+ *
+ * FIXME: This function can be removed when 'pvmove' is supported for
+ * cache types.
+ *
+ * If this LV is below a cache LV (at any depth), return 1.
+ */
+static int parent_lv_is_cache_type(struct logical_volume *lv)
+{
+ struct lv_segment *seg;
+
+ /* Sub-LVs only ever have one segment using them */
+ if (dm_list_size(&lv->segs_using_this_lv) != 1)
+ return 0;
+
+ if (!(seg = get_only_segment_using_this_lv(lv)))
+ return_0;
+
+ if (lv_is_cache_type(seg->lv))
+ return 1;
+
+ /* Continue up the tree */
+ return parent_lv_is_cache_type(seg->lv);
+}
+
/* Create new LV with mirror segments for the required copies */
static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
struct volume_group *vg,
@@ -342,6 +368,23 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
if (!lv_is_on_pvs(lv, source_pvl))
continue;
+ if (lv_is_cache_type(lv)) {
+ log_print_unless_silent("Skipping %s LV, %s",
+ lv_is_cache(lv) ? "cache" :
+ lv_is_cache_pool(lv) ?
+ "cache-pool" : "cache-related",
+ lv->name);
+ lv_skipped = 1;
+ continue;
+ }
+
+ if (parent_lv_is_cache_type(lv)) {
+ log_print_unless_silent("Skipping %s because a parent"
+ " is of cache type", lv->name);
+ lv_skipped = 1;
+ continue;
+ }
+
/*
* If the VG is clustered, we are unable to handle
* snapshots, origins, thin types, RAID or mirror
10 years, 3 months
master - test: Add cache[pool] support to lv_tree_devices_ test suite function.
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fdb7356d6a9be4...
Commit: fdb7356d6a9be43678c9d001725aef6dca02d178
Parent: f3d1debb18cc58d36eed75ba6610e5a3ef498d12
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Feb 24 10:40:00 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Feb 24 10:40:00 2014 -0600
test: Add cache[pool] support to lv_tree_devices_ test suite function.
---
test/lib/get.sh | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/test/lib/get.sh b/test/lib/get.sh
index 5dd5451..babc4c9 100644
--- a/test/lib/get.sh
+++ b/test/lib/get.sh
@@ -70,6 +70,13 @@ lv_tree_devices_() {
lv_tree_devices_ "$1" "$(lv_field_lv_ $lv data_lv)"
lv_tree_devices_ "$1" "$(lv_field_lv_ $lv metadata_lv)"
;;
+ cache)
+ lv_tree_devices_ "$1" "$(lv_devices $lv)"
+ ;;
+ cache-pool)
+ lv_tree_devices_ "$1" "$(lv_field_lv_ $lv data_lv)"
+ lv_tree_devices_ "$1" "$(lv_field_lv_ $lv metadata_lv)"
+ ;;
esac
}
10 years, 3 months
master - cache: Disallow resizing of cache related LVs
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f3d1debb18cc58...
Commit: f3d1debb18cc58d36eed75ba6610e5a3ef498d12
Parent: 46223c4284552b23cac7c49c49dc1612b45bb66e
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Feb 24 10:19:50 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Feb 24 10:19:50 2014 -0600
cache: Disallow resizing of cache related LVs
For now, disallow lvextend/lvreduce/lvresize of cache LVs, cache
pool LVs, and cache pool sub-LVs.
---
lib/metadata/lv_manip.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index e25dd17..92e65ae 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4274,6 +4274,11 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
struct logical_volume *lock_lv = NULL;
int inactive = 0;
+ if (lv_is_cache_type(lv)) {
+ log_error("Unable to resize logical volumes of cache type.");
+ return 0;
+ }
+
if (lp->sizeargs &&
!(lock_lv = _lvresize_volume(cmd, lv, lp, pvh)))
return_0;
10 years, 3 months
master - test: move RAID10 tests from lvcreate-raid.sh to lvcreate-raid10.sh
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=46223c4284552b...
Commit: 46223c4284552b23cac7c49c49dc1612b45bb66e
Parent: 13c3f53f55288fcd2dbab1cfc0dd30380521e1cf
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Feb 21 18:26:47 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Feb 21 18:28:16 2014 -0600
test: move RAID10 tests from lvcreate-raid.sh to lvcreate-raid10.sh
---
test/shell/lvcreate-raid.sh | 12 ------------
test/shell/lvcreate-raid10.sh | 25 ++++++++++++++++++++++++-
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/test/shell/lvcreate-raid.sh b/test/shell/lvcreate-raid.sh
index 6587f23..2053d04 100644
--- a/test/shell/lvcreate-raid.sh
+++ b/test/shell/lvcreate-raid.sh
@@ -170,9 +170,6 @@ lvremove -ff $vg
not lvcreate --type raid1 -l1 $vg $dev1
not lvcreate --type raid5 -l2 $vg $dev1 $dev2
not lvcreate --type raid6 -l3 $vg $dev1 $dev2 $dev3 $dev4
-if aux target_at_least dm-raid 1 4 1; then
- not lvcreate --type raid10 -l2 $vg $dev1 $dev2 $dev3
-fi
# Implicit count comes from #PVs given (always 2 for mirror though)
lvcreate --type raid1 -l1 -n raid1 $vg $dev1 $dev2
@@ -181,10 +178,6 @@ lvcreate --type raid5 -l2 -n raid5 $vg $dev1 $dev2 $dev3
lv_devices $vg raid5 3
lvcreate --type raid6 -l3 -n raid6 $vg $dev1 $dev2 $dev3 $dev4 $dev5
lv_devices $vg raid6 5
-if aux target_at_least dm-raid 1 4 1; then
- lvcreate --type raid10 -l2 -n raid10 $vg $dev1 $dev2 $dev3 $dev4
- lv_devices $vg raid10 4
-fi
lvremove -ff $vg
# Implicit count comes from total #PVs in VG (always 2 for mirror though)
@@ -194,9 +187,4 @@ lvcreate --type raid5 -l2 -n raid5 $vg
lv_devices $vg raid5 6
lvcreate --type raid6 -l3 -n raid6 $vg
lv_devices $vg raid6 6
-
-if aux target_at_least dm-raid 1 4 1; then
- lvcreate --type raid10 -l2 -n raid10 $vg
- lv_devices $vg raid10 6
-fi
lvremove -ff $vg
diff --git a/test/shell/lvcreate-raid10.sh b/test/shell/lvcreate-raid10.sh
index 0ee18b8..ba35fdf 100644
--- a/test/shell/lvcreate-raid10.sh
+++ b/test/shell/lvcreate-raid10.sh
@@ -11,6 +11,14 @@
. lib/test
+lv_devices() {
+ local local_vg=$1
+ local local_lv=$2
+ local count=$3
+
+ [ $count == `lvs --noheadings -o devices $local_vg/$local_lv | sed s/,/' '/g | wc -w` ]
+}
+
########################################################
# MAIN
########################################################
@@ -23,7 +31,6 @@ vgcreate -s 512k $vg $(cat DEVICES)
# Create RAID10:
#
-
# Should not allow more than 2-way mirror
not lvcreate --type raid10 -m 2 -i 2 -l 2 -n $lv1 $vg
@@ -54,6 +61,22 @@ lvcreate --type raid10 -i 3 -l 100%FREE -n raid10 $vg
check lv_field $vg/raid10 size "54.00m"
lvremove -ff $vg
+# Create RAID (implicit stripe count based on PV count)
+#######################################################
+
+# Not enough drives
+not lvcreate --type raid10 -l2 $vg $dev1 $dev2 $dev3
+
+# Implicit count comes from #PVs given (always 2-way mirror)
+lvcreate --type raid10 -l2 -n raid10 $vg $dev1 $dev2 $dev3 $dev4
+lv_devices $vg raid10 4
+lvremove -ff $vg
+
+# Implicit count comes from total #PVs in VG (always 2 for mirror though)
+lvcreate --type raid10 -l2 -n raid10 $vg
+lv_devices $vg raid10 6
+lvremove -ff $vg
+
#
# FIXME: Add tests that specify particular PVs to use for creation
#
10 years, 3 months
master - allocation: misc fixes for percent/raid rounding
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=13c3f53f55288f...
Commit: 13c3f53f55288fcd2dbab1cfc0dd30380521e1cf
Parent: 294671fa629fb1d2e3580a411cc3ada3acce6626
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sat Feb 22 00:26:01 2014 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sat Feb 22 00:26:01 2014 +0000
allocation: misc fixes for percent/raid rounding
Several fixes for the recent changes that treat allocation percentages
as upper limits.
Improve messages to make it easier to see what is happening.
Fix some cases that failed with errors when they didn't need to.
Fix crashes when first_seg() returns NULL.
Remove a couple of log_errors that were actually debugging messages.
---
lib/display/display.c | 7 +++
lib/display/display.h | 2 +
lib/metadata/lv.c | 19 ++++++---
lib/metadata/lv_manip.c | 97 ++++++++++++++++++++++++++++-----------------
lib/metadata/thin_manip.c | 4 +-
tools/lvcreate.c | 19 ++++++---
6 files changed, 96 insertions(+), 52 deletions(-)
diff --git a/lib/display/display.c b/lib/display/display.c
index 9b4f828..66acb88 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -182,6 +182,13 @@ alloc_policy_t get_alloc_from_string(const char *str)
return ALLOC_INVALID;
}
+static const char *_percent_types[7] = { "NONE", "VGS", "FREE", "LVS", "PVS", "ORIGIN" };
+
+const char *get_percent_string(percent_type_t def)
+{
+ return _percent_types[def];
+}
+
#define BASE_UNKNOWN 0
#define BASE_SHARED 1
#define BASE_1024 8
diff --git a/lib/display/display.h b/lib/display/display.h
index c58df45..41fba03 100644
--- a/lib/display/display.h
+++ b/lib/display/display.h
@@ -64,6 +64,8 @@ const char *get_alloc_string(alloc_policy_t alloc);
char alloc_policy_char(alloc_policy_t alloc);
alloc_policy_t get_alloc_from_string(const char *str);
+const char *get_percent_string(percent_type_t def);
+
char yes_no_prompt(const char *prompt, ...) __attribute__ ((format(printf, 1, 2)));
#endif
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 2d78dec..2f2b7cb 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -393,9 +393,13 @@ uint64_t lv_size(const struct logical_volume *lv)
static int _lv_mimage_in_sync(const struct logical_volume *lv)
{
percent_t percent;
- struct lv_segment *mirror_seg = find_mirror_seg(first_seg(lv));
+ struct lv_segment *seg = first_seg(lv);
+ struct lv_segment *mirror_seg;
- if (!(lv->status & MIRROR_IMAGE) || !mirror_seg)
+ if (seg)
+ mirror_seg = find_mirror_seg(seg);
+
+ if (!(lv->status & MIRROR_IMAGE) || !seg || !mirror_seg)
return_0;
if (!lv_mirror_percent(lv->vg->cmd, mirror_seg->lv, 0, &percent,
@@ -410,7 +414,7 @@ static int _lv_raid_image_in_sync(const struct logical_volume *lv)
unsigned s;
percent_t percent;
char *raid_health;
- struct lv_segment *raid_seg;
+ struct lv_segment *seg, *raid_seg = NULL;
/*
* If the LV is not active locally,
@@ -424,7 +428,8 @@ static int _lv_raid_image_in_sync(const struct logical_volume *lv)
return 0;
}
- raid_seg = get_only_segment_using_this_lv(first_seg(lv)->lv);
+ if ((seg = first_seg(lv)))
+ raid_seg = get_only_segment_using_this_lv(seg->lv);
if (!raid_seg) {
log_error("Failed to find RAID segment for %s", lv->name);
return 0;
@@ -472,7 +477,7 @@ static int _lv_raid_healthy(const struct logical_volume *lv)
{
unsigned s;
char *raid_health;
- struct lv_segment *raid_seg;
+ struct lv_segment *seg, *raid_seg = NULL;
/*
* If the LV is not active locally,
@@ -488,8 +493,8 @@ static int _lv_raid_healthy(const struct logical_volume *lv)
if (lv->status & RAID)
raid_seg = first_seg(lv);
- else
- raid_seg = get_only_segment_using_this_lv(first_seg(lv)->lv);
+ else if ((seg = first_seg(lv)))
+ raid_seg = get_only_segment_using_this_lv(seg->lv);
if (!raid_seg) {
log_error("Failed to find RAID segment for %s", lv->name);
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 2b1cdcc..e25dd17 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -346,6 +346,11 @@ struct lv_segment *get_only_segment_using_this_lv(struct logical_volume *lv)
{
struct seg_list *sl;
+ if (!lv) {
+ log_error(INTERNAL_ERROR "get_only_segment_using_this_lv() called with NULL LV.");
+ return NULL;
+ }
+
if (dm_list_size(&lv->segs_using_this_lv) != 1) {
log_error("%s is expected to have only one segment using it, "
"while it has %d", lv->name,
@@ -943,6 +948,7 @@ struct alloc_handle {
* and data device allocated together.
*/
unsigned alloc_and_split_meta;
+ unsigned split_metadata_is_allocated; /* Metadata has been allocated */
const struct dm_config_node *cling_tag_list_cn;
@@ -1149,11 +1155,17 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
* We need 'log_len' extents for each
* RAID device's metadata_area
*/
- ah->new_extents += (ah->log_len * ah->area_multiple);
+ if (!approx_alloc)
+ ah->new_extents += (ah->log_len * ah->area_multiple);
} else {
ah->log_area_count = 0;
ah->log_len = 0;
}
+ if (approx_alloc) {
+ ah->new_extents = ah->new_extents * ah->area_multiple / (ah->area_count + ah->parity_count);
+ ah->new_extents = (ah->new_extents / ah->area_multiple) * ah->area_multiple;
+ log_debug("Adjusted allocation request to %" PRIu32 " data extents.", ah->new_extents);
+ }
} else if (segtype_is_thin_pool(segtype)) {
/*
* thin_pool uses ah->region_size to
@@ -1177,13 +1189,17 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
find_config_tree_bool(cmd, allocation_cache_pool_metadata_require_separate_pvs_CFG, NULL);
if (!ah->mirror_logs_separate) {
ah->alloc_and_split_meta = 1;
- ah->new_extents += ah->log_len;
+ if (!approx_alloc)
+ ah->new_extents += ah->log_len;
}
} else {
ah->log_area_count = metadata_area_count;
ah->log_len = !metadata_area_count ? 0 :
mirror_log_extents(ah->region_size, extent_size,
new_extents / ah->area_multiple);
+ ah->new_extents = ah->new_extents * ah->area_multiple / ah->area_count;
+ ah->new_extents = (ah->new_extents / ah->area_multiple) * ah->area_multiple;
+ log_debug("Adjusted allocation request to %" PRIu32 " data extents.", ah->new_extents);
}
for (s = 0; s < alloc_count; s++)
@@ -1196,6 +1212,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->maximise_cling = find_config_tree_bool(cmd, allocation_maximise_cling_CFG, NULL);
ah->approx_alloc = approx_alloc;
+
return ah;
}
@@ -1216,18 +1233,10 @@ static int _sufficient_pes_free(struct alloc_handle *ah, struct dm_list *pvms,
uint32_t free_pes = pv_maps_size(pvms);
if (total_extents_needed > free_pes) {
- if (!ah->approx_alloc) {
- log_error("Insufficient free space: %" PRIu32
- " extents needed,"
- " but only %" PRIu32 " available",
- total_extents_needed, free_pes);
-
- return 0;
- }
- log_verbose("Insufficient free space: %" PRIu32
- " extents needed, but only %" PRIu32
- " available: amount will be reduced",
- total_extents_needed, free_pes);
+ log_error("Insufficient free space: %" PRIu32 " extents needed,"
+ " but only %" PRIu32 " available",
+ total_extents_needed, free_pes);
+ return 0;
}
return 1;
@@ -1429,7 +1438,7 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t max_to_allocat
if (area_len > alloc_state->areas[s].used)
area_len = alloc_state->areas[s].used;
- len = (ah->alloc_and_split_meta) ? total_area_count * 2 : total_area_count;
+ len = (ah->alloc_and_split_meta && !ah->split_metadata_is_allocated) ? total_area_count * 2 : total_area_count;
len *= sizeof(*aa);
if (!(aa = dm_pool_alloc(ah->mem, len))) {
log_error("alloced_area allocation failed");
@@ -1449,7 +1458,7 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t max_to_allocat
}
pva = alloc_state->areas[s + ix_log_skip].pva;
- if (ah->alloc_and_split_meta) {
+ if (ah->alloc_and_split_meta && !ah->split_metadata_is_allocated) {
/*
* The metadata area goes at the front of the allocated
* space for now, but could easily go at the end (or
@@ -1475,7 +1484,7 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t max_to_allocat
dm_list_add(&ah->alloced_areas[s], &aa[s].list);
s -= ah->area_count + ah->parity_count;
}
- aa[s].len = (ah->alloc_and_split_meta) ? len - ah->log_len : len;
+ aa[s].len = (ah->alloc_and_split_meta && !ah->split_metadata_is_allocated) ? len - ah->log_len : len;
/* Skip empty allocations */
if (!aa[s].len)
continue;
@@ -1493,7 +1502,8 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t max_to_allocat
}
/* Only need to alloc metadata from the first batch */
- ah->alloc_and_split_meta = 0;
+ if (ah->alloc_and_split_meta)
+ ah->split_metadata_is_allocated = 1;
ah->total_area_len += area_len;
@@ -1995,7 +2005,8 @@ static void _reset_unreserved(struct dm_list *pvms)
}
static void _report_needed_allocation_space(struct alloc_handle *ah,
- struct alloc_state *alloc_state)
+ struct alloc_state *alloc_state,
+ struct dm_list *pvms)
{
const char *metadata_type;
uint32_t parallel_areas_count, parallel_area_size;
@@ -2003,7 +2014,7 @@ static void _report_needed_allocation_space(struct alloc_handle *ah,
parallel_area_size = ah->new_extents - alloc_state->allocated;
parallel_area_size /= ah->area_multiple;
- parallel_area_size -= (ah->alloc_and_split_meta) ? ah->log_len : 0;
+ parallel_area_size -= (ah->alloc_and_split_meta && !ah->split_metadata_is_allocated) ? ah->log_len : 0;
parallel_areas_count = ah->area_count + ah->parity_count;
@@ -2011,14 +2022,16 @@ static void _report_needed_allocation_space(struct alloc_handle *ah,
if (ah->alloc_and_split_meta) {
metadata_type = "metadata area";
metadata_count = parallel_areas_count;
+ if (ah->split_metadata_is_allocated)
+ metadata_size = 0;
} else {
metadata_type = "mirror log";
metadata_count = alloc_state->log_area_count_still_needed;
}
- log_debug_alloc("Still need %s%" PRIu32 " total extents:",
+ log_debug_alloc("Still need %s%" PRIu32 " total extents from %" PRIu32 " remaining:",
ah->approx_alloc ? "up to " : "",
- parallel_area_size * parallel_areas_count + metadata_size * metadata_count);
+ parallel_area_size * parallel_areas_count + metadata_size * metadata_count, pv_maps_size(pvms));
log_debug_alloc(" %" PRIu32 " (%" PRIu32 " data/%" PRIu32
" parity) parallel areas of %" PRIu32 " extents each",
parallel_areas_count, ah->area_count, ah->parity_count, parallel_area_size);
@@ -2064,7 +2077,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah, const struct alloc
_clear_areas(alloc_state);
_reset_unreserved(pvms);
- _report_needed_allocation_space(ah, alloc_state);
+ _report_needed_allocation_space(ah, alloc_state, pvms);
/* ix holds the number of areas found on other PVs */
do {
@@ -2289,11 +2302,11 @@ static int _find_max_parallel_space_for_one_policy(struct alloc_handle *ah, stru
* data together will be split, we must adjust
* the comparison accordingly.
*/
- if (ah->alloc_and_split_meta)
+ if (ah->alloc_and_split_meta && !ah->split_metadata_is_allocated)
max_tmp -= ah->log_len;
if (max_tmp > (spvs->le + spvs->len) * ah->area_multiple) {
max_to_allocate = (spvs->le + spvs->len) * ah->area_multiple - alloc_state->allocated;
- max_to_allocate += ah->alloc_and_split_meta ? ah->log_len : 0;
+ max_to_allocate += (ah->alloc_and_split_meta && !ah->split_metadata_is_allocated) ? ah->log_len : 0;
}
parallel_pvs = &spvs->pvs;
break;
@@ -2321,7 +2334,7 @@ static int _find_max_parallel_space_for_one_policy(struct alloc_handle *ah, stru
} else if (ah->maximise_cling && alloc_parms->alloc == ALLOC_NORMAL &&
!(alloc_parms->flags & A_CLING_TO_ALLOCED))
alloc_parms->flags |= A_CLING_TO_ALLOCED;
- } while ((alloc_parms->alloc != ALLOC_CONTIGUOUS) && alloc_state->allocated != alloc_parms->extents_still_needed && (alloc_parms->flags & A_CAN_SPLIT));
+ } while ((alloc_parms->alloc != ALLOC_CONTIGUOUS) && alloc_state->allocated != alloc_parms->extents_still_needed && (alloc_parms->flags & A_CAN_SPLIT) && (!ah->approx_alloc || pv_maps_size(pvms)));
return 1;
}
@@ -2415,7 +2428,7 @@ static int _allocate(struct alloc_handle *ah,
old_allocated = alloc_state.allocated;
log_debug_alloc("Trying allocation using %s policy.", get_alloc_string(alloc));
- if (!_sufficient_pes_free(ah, pvms, alloc_state.allocated, ah->new_extents))
+ if (!ah->approx_alloc && !_sufficient_pes_free(ah, pvms, alloc_state.allocated, ah->new_extents))
goto_out;
_init_alloc_parms(ah, &alloc_parms, alloc, prev_lvseg,
@@ -2441,12 +2454,19 @@ static int _allocate(struct alloc_handle *ah,
ah->area_count / ah->area_multiple);
goto out;
}
- log_verbose("Insufficient suitable %sallocatable extents "
- "for logical volume %s: size reduced by %u extents",
+ if (!alloc_state.allocated) {
+ log_error("Insufficient suitable %sallocatable extents "
+ "found for logical volume %s.",
+ can_split ? "" : "contiguous ",
+ lv ? lv->name : "");
+ goto out;
+ }
+ log_verbose("Found fewer %sallocatable extents "
+ "for logical volume %s than requested: using %" PRIu32 " extents (reduced by %u).",
can_split ? "" : "contiguous ",
lv ? lv->name : "",
- (ah->new_extents - alloc_state.allocated) *
- ah->area_count / ah->area_multiple);
+ alloc_state.allocated,
+ (ah->new_extents - alloc_state.allocated) * ah->area_count / ah->area_multiple);
ah->new_extents = alloc_state.allocated;
}
@@ -3014,6 +3034,12 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
/*
* Entry point for single-step LV allocation + extension.
+ * Extents is the number of logical extents to append to the LV unless
+ * approx_alloc is set when it is an upper limit for the total number of
+ * extents to use from the VG.
+ *
+ * FIXME The approx_alloc raid/stripe conversion should be performed
+ * before calling this function.
*/
int lv_extend(struct logical_volume *lv,
const struct segment_type *segtype,
@@ -3028,7 +3054,7 @@ int lv_extend(struct logical_volume *lv,
struct alloc_handle *ah;
uint32_t sub_lv_count;
- log_very_verbose("Extending segment type, %s", segtype->name);
+ log_very_verbose("Adding segment of type %s to LV %s.", segtype->name, lv->name);
if (segtype_is_virtual(segtype))
return lv_add_virtual_segment(lv, 0u, extents, segtype, thin_pool_name);
@@ -3054,11 +3080,8 @@ int lv_extend(struct logical_volume *lv,
if (ah->approx_alloc) {
extents = ah->new_extents;
- if (segtype_is_raid(segtype)) {
- log_error("Extents before: %u", extents);
+ if (segtype_is_raid(segtype))
extents -= ah->log_len * ah->area_multiple;
- log_error("Extents after : %u", extents);
- }
}
if (segtype_is_thin_pool(segtype) || segtype_is_cache_pool(segtype)) {
@@ -6025,7 +6048,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
if (!seg_is_virtual(lp) &&
- vg->free_count < lp->extents) {
+ vg->free_count < lp->extents && !lp->approx_alloc) {
log_error("Volume group \"%s\" has insufficient free space "
"(%u extents): %u required.",
vg->name, vg->free_count, lp->extents);
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 1ae893a..b28f5a0 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -140,7 +140,9 @@ int detach_thin_external_origin(struct lv_segment *seg)
int lv_is_merging_thin_snapshot(const struct logical_volume *lv)
{
- return (first_seg(lv)->status & MERGING) ? 1 : 0;
+ struct lv_segment *seg = first_seg(lv);
+
+ return (seg && seg->status & MERGING) ? 1 : 0;
}
/*
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 7e61203..c56cc7c 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -363,21 +363,19 @@ static int _update_extents_params(struct volume_group *vg,
} else
lp->pvh = &vg->pvs;
- if (lcp->percent)
- lp->approx_alloc = 1;
switch(lcp->percent) {
case PERCENT_VG:
- lp->extents = percent_of_extents(lp->extents, vg->extent_count, 0);
+ extents = percent_of_extents(lp->extents, vg->extent_count, 0);
break;
case PERCENT_FREE:
- lp->extents = percent_of_extents(lp->extents, vg->free_count, 0);
+ extents = percent_of_extents(lp->extents, vg->free_count, 0);
break;
case PERCENT_PVS:
if (lcp->pv_count) {
pv_extent_count = pv_list_extents_free(lp->pvh);
- lp->extents = percent_of_extents(lp->extents, pv_extent_count, 0);
+ extents = percent_of_extents(lp->extents, pv_extent_count, 0);
} else
- lp->extents = percent_of_extents(lp->extents, vg->extent_count, 0);
+ extents = percent_of_extents(lp->extents, vg->extent_count, 0);
break;
case PERCENT_LV:
log_error("Please express size as %%VG, %%PVS, or "
@@ -394,12 +392,19 @@ static int _update_extents_params(struct volume_group *vg,
log_error(INTERNAL_ERROR "Couldn't find origin volume.");
return 0;
}
- lp->extents = percent_of_extents(lp->extents, origin->le_count, 0);
+ extents = percent_of_extents(lp->extents, origin->le_count, 0);
break;
case PERCENT_NONE:
+ extents = lp->extents;
break;
}
+ if (lcp->percent) {
+ lp->approx_alloc = 1;
+ log_verbose("Converted %" PRIu32 "%%%s into %" PRIu32 " extents.", lp->extents, get_percent_string(lcp->percent), extents);
+ lp->extents = extents;
+ }
+
if (lp->snapshot && lp->origin && lp->extents) {
if (!lp->chunk_size) {
log_error(INTERNAL_ERROR "Missing snapshot chunk size.");
10 years, 3 months
master - test: Only try raid10 on dm-raid versions that support it.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=294671fa629fb1...
Commit: 294671fa629fb1d2e3580a411cc3ada3acce6626
Parent: 84d02542bd1e52e2f8721a56b0d98d23c478205e
Author: Petr Rockai <me(a)mornfall.net>
AuthorDate: Fri Feb 21 19:46:31 2014 +0100
Committer: Petr Rockai <me(a)mornfall.net>
CommitterDate: Fri Feb 21 19:47:06 2014 +0100
test: Only try raid10 on dm-raid versions that support it.
---
test/shell/lvcreate-raid.sh | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvcreate-raid.sh b/test/shell/lvcreate-raid.sh
index 3f467f5..6587f23 100644
--- a/test/shell/lvcreate-raid.sh
+++ b/test/shell/lvcreate-raid.sh
@@ -170,7 +170,9 @@ lvremove -ff $vg
not lvcreate --type raid1 -l1 $vg $dev1
not lvcreate --type raid5 -l2 $vg $dev1 $dev2
not lvcreate --type raid6 -l3 $vg $dev1 $dev2 $dev3 $dev4
-not lvcreate --type raid10 -l2 $vg $dev1 $dev2 $dev3
+if aux target_at_least dm-raid 1 4 1; then
+ not lvcreate --type raid10 -l2 $vg $dev1 $dev2 $dev3
+fi
# Implicit count comes from #PVs given (always 2 for mirror though)
lvcreate --type raid1 -l1 -n raid1 $vg $dev1 $dev2
@@ -179,8 +181,10 @@ lvcreate --type raid5 -l2 -n raid5 $vg $dev1 $dev2 $dev3
lv_devices $vg raid5 3
lvcreate --type raid6 -l3 -n raid6 $vg $dev1 $dev2 $dev3 $dev4 $dev5
lv_devices $vg raid6 5
-lvcreate --type raid10 -l2 -n raid10 $vg $dev1 $dev2 $dev3 $dev4
-lv_devices $vg raid10 4
+if aux target_at_least dm-raid 1 4 1; then
+ lvcreate --type raid10 -l2 -n raid10 $vg $dev1 $dev2 $dev3 $dev4
+ lv_devices $vg raid10 4
+fi
lvremove -ff $vg
# Implicit count comes from total #PVs in VG (always 2 for mirror though)
@@ -190,6 +194,9 @@ lvcreate --type raid5 -l2 -n raid5 $vg
lv_devices $vg raid5 6
lvcreate --type raid6 -l3 -n raid6 $vg
lv_devices $vg raid6 6
-lvcreate --type raid10 -l2 -n raid10 $vg
-lv_devices $vg raid10 6
+
+if aux target_at_least dm-raid 1 4 1; then
+ lvcreate --type raid10 -l2 -n raid10 $vg
+ lv_devices $vg raid10 6
+fi
lvremove -ff $vg
10 years, 3 months
master - WHATS_NEW: for commit b391ae88e5ed3720a8b5a87312e0cd907a94fcc2
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=84d02542bd1e52...
Commit: 84d02542bd1e52e2f8721a56b0d98d23c478205e
Parent: bbe4aca7c42ee3b1e620fb673a739b4b0f777144
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Feb 21 11:36:55 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Feb 21 11:36:55 2014 +0100
WHATS_NEW: for commit b391ae88e5ed3720a8b5a87312e0cd907a94fcc2
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c081898..23f7424 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Avoid a PV label scan while in a critical section.
Remove (always 0) skip argument from lv_activation_skip().
Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV via udev.
lvcreate computes RAID4/5/6 stripes if not given from # of allocatable PVs.
10 years, 3 months
master - coverity: check dm_strncpy return value in dmeventd/_get_parameters
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bbe4aca7c42ee3...
Commit: bbe4aca7c42ee3b1e620fb673a739b4b0f777144
Parent: 08116a4962bef2a36549c5496b3230862d3c93ca
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Feb 20 15:06:13 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Feb 20 15:06:13 2014 +0100
coverity: check dm_strncpy return value in dmeventd/_get_parameters
---
daemons/dmeventd/dmeventd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 1d979fa..4a17fb2 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -531,7 +531,8 @@ static int _get_parameters(struct message_data *message_data) {
msg->size = strlen(buf) + 1;
if (!(msg->data = dm_malloc(msg->size)))
goto_out;
- dm_strncpy(msg->data, buf, msg->size);
+ if (!dm_strncpy(msg->data, buf, msg->size))
+ goto_out;
r = 0;
out:
return r;
10 years, 3 months
master - cleanup: missing header file
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=08116a4962bef2...
Commit: 08116a4962bef2a36549c5496b3230862d3c93ca
Parent: 5e83682ccf1862289ed2f3bcbe03cfa1c190e1e0
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Feb 20 09:07:38 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Feb 20 09:07:38 2014 +0100
cleanup: missing header file
---
lib/format_text/format-text.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 6cedc99..b4f96f8 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -29,6 +29,7 @@
#include "label.h"
#include "lvmcache.h"
#include "lvmetad.h"
+#include "memlock.h"
#include <unistd.h>
#include <sys/param.h>
10 years, 3 months