Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/lv_manip.c

PATCH [email protected] 1 participant 1 message Mar 25, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-03-25 18:16:55

Modified files:
. : WHATS_NEW
lib/metadata : lv_manip.c

Log message:
Add some assertions to allocation code.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1479&r2=1.1480
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.214&r2=1.215

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.63 -  
 ================================
+  Add some assertions to allocation code.
   Introduce pv_area_used into allocation algorithm and add debug messages.
   Add activation/monitoring to lvm.conf.
   Add --monitor and --ignoremonitoring to lvcreate.
lib/metadata/lv_manip.c +10 -0
@@ -600,6 +600,11 @@
 	if (segtype_is_virtual(segtype))
 		return ah;
 
+	if (!(area_count + log_area_count)) {
+		log_error(INTERNAL_ERROR "_alloc_init called for non-virtual segment with no disk space.");
+		return NULL;
+	}
+
 	if (!(ah->mem = dm_pool_create("allocation", 1024))) {
 		log_error("allocation pool creation failed");
 		return NULL;
@@ -744,6 +749,11 @@
 	uint32_t total_area_count = ah->area_count + (log_needs_allocating ? ah->log_area_count : 0);
 	struct alloced_area *aa;
 
+	if (!total_area_count) {
+		log_error(INTERNAL_ERROR "_alloc_parallel_area called without any allocation to do.");
+		return 1;
+	}
+
 	remaining = needed - *allocated;
 	area_len = remaining / ah->area_multiple;