From: Mike Snitzer Date: Sat, 20 Mar 2010 03:44:04 +0000 (+0000) Subject: Don't allow resizing of internal logical volumes. X-Git-Tag: old-v2_02_63~163 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=7aa470c8d0090719ac8cbfad996ce134b9dc470b;p=lvm2.git Don't allow resizing of internal logical volumes. Prevent lvresize from being able to resize internal LVs: mirror legs (*_mimage_*), mirror log (*_mlog), snapshot placeholder LVs (snapshot*) and others. Resizing these would leads to unexpected metadata and sometimes crashes (in case of growing snapshot*). --- diff --git a/WHATS_NEW b/WHATS_NEW index 47536018a..9a073b251 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.63 - ================================ + Don't allow resizing of internal logical volumes. Fix libdevmapper-event pkgconfig version string to match libdevmapper. Avoid scanning all pvs in the system if operating on a device with mdas. Add configure --with-clvmd=singlenode to use clvmd w/o cluster infrastructure. diff --git a/tools/lvresize.c b/tools/lvresize.c index 849fd2efe..1a96f82a4 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -323,6 +323,11 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg, lv = lvl->lv; + if (!lv_is_visible(lv)) { + log_error("Can't resize internal logical volume %s", lv->name); + return ECMD_FAILED; + } + if (lv->status & LOCKED) { log_error("Can't resize locked LV %s", lv->name); return ECMD_FAILED;