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

lvconvert: validate min chunk size for snapshot

Do not allow conversion of too small LV into a COW snapshot device.

Without this patch snapshot target is generating these kernel
messages before creation fails:

attempt to access beyond end of device
dm-9: rw=16, want=8, limit=2
attempt to access beyond end of device
...
device-mapper: table: 253:11: snapshot: Failed to read snapshot metadata
device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on  failed: Input/output error
This commit is contained in:
Zdenek Kabelac 2014-03-17 13:06:00 +01:00
parent 3a82490ee1
commit d425e788e9
2 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Validate minimal chunk size for snapshot COW volume in lvconvert.
Disallow lvconvert of origin to snapshot COW volume.
Make report settings profilable.
Add existing report settings to lvm.conf.

View File

@ -2055,6 +2055,9 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
return 0;
}
if (!cow_has_min_chunks(lv->vg, lv->le_count, lp->chunk_size))
return_0;
if (org->status & (LOCKED|PVMOVE|MIRRORED) || lv_is_cow(org)) {
log_error("Unable to convert an LV into a snapshot of a %s LV.",
org->status & LOCKED ? "locked" :