1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-30 01:47:56 +03:00

Fix to preserve exclusive activation of mirror while up-converting.

When an LVM mirror is up-converted (an additional image added), it creates
a temporary mirror stack.  The lower-level mirror in the stack that is
created was not being activated exclusively - violating the exclusive nature
of the original mirror.  We now check for exclusive activation of a mirror
before converting it, and if found, we ensure that the temporary mirror
is also exclusively activated.
This commit is contained in:
Jonathan Earl Brassow 2011-06-23 14:00:58 +00:00
parent 6adbb95b82
commit 9e0edb7ee5
3 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.86 -
=================================
Fix to preserve exclusive activation of mirror while up-converting.
Reject allocation if number of extents is not divisible by area count.
Fix issue preventing cluster mirror creation.
Disable udev fallback by default and add activation/udev_fallback to lvm.conf.

View File

@ -3103,11 +3103,13 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
uint64_t status,
const char *layer_suffix)
{
int r;
struct logical_volume *layer_lv;
char *name;
size_t len;
struct segment_type *segtype;
struct lv_segment *mapseg;
unsigned exclusive = 0;
/* create an empty layer LV */
len = strlen(lv_where->name) + 32;
@ -3129,6 +3131,9 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
return NULL;
}
if (lv_is_active_exclusive_locally(lv_where))
exclusive = 1;
if (lv_is_active(lv_where) && strstr(name, "_mimagetmp")) {
log_very_verbose("Creating transient LV %s for mirror conversion in VG %s.", name, lv_where->vg->name);
@ -3150,8 +3155,15 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
return NULL;
}
if (!activate_lv(cmd, layer_lv)) {
log_error("Failed to resume transient error LV %s for mirror conversion in VG %s.", name, lv_where->vg->name);
if (exclusive)
r = activate_lv_excl(cmd, layer_lv);
else
r = activate_lv(cmd, layer_lv);
if (!r) {
log_error("Failed to resume transient LV"
" %s for mirror conversion in VG %s.",
name, lv_where->vg->name);
return NULL;
}
}

View File

@ -419,8 +419,13 @@ static int _delete_lv(struct logical_volume *mirror_lv, struct logical_volume *l
}
}
if (!activate_lv(cmd, lv))
return_0;
if (lv_is_active_exclusive_locally(lv)) {
if (!activate_lv_excl(cmd, lv))
return_0;
} else {
if (!activate_lv(cmd, lv))
return_0;
}
if (!deactivate_lv(cmd, lv))
return_0;