[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [LVM2 PATCH] (2/5) Fix mirror-log-only allocation failure



If the log-only allocation failed on the first policy,
it doesn't try the next available policy but just quit the loop and fail
because in that case both "allocated" and "new_extents" are same.
It's not correct. It should try the next policy if it's available.

The function allocating_log() is introduced to separate the logic
to determine if the log allocation is still needed.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America

If the log-only allocation failed on the first policy,
it doesn't try the next available policy but just quit the loop and fail
because in that case both "allocated" and "new_extents" are same.
It's not correct. It should try the next policy if it's available.

The function allocating_log() is introduced to separate the logic
to determine if the log allocation is still needed.


Index: LVM2.02.17/lib/metadata/lv_manip.c
===================================================================
--- LVM2.02.17.orig/lib/metadata/lv_manip.c	2007-01-06 01:27:06.000000000 -0500
+++ LVM2.02.17/lib/metadata/lv_manip.c	2007-01-06 01:27:08.000000000 -0500
@@ -881,6 +881,11 @@ static int _check_contiguous(struct cmd_
 	return 1;
 }
 
+static int allocating_log(struct alloc_handle *ah)
+{
+	return ah->log_count && !ah->log_area.len;
+}
+
 /*
  * Choose sets of parallel areas to use, respecting any constraints.
  */
@@ -1130,7 +1135,8 @@ static int _allocate(struct alloc_handle
 					  areas_size, can_split,
 					  prev_lvseg, &allocated, new_extents))
 			goto_out;
-		if ((allocated == new_extents) || (ah->alloc == alloc) ||
+		if ((allocated == new_extents && !allocating_log(ah)) ||
+		    (ah->alloc == alloc) ||
 		    (!can_split && (allocated != old_allocated)))
 			break;
 	}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]