mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
snapshot: improve validation
Do not allow to take snapshot of mirror/raid leg or log or metadata LV. This was actually never supported, but user was able to create it, and this put device stack in hardly fixable state (needs manual work). This prevents such creation to pass. Also improve validation when recreating snapshot volume type from origin and COW volume.
This commit is contained in:
parent
38f7fbac64
commit
0e7edd1d24
@ -1,5 +1,6 @@
|
||||
Version 2.02.176 -
|
||||
===================================
|
||||
Disallow creation of snapshot of mirror/raid subLV (was never supported).
|
||||
Fix regression in more advanced vgname extraction in lvconvert (2.02.169).
|
||||
Allow lvcreate to be used for caching of _tdata LV.
|
||||
Avoid internal error when resizing cache type _tdata LV (not yet supported).
|
||||
|
@ -7622,11 +7622,20 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
}
|
||||
|
||||
if (lv_is_mirror_type(origin_lv)) {
|
||||
if (!lv_is_mirror(origin_lv)) {
|
||||
log_error("Snapshots of mirror subvolumes are not supported.");
|
||||
return NULL;
|
||||
}
|
||||
log_warn("WARNING: Snapshots of mirrors can deadlock under rare device failures.");
|
||||
log_warn("WARNING: Consider using the raid1 mirror type to avoid this.");
|
||||
log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
|
||||
}
|
||||
|
||||
if (lv_is_raid_type(origin_lv) && !lv_is_raid(origin_lv)) {
|
||||
log_error("Snapshots of raid subvolumes are not supported.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (vg_is_clustered(vg) && lv_is_active(origin_lv) &&
|
||||
!lv_is_active_exclusive_locally(origin_lv)) {
|
||||
log_error("%s must be active exclusively to"
|
||||
|
@ -1945,8 +1945,9 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
|
||||
* LV_foo specification because this LV is not processed by process_each_lv.
|
||||
*/
|
||||
if ((lv_is_cache_type(org) && !lv_is_cache(org)) ||
|
||||
lv_is_thin_type(org) ||
|
||||
lv_is_mirrored(org) ||
|
||||
(lv_is_thin_type(org) && !lv_is_thin_volume(org)) ||
|
||||
(lv_is_mirror_type(org) && !lv_is_mirror(org)) ||
|
||||
(lv_is_raid_type(org) && !lv_is_raid(org)) ||
|
||||
lv_is_cow(org)) {
|
||||
log_error("Unable to use LV %s as snapshot origin: invald LV type.",
|
||||
display_lvname(lv));
|
||||
|
Loading…
Reference in New Issue
Block a user