master - dev-cache: Make it possible to pass in a NULL filter.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=72d82e21d44c48...
Commit: 72d82e21d44c48a3823156afa900eb071b3eb144
Parent: 012d273ede86f0e3e894b0e907f7f623c3dda7e0
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Aug 18 22:03:46 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Sep 26 12:23:34 2012 +0200
dev-cache: Make it possible to pass in a NULL filter.
---
lib/device/dev-cache.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index c92e11e..1da9a77 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -971,21 +971,23 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
if (dev_scan && !trust_cache()) {
/* Flag gets reset between each command */
- if (!full_scan_done())
+ if (!full_scan_done() && f)
persistent_filter_wipe(f); /* Calls _full_scan(1) */
} else
_full_scan(0);
di->current = btree_first(_cache.devices);
di->filter = f;
- di->filter->use_count++;
+ if (di->filter)
+ di->filter->use_count++;
return di;
}
void dev_iter_destroy(struct dev_iter *iter)
{
- iter->filter->use_count--;
+ if (iter->filter)
+ iter->filter->use_count--;
dm_free(iter);
}
11 years, 7 months
master - filters: Alwayz zalloc the filter struct.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=012d273ede86f0...
Commit: 012d273ede86f0e3e894b0e907f7f623c3dda7e0
Parent: 376cb3fe64c4874fe4276722c4276521481dc80b
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Aug 18 18:59:07 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Sep 26 12:23:34 2012 +0200
filters: Alwayz zalloc the filter struct.
Not all pointers need to be initialised explicitly that way.
---
lib/filters/filter-composite.c | 2 +-
lib/filters/filter-md.c | 2 +-
lib/filters/filter-mpath.c | 2 +-
lib/filters/filter-persistent.c | 2 +-
lib/filters/filter.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/filters/filter-composite.c b/lib/filters/filter-composite.c
index 130490a..3ed8787 100644
--- a/lib/filters/filter-composite.c
+++ b/lib/filters/filter-composite.c
@@ -64,7 +64,7 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
memcpy(filters_copy, filters, sizeof(*filters) * n);
filters_copy[n] = NULL;
- if (!(cft = dm_malloc(sizeof(*cft)))) {
+ if (!(cft = dm_zalloc(sizeof(*cft)))) {
log_error("compsoite filters allocation failed");
dm_free(filters_copy);
return NULL;
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index e3e88f1..d57489d 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -54,7 +54,7 @@ struct dev_filter *md_filter_create(void)
{
struct dev_filter *f;
- if (!(f = dm_malloc(sizeof(*f)))) {
+ if (!(f = dm_zalloc(sizeof(*f)))) {
log_error("md filter allocation failed");
return NULL;
}
diff --git a/lib/filters/filter-mpath.c b/lib/filters/filter-mpath.c
index 6d6353a..61a62d7 100644
--- a/lib/filters/filter-mpath.c
+++ b/lib/filters/filter-mpath.c
@@ -185,7 +185,7 @@ struct dev_filter *mpath_filter_create(const char *sysfs_dir)
return NULL;
}
- if (!(f = dm_malloc(sizeof(*f)))) {
+ if (!(f = dm_zalloc(sizeof(*f)))) {
log_error("mpath filter allocation failed");
return NULL;
}
diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c
index 3705804..79e40b8 100644
--- a/lib/filters/filter-persistent.c
+++ b/lib/filters/filter-persistent.c
@@ -355,7 +355,7 @@ struct dev_filter *persistent_filter_create(struct dev_filter *real,
goto bad;
}
- if (!(f = dm_malloc(sizeof(*f)))) {
+ if (!(f = dm_zalloc(sizeof(*f)))) {
log_error("Allocation of device filter for persistent filter failed.");
goto bad;
}
diff --git a/lib/filters/filter.c b/lib/filters/filter.c
index dcb6c5e..e335045 100644
--- a/lib/filters/filter.c
+++ b/lib/filters/filter.c
@@ -325,7 +325,7 @@ struct dev_filter *lvm_type_filter_create(const char *proc,
{
struct dev_filter *f;
- if (!(f = dm_malloc(sizeof(struct dev_filter)))) {
+ if (!(f = dm_zalloc(sizeof(struct dev_filter)))) {
log_error("LVM type filter allocation failed");
return NULL;
}
11 years, 7 months
master - TEST: Kill lvmetad early in teardown.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=376cb3fe64c487...
Commit: 376cb3fe64c4874fe4276722c4276521481dc80b
Parent: 17901569da5294322dcb09fd9b66531adabdf95d
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sat Aug 11 10:29:38 2012 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Sep 26 12:23:34 2012 +0200
TEST: Kill lvmetad early in teardown.
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 26508cf..0b46c79 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -164,6 +164,7 @@ teardown_devs() {
teardown() {
echo -n "## teardown..."
+ test ! -s LOCAL_LVMETAD || kill -9 "$(cat LOCAL_LVMETAD)" || true
dm_table | not egrep -q "$vg|$vg1|$vg2|$vg3|$vg4" || {
# Avoid activation of dmeventd if there is no pid
@@ -183,7 +184,6 @@ teardown() {
pgrep dmeventd || true
test ! -s LOCAL_DMEVENTD || kill -9 "$(cat LOCAL_DMEVENTD)" || true
- test ! -s LOCAL_LVMETAD || kill -9 "$(cat LOCAL_LVMETAD)" || true
echo -n .
11 years, 7 months
master - cleanup: remove unused variable
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17901569da5294...
Commit: 17901569da5294322dcb09fd9b66531adabdf95d
Parent: 9d0dc63c8bcf255eb48a236824b6e8a58026f305
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Sep 20 07:40:11 2012 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Sep 20 07:40:11 2012 +0200
cleanup: remove unused variable
---
tools/lvchange.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 5048cab..d1cb4cf 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -292,7 +292,6 @@ static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
static int attach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
{
- uint32_t s = 0;
struct cmd_context *cmd = seg->lv->vg->cmd;
struct lv_list *lvl, *tmp;
11 years, 7 months
master - Fix tests to accept extended attribute
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9d0dc63c8bcf25...
Commit: 9d0dc63c8bcf255eb48a236824b6e8a58026f305
Parent: 2e04681248b7c72ce295f538d698ae644c73cc9c
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Sep 20 07:30:24 2012 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Sep 20 07:30:24 2012 +0200
Fix tests to accept extended attribute
attr field had a character (p)artial appended.
---
test/lib/check.sh | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 95bba4b..6b7849f 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -118,8 +118,8 @@ mirror() {
mirror_nonredundant() {
local lv=$1/$2
local attr=$(get lv_field $lv attr)
- (echo "$attr" | grep "^m.......$" >/dev/null) || {
- if (echo "$attr" | grep "^o.......$" >/dev/null) &&
+ (echo "$attr" | grep "^m........$" >/dev/null) || {
+ if (echo "$attr" | grep "^o........$" >/dev/null) &&
lvs -a | fgrep "[${2}_mimage" >/dev/null; then
echo "TEST WARNING: $lv is a snapshot origin and looks like a mirror,"
echo "assuming it is actually a mirror"
@@ -198,7 +198,7 @@ in_sync() {
active() {
local lv=$1/$2
- (get lv_field $lv attr | grep "^....a...$" >/dev/null) || \
+ (get lv_field $lv attr | grep "^....a....$" >/dev/null) || \
die "$lv expected active, but lvs says it's not:" \
$(lvl $lv -o+devices)
dmsetup info $1-$2 >/dev/null ||
@@ -207,7 +207,7 @@ active() {
inactive() {
local lv=$1/$2
- (get lv_field $lv attr | grep "^....[-isd]...$" >/dev/null) || \
+ (get lv_field $lv attr | grep "^....[-isd]....$" >/dev/null) || \
die "$lv expected inactive, but lvs says it's not:" \
$(lvl $lv -o+devices)
not dmsetup info $1-$2 2>/dev/null || \
11 years, 7 months
master - mirror: 'lvconvert --resync' should reset LV_NOTSYNCED on corelog mirror
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2e04681248b7c7...
Commit: 2e04681248b7c72ce295f538d698ae644c73cc9c
Parent: 290ae4791ef5eedaae2bc1cfa3645ac8073faf54
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Sep 19 11:09:32 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Sep 19 11:16:45 2012 -0500
mirror: 'lvconvert --resync' should reset LV_NOTSYNCED on corelog mirror
When reformatting the 'lvchange_resync' code in commit
05131f5853e86419d9c726faa961b8d012298d9c, a '!' should have been removed
from the condition that checks for the LV_NOTSYNCED flag on a corelog
mirror LV. The presence of this '!' caused the LV_NOTSYNCED flag to be
cleared when it wasn't present and left when it was present.
It is not allowed to add images to a 'mirror' or 'raid1' LV if the
LV_NOTSYNCED flag is set. We add some up-convert tests to ensure this
behavior is being enforced and that the LV_NOTSYNCED flag is being
properly cleared by 'lvchange --resync'.
(Not updating WHATS_NEW because this is intrarelease.)
---
test/shell/lvconvert-mirror.sh | 14 ++++++++++++++
test/shell/lvconvert-raid.sh | 12 ++++++++++++
tools/lvchange.c | 2 +-
3 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 4d587d9..c09b8fd 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -264,3 +264,17 @@ lvremove -ff $vg/$lv1
lvcreate -l15 -n $lv1 $vg
not lvconvert -m1 --corelog --stripes 2 $vg/$lv1
lvremove -ff $vg
+
+# Should not be able to add images to --nosync mirror
+# but should be able to after 'lvchange --resync'
+lvcreate -m 1 -l1 -n $lv1 $vg --nosync
+not lvconvert -m +1 $vg/$lv1
+lvchange --resync -y $vg/$lv1
+lvconvert -m +1 $vg/$lv1
+lvremove -ff $vg
+
+lvcreate -m 1 --corelog -l1 -n $lv1 $vg --nosync
+not lvconvert -m +1 $vg/$lv1
+lvchange --resync -y $vg/$lv1
+lvconvert -m +1 $vg/$lv1
+lvremove -ff $vg
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index c62aee5..9c3cff6 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -79,6 +79,18 @@ for i in 1 2 3 4; do
done
done
+##############################################
+# RAID1 - shouldn't be able to add image
+# if created '--nosync', but should
+# be able to after 'lvchange --resync'
+##############################################
+lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg --nosync
+not lvconvert -m +1 $vg/$lv1
+lvchange --resync -y $vg/$lv1
+aux wait_for_sync $vg $lv1
+lvconvert -m +1 $vg/$lv1
+lvremove -ff $vg
+
# 3-way to 2-way convert while specifying devices
lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg $dev1 $dev2 $dev3
aux wait_for_sync $vg $lv1
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 0904e7b..5048cab 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -401,7 +401,7 @@ static int lvchange_resync(struct cmd_context *cmd,
* worry about persistent logs.
*/
if (!seg_is_raid(seg) && !seg->log_lv) {
- if (!(lv->status & LV_NOTSYNCED)) {
+ if (lv->status & LV_NOTSYNCED) {
lv->status &= ~LV_NOTSYNCED;
log_very_verbose("Updating logical volume \"%s\""
" on disk(s)", lv->name);
11 years, 7 months
master - lvs: add partial attribute
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=290ae4791ef5ee...
Commit: 290ae4791ef5eedaae2bc1cfa3645ac8073faf54
Parent: b737ff01e4038d45798521448dc4ae4864d1b29a
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Sep 19 12:49:40 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Sep 19 12:49:40 2012 +0100
lvs: add partial attribute
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 7 ++++++-
man/lvs.8.in | 3 +++
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 996f1a2..448f306 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Add (p)artial attribute to lvs.
Don't try to issue discards to a missing PV to avoid segfault.
Prevent lvremove from removing LVs that have any part missing.
Clear LV_NOSYNCED flag when a RAID1 LV is converted to a linear LV.
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 003e18d..33e3270 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -377,7 +377,7 @@ char *lv_attr_dup(struct dm_pool *mem, const struct logical_volume *lv)
struct lv_segment *seg;
char *repstr;
- if (!(repstr = dm_pool_zalloc(mem, 9))) {
+ if (!(repstr = dm_pool_zalloc(mem, 10))) {
log_error("dm_pool_alloc failed");
return 0;
}
@@ -496,6 +496,11 @@ char *lv_attr_dup(struct dm_pool *mem, const struct logical_volume *lv)
else
repstr[7] = '-';
+ if (lv->status & PARTIAL_LV)
+ repstr[8] = 'p';
+ else
+ repstr[8] = '-';
+
out:
return repstr;
}
diff --git a/man/lvs.8.in b/man/lvs.8.in
index 97e1879..f31256c 100644
--- a/man/lvs.8.in
+++ b/man/lvs.8.in
@@ -157,6 +157,9 @@ Snapshots using the original device-mapper driver appear as (s); whereas
snapshots of thin volumes using the new thin provisioning driver appear as (t).
.IP 8 3
Newly-allocated data blocks are overwritten with blocks of (z)eroes before use.
+.IP 9 3
+(p)artial: One or more of the Physical Volumes this Logical Volume uses is
+missing from the system.
.RE
.TP
.BR \-O ", " \-\-sort
11 years, 7 months
master - discards: skip when removing LVs on missing PVs
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b737ff01e4038d...
Commit: b737ff01e4038d45798521448dc4ae4864d1b29a
Parent: 2a6712ddefb6720d115d11c276223b57abf5dd94
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Sep 19 12:48:56 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Sep 19 12:48:56 2012 +0100
discards: skip when removing LVs on missing PVs
Don't try to issue discards to a missing PV to avoid segfault.
Prevent lvremove from removing LVs that have any part missing.
https://bugzilla.redhat.com/857554
---
WHATS_NEW | 2 ++
lib/metadata/pv_manip.c | 17 +++++++++++++++--
tools/lvremove.c | 6 ++++++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f2aa7ec..996f1a2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.98 -
=================================
+ Don't try to issue discards to a missing PV to avoid segfault.
+ Prevent lvremove from removing LVs that have any part missing.
Clear LV_NOSYNCED flag when a RAID1 LV is converted to a linear LV.
Disallow RAID1 upconvert if the LV was created with --nosync.
Depend on systemd-udev-settle in units generated by activation generator.
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index e85a2bc..d04ecab 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -191,6 +191,7 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
{
uint64_t discard_offset_sectors;
uint64_t pe_start = peg->pv->pe_start;
+ char uuid[64] __attribute__((aligned(8)));
if (!peg->lvseg) {
log_error("discard_pv_segment with unallocated segment: "
@@ -203,8 +204,20 @@ int discard_pv_segment(struct pv_segment *peg, uint32_t discard_area_reduction)
* the device and kernel (>= 2.6.35) supports discards.
*/
if (!find_config_tree_bool(peg->pv->fmt->cmd,
- "devices/issue_discards", DEFAULT_ISSUE_DISCARDS) ||
- !dev_discard_max_bytes(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev) ||
+ "devices/issue_discards", DEFAULT_ISSUE_DISCARDS))
+ return 1;
+
+ /* Missing PV? */
+ if (is_missing_pv(peg->pv) || !peg->pv->dev) {
+ if (!id_write_format(&peg->pv->id, uuid, sizeof(uuid)))
+ return_0;
+
+ log_verbose("Skipping discard on missing device with uuid %s.", uuid);
+
+ return 1;
+ }
+
+ if (!dev_discard_max_bytes(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev) ||
!dev_discard_granularity(peg->pv->fmt->cmd->sysfs_dir, peg->pv->dev))
return 1;
diff --git a/tools/lvremove.c b/tools/lvremove.c
index 0252149..2c5b317 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -26,6 +26,12 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_is_cow(lv) && lv_is_virtual_origin(origin = origin_from_cow(lv)))
lv = origin;
+ if (lv->status & PARTIAL_LV) {
+ log_error("Not removing LV %s/%s because part or all of it is missing.",
+ lv->vg->name, lv->name);
+ return ECMD_FAILED;
+ }
+
if (!lv_remove_with_dependencies(cmd, lv, arg_count(cmd, force_ARG), 0)) {
stack;
return ECMD_FAILED;
11 years, 7 months
master - RAID1: Clear the LV_NOTSYNCED flag when a RAID1 LV is converted to linear
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a6712ddefb672...
Commit: 2a6712ddefb6720d115d11c276223b57abf5dd94
Parent: 116bcb3ea4c3e4b030180757fb5be149af1fda07
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Sep 14 16:26:53 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Sep 14 16:26:53 2012 -0500
RAID1: Clear the LV_NOTSYNCED flag when a RAID1 LV is converted to linear
Failing to clear the LV_NOTSYNCED flag when converting a RAID1 LV to
linear can result in the flag being present after an upconvert - even
if the sync is performed when upconverting.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6ef9d5c..f2aa7ec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Clear LV_NOSYNCED flag when a RAID1 LV is converted to a linear LV.
Disallow RAID1 upconvert if the LV was created with --nosync.
Depend on systemd-udev-settle in units generated by activation generator.
Fix vgchange -aay to activate proper logical volumes.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 131f9d2..0266013 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1022,9 +1022,13 @@ static int _raid_remove_images(struct logical_volume *lv,
}
/* Convert to linear? */
- if ((new_count == 1) && !_raid_remove_top_layer(lv, &removal_list)) {
- log_error("Failed to remove RAID layer after linear conversion");
- return 0;
+ if (new_count == 1) {
+ if (!_raid_remove_top_layer(lv, &removal_list)) {
+ log_error("Failed to remove RAID layer"
+ " after linear conversion");
+ return 0;
+ }
+ lv->status &= ~LV_NOTSYNCED;
}
if (!vg_write(lv->vg)) {
11 years, 7 months
master - RAID1: Like mirrors, do not allow adding images to LV created w/ --nosync
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=116bcb3ea4c3e4...
Commit: 116bcb3ea4c3e4b030180757fb5be149af1fda07
Parent: 5cdd7848f46305d3d5744c194d4e2d38b78f0ec7
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Sep 14 16:12:52 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Sep 14 16:12:52 2012 -0500
RAID1: Like mirrors, do not allow adding images to LV created w/ --nosync
Mirrors do not allow upconverting if the LV has been created with --nosync.
We will enforce the same rule for RAID1. It isn't hugely critical, since
the portions that have been written will be copied over to the new device
identically from either of the existing images. However, the unwritten
sections may be different, causing the added image to be a hybrid of the
existing images.
Also, we are disallowing the addition of new images to a RAID1 LV that has
not completed the initial sync. This may be different from mirroring, but
that is due to the fact that the 'mirror' segment type "stacks" when adding
a new image and RAID1 does not. RAID1 will rebuild a newly added image
"inline" from the existant images, so they should be in-sync.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2b897e8..6ef9d5c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Disallow RAID1 upconvert if the LV was created with --nosync.
Depend on systemd-udev-settle in units generated by activation generator.
Fix vgchange -aay to activate proper logical volumes.
Properly handle 'resync' of RAID LVs.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 4eced6f..131f9d2 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -639,6 +639,18 @@ static int _raid_add_images(struct logical_volume *lv,
struct lv_list *lvl;
struct lv_segment_area *new_areas;
+ if (lv->status & LV_NOTSYNCED) {
+ log_error("Can't add image to out-of-sync RAID LV:"
+ " use 'lvchange --resync' first.");
+ return 0;
+ }
+
+ if (!_raid_in_sync(lv)) {
+ log_error("Can't add image to RAID LV that"
+ " is still initializing.");
+ return 0;
+ }
+
dm_list_init(&meta_lvs); /* For image addition */
dm_list_init(&data_lvs); /* For image addition */
11 years, 7 months