All of lore.kernel.org
 help / color / mirror / Atom feed
* [PAYCH] Don't allow resizing of internal logical volumes
@ 2010-03-18 23:53 Mikulas Patocka
  2010-03-19 20:08 ` Mike Snitzer
  0 siblings, 1 reply; 6+ messages in thread
From: Mikulas Patocka @ 2010-03-18 23:53 UTC (permalink / raw)
  To: lvm-devel

Hi

This patch prevents resizing of internal volumes.

BTW.: do you think that *-shared should be treated as a reseved logical 
volume name?
It is really the internal volume name, but the potential problem with it 
is that there may be some systems with existing names *-shared, and 
reserving the name breaks those systems.

Mikulas

---

Don't allow resizing of internal logical volumes.

This patch prevents 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*).

Note that test for VISIBLE_LV is not sufficient because snapshot0 volumes
have the VISIBLE_LV flag set. So we test the name instead of the flags.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 tools/lvresize.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: LVM2/tools/lvresize.c
===================================================================
--- LVM2.orig/tools/lvresize.c	2010-03-19 00:25:31.000000000 +0100
+++ LVM2/tools/lvresize.c	2010-03-19 00:44:52.000000000 +0100
@@ -323,6 +323,11 @@ static int _lvresize(struct cmd_context 
 
 	lv = lvl->lv;
 
+	if (is_reserved_lvname(lv->name)) {
+		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;



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-20  2:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18 23:53 [PAYCH] Don't allow resizing of internal logical volumes Mikulas Patocka
2010-03-19 20:08 ` Mike Snitzer
2010-03-19 21:06   ` Alasdair G Kergon
2010-03-19 22:27   ` Mikulas Patocka
2010-03-19 23:44     ` Mike Snitzer
2010-03-20  2:04       ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.