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

thin: validate mapped size of thin volume

Never show we map more then 100% for a volume.
But show warning when there could be some consistency problems.
This commit is contained in:
Zdenek Kabelac 2015-09-03 22:52:21 +02:00
parent a01eb9c451
commit df110bccbe

View File

@ -620,6 +620,15 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),
/* Pool allocates whole chunk so round-up to nearest one */
csize = first_seg(seg->pool_lv)->chunk_size;
csize = ((seg->lv->size + csize - 1) / csize) * csize;
if (s->mapped_sectors > csize) {
log_warn("WARNING: LV %s maps %s while the size is only %s.",
display_lvname(seg->lv),
display_size(cmd, s->mapped_sectors),
display_size(cmd, csize));
/* Don't show nonsense numbers like i.e. 1000% full */
s->mapped_sectors = csize;
}
*percent = dm_make_percent(s->mapped_sectors, csize);
*total_denominator += csize;
} else {