1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Use temp table to set device size when converting mirrors.

(Avoids having same mirror table loaded twice concurrently by first
using a 'zero' table to set the size of the device so when mirror
table is preloaded it doesn't have to be activated immediately.)
This commit is contained in:
Alasdair Kergon 2008-10-17 10:57:15 +00:00
parent 3935c3ecd6
commit 5da4feac0e
2 changed files with 32 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.41 -
=====================================
Use temp table to set device size when converting mirrors.
In resume_mirror_images replace activate_lv with resume_lv as workaround.
Avoid overwriting in-use on-disk text metadata by forgetting MDA_HEADER_SIZE.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.

View File

@ -2360,11 +2360,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
struct segment_type *segtype;
struct lv_segment *mapseg;
if (!(segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
/* create an empty layer LV */
len = strlen(lv_where->name) + 32;
if (!(name = alloca(len))) {
log_error("layer name allocation failed. "
@ -2384,12 +2380,43 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
return NULL;
}
if (strstr(name, "_mimagetmp")) {
log_very_verbose("Creating transient 'zero' LV"
" for Mirror -> mirror up-convert.");
segtype = get_segtype_from_string(cmd, "zero");
if (!lv_add_virtual_segment(layer_lv, 0, lv_where->le_count, segtype)) {
log_error("Creation of intermediate layer LV failed.");
return NULL;
}
if (!vg_write(lv_where->vg)) {
log_error("Failed to write intermediate VG metadata");
return NULL;
}
if (!vg_commit(lv_where->vg)) {
log_error("Failed to commit intermediate VG metadata");
vg_revert(lv_where->vg);
return NULL;
}
if (!activate_lv(cmd, layer_lv)) {
log_error("Failed to resume intermediate 'zero' LV, %s", name);
return NULL;
}
}
log_very_verbose("Inserting layer %s for %s",
layer_lv->name, lv_where->name);
if (!_move_lv_segments(layer_lv, lv_where, 0, 0))
return_NULL;
if (!(segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
/* allocate a new linear segment */
if (!(mapseg = alloc_lv_segment(cmd->mem, segtype,
lv_where, 0, layer_lv->le_count,