mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Prevent lvconvert -s from using same LV as origin and snapshot.
This commit is contained in:
parent
00a7c302ea
commit
19c865437a
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.29 -
|
Version 2.02.29 -
|
||||||
==================================
|
==================================
|
||||||
|
Prevent lvconvert -s from using same LV as origin and snapshot.
|
||||||
Fix human-readable output of odd numbers of sectors.
|
Fix human-readable output of odd numbers of sectors.
|
||||||
Add pv_mda_free and vg_mda_free fields to reports for raw text format.
|
Add pv_mda_free and vg_mda_free fields to reports for raw text format.
|
||||||
Add LVM2 version to 'Generated by' comment in metadata.
|
Add LVM2 version to 'Generated by' comment in metadata.
|
||||||
|
@ -119,6 +119,15 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (seg_is_snapshot(seg)) {
|
||||||
|
if (seg->cow && seg->cow == seg->origin) {
|
||||||
|
log_error("LV %s: segment %u has same LV %s for "
|
||||||
|
"both origin and snapshot",
|
||||||
|
lv->name, seg_count, seg->cow->name);
|
||||||
|
r = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (s = 0; s < seg->area_count; s++) {
|
for (s = 0; s < seg->area_count; s++) {
|
||||||
if (seg_type(seg, s) == AREA_UNASSIGNED) {
|
if (seg_type(seg, s) == AREA_UNASSIGNED) {
|
||||||
log_error("LV %s: segment %u has unassigned "
|
log_error("LV %s: segment %u has unassigned "
|
||||||
|
@ -63,6 +63,11 @@ int vg_add_snapshot(const char *name, struct logical_volume *origin,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cow == origin) {
|
||||||
|
log_error("Snapshot and origin LVs must differ.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(snap = lv_create_empty(name ? name : "snapshot%d",
|
if (!(snap = lv_create_empty(name ? name : "snapshot%d",
|
||||||
lvid, LVM_READ | LVM_WRITE | VISIBLE_LV,
|
lvid, LVM_READ | LVM_WRITE | VISIBLE_LV,
|
||||||
ALLOC_INHERIT, 1, origin->vg))) {
|
ALLOC_INHERIT, 1, origin->vg))) {
|
||||||
|
@ -495,6 +495,12 @@ static int lvconvert_snapshot(struct cmd_context *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (org == lv) {
|
||||||
|
log_error("Unable to use \"%s\" as both snapshot and origin.",
|
||||||
|
lv->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (org->status & (LOCKED|PVMOVE) || lv_is_cow(org)) {
|
if (org->status & (LOCKED|PVMOVE) || lv_is_cow(org)) {
|
||||||
log_error("Unable to create a snapshot of a %s LV.",
|
log_error("Unable to create a snapshot of a %s LV.",
|
||||||
org->status & LOCKED ? "locked" :
|
org->status & LOCKED ? "locked" :
|
||||||
|
Loading…
Reference in New Issue
Block a user