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

[lvm-devel] [PATCH 1/3] Fix 'mlogtmp' naming check



In the previous patchset, _set_up_mirror_log() checks
lv->name to determine whether the mirror log should have
"_mlog" suffix or "_mlogtmp" suffix.
However, it should check the name of mirror image.

Attached patch corrects it.

Thanks,
--
Jun'ichi Nomura, NEC Corporation of America
To check if the added mirror log is temporary or not,
we have to check the name of the LV for the 1st area,
not the name of the LV.

Index: LVM2.work/lib/metadata/mirror.c
===================================================================
--- LVM2.work.orig/lib/metadata/mirror.c
+++ LVM2.work/lib/metadata/mirror.c
@@ -1068,6 +1068,8 @@ static struct logical_volume *_set_up_mi
 						 int in_sync)
 {
 	struct logical_volume *log_lv;
+	const char *suffix;
+	struct lv_segment *seg;
 
 	init_mirror_in_sync(in_sync);
 
@@ -1076,9 +1078,15 @@ static struct logical_volume *_set_up_mi
 		return NULL;
 	}
 
-	if (!(log_lv = _create_mirror_log(lv, ah, alloc, lv->name,
-					  strstr(lv->name, MIRROR_SYNC_LAYER)
-						? "_mlogtmp_%d" : "_mlog"))) {
+	/* Check if the log is for temporary sync layer. */
+	seg = first_seg(lv);
+	if (seg_type(seg, 0) == AREA_LV &&
+	    strstr(seg_lv(seg, 0)->name, MIRROR_SYNC_LAYER))
+		suffix = "_mlogtmp_%d";
+	else
+		suffix = "_mlog";
+
+	if (!(log_lv = _create_mirror_log(lv, ah, alloc, lv->name, suffix))) {
 		log_error("Failed to create mirror log.");
 		return NULL;
 	}

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