Skip to contentSkip to conversation

Ignore _mlog name restriction for lvconvert repair

PATCH New Malahal Naineni 3 participants 7 messages Feb 10, 2010 – Feb 12, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

lvconvert --repair is done on _mlog mirrored log logical volumes from dmeventd if something fails.

tools/lvconvert.c +6 -2
diff -r 86200db56a7c -r 471e224a5713 tools/lvconvert.c
@@ -105,8 +105,12 @@ static int _lvconvert_name_params(struct
 	if ((ptr = strrchr(lp->lv_name_full, '/')))
 		lp->lv_name = ptr + 1;
 
-	if (!apply_lvname_restrictions(lp->lv_name))
-		return_0;
+	/* _mlog is an internal name, but it could be mirrored, so
+	 * allow repairing it.
+	 */
+	if (!arg_count(cmd, repair_ARG) || !strstr(lp->lv_name, "_mlog"))
+		if (!apply_lvname_restrictions(lp->lv_name))
+			return_0;
 
 	if (*pargc && lp->snapshot) {
 		log_error("Too many arguments provided for snapshots");
#1 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

Quoted 11 lines · Malahal Naineni

lvconvert --repair is done on _mlog mirrored log logical volumes from dmeventd if something fails.

diff -r 86200db56a7c -r 471e224a5713 tools/lvconvert.c

tools/lvconvert.c +0 -1
@@ -105,8 +105,12 @@ static int _lvconvert_name_params(struct
 	if ((ptr = strrchr(lp->lv_name_full, '/')))
 		lp->lv_name = ptr + 1;
 
-	if (!apply_lvname_restrictions(lp->lv_name))

tools/lvconvert.c static int _lvconvert_name_params(struct · line 116

Quoted 10 lines
tools/lvconvert.c +6 -1
-		return_0;
+	/* _mlog is an internal name, but it could be mirrored, so
+	 * allow repairing it.
+	 */
+	if (!arg_count(cmd, repair_ARG) || !strstr(lp->lv_name, "_mlog"))
+		if (!apply_lvname_restrictions(lp->lv_name))
+			return_0;
 
 	if (*pargc && lp->snapshot) {
 		log_error("Too many arguments provided for snapshots");

lvname is better to be checked if a logical volume is not mirrored log but simple logical volume. How about using (lv->status & MIRRORED) for the check?

Thanks,
Taka

#2 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

Quoted 20 lines · Takahiro Yasui [tyasui at redhat.com]
Quoted 19 lines · Malahal Naineni

lvconvert --repair is done on _mlog mirrored log logical volumes from dmeventd if something fails.

diff -r 86200db56a7c -r 471e224a5713 tools/lvconvert.c

tools/lvconvert.c +6 -2
@@ -105,8 +105,12 @@ static int _lvconvert_name_params(struct
 	if ((ptr = strrchr(lp->lv_name_full, '/')))
 		lp->lv_name = ptr + 1;
 
-	if (!apply_lvname_restrictions(lp->lv_name))
-		return_0;
+	/* _mlog is an internal name, but it could be mirrored, so
+	 * allow repairing it.
+	 */
+	if (!arg_count(cmd, repair_ARG) || !strstr(lp->lv_name, "_mlog"))
+		if (!apply_lvname_restrictions(lp->lv_name))
+			return_0;
 
Quoted 6 lines

tools/lvconvert.c static int _lvconvert_name_params(struct · line 116

Quoted 2 lines
tools/lvconvert.c +0 -0
 	if (*pargc && lp->snapshot) {
 		log_error("Too many arguments provided for snapshots");

lvname is better to be checked if a logical volume is not mirrored log but simple logical volume. How about using (lv->status & MIRRORED) for the check?

I thought about it but such details are not available at that point. All the information available at that point is derived from the command line arguments!

Thanks, Malahal.

#3 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

Quoted 27 lines · malahal at us.ibm.com
Quoted 20 lines · Takahiro Yasui [tyasui at redhat.com]
Quoted 19 lines · Malahal Naineni

lvconvert --repair is done on _mlog mirrored log logical volumes from dmeventd if something fails.

diff -r 86200db56a7c -r 471e224a5713 tools/lvconvert.c

tools/lvconvert.c +6 -2
@@ -105,8 +105,12 @@ static int _lvconvert_name_params(struct
 	if ((ptr = strrchr(lp->lv_name_full, '/')))
 		lp->lv_name = ptr + 1;
 
-	if (!apply_lvname_restrictions(lp->lv_name))
-		return_0;
+	/* _mlog is an internal name, but it could be mirrored, so
+	 * allow repairing it.
+	 */
+	if (!arg_count(cmd, repair_ARG) || !strstr(lp->lv_name, "_mlog"))
+		if (!apply_lvname_restrictions(lp->lv_name))
+			return_0;
 
Quoted 5 lines

tools/lvconvert.c static int _lvconvert_name_params(struct · line 116

Quoted 2 lines
tools/lvconvert.c +0 -0
 	if (*pargc && lp->snapshot) {
 		log_error("Too many arguments provided for snapshots");

lvname is better to be checked if a logical volume is not mirrored log but simple logical volume. How about using (lv->status & MIRRORED) for the check?

Quoted 3 lines

I thought about it but such details are not available at that point. All the information available at that point is derived from the command line arguments!

Thank you for the explanation. I see we need to move this name check at the place where lv->status check can be used.

Thanks,
Taka

#4 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

Quoted 31 lines · Takahiro Yasui
Quoted 30 lines · malahal at us.ibm.com
Quoted 28 lines · Takahiro Yasui [tyasui at redhat.com]
Quoted 12 lines · Malahal Naineni

lvconvert --repair is done on _mlog mirrored log logical volumes from
dmeventd if something fails.

diff -r 86200db56a7c -r 471e224a5713 tools/lvconvert.c

tools/lvconvert.c +0 -1
@@ -105,8 +105,12 @@ static int _lvconvert_name_params(struct
 	if ((ptr = strrchr(lp->lv_name_full, '/')))
 		lp->lv_name = ptr + 1;
 
-	if (!apply_lvname_restrictions(lp->lv_name))

tools/lvconvert.c static int _lvconvert_name_params(struct · line 116

Quoted 10 lines
tools/lvconvert.c +6 -1
-		return_0;
+	/* _mlog is an internal name, but it could be mirrored, so
+	 * allow repairing it.
+	 */
+	if (!arg_count(cmd, repair_ARG) || !strstr(lp->lv_name, "_mlog"))
+		if (!apply_lvname_restrictions(lp->lv_name))
+			return_0;
 
 	if (*pargc && lp->snapshot) {
 		log_error("Too many arguments provided for snapshots");

lvname is better to be checked if a logical volume is not mirrored log
but simple logical volume. How about using (lv->status & MIRRORED) for
the check?

Quoted 8 lines
Quoted 5 lines

I thought about it but such details are not available at that point. All
the information available at that point is derived from the command line
arguments!

Thank you for the explanation. I see we need to move this name check at the place where lv->status check can be used.

It might make sense to do it in this very spot... If the repair_ARG is present, why should we be checking lvname restrictions anyway? No new LVs are being created.

Something more like:
if (!arg_count(cmd, repair_ARG) && !apply_lvname_restrictions(lp-

Quoted 1 line

lv_name))

Anyone see anything wrong with that?

Taka, I've not been able to reproduce your seg faults with '--alloc anywhere' using two devices. Is there a special restriction you are using?

brassow

#5 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

Quoted 50 lines · Jonathan Brassow
Quoted 32 lines · Takahiro Yasui
Quoted 31 lines · malahal at us.ibm.com
Quoted 29 lines · Takahiro Yasui [tyasui at redhat.com]
Quoted 22 lines · Malahal Naineni

lvconvert --repair is done on _mlog mirrored log logical volumes from
dmeventd if something fails.

diff -r 86200db56a7c -r 471e224a5713 tools/lvconvert.c

tools/lvconvert.c +6 -2
@@ -105,8 +105,12 @@ static int _lvconvert_name_params(struct
 	if ((ptr = strrchr(lp->lv_name_full, '/')))
 		lp->lv_name = ptr + 1;
 
-	if (!apply_lvname_restrictions(lp->lv_name))
-		return_0;
+	/* _mlog is an internal name, but it could be mirrored, so
+	 * allow repairing it.
+	 */
+	if (!arg_count(cmd, repair_ARG) || !strstr(lp->lv_name,  
 "_mlog"))
+		if (!apply_lvname_restrictions(lp->lv_name))
+			return_0;
 
 	if (*pargc && lp->snapshot) {
Quoted 1 line
		log_error("Too many arguments provided for snapshots");

lvname is better to be checked if a logical volume is not mirrored log
but simple logical volume. How about using (lv->status & MIRRORED) for
the check?

Quoted 8 lines
Quoted 5 lines

I thought about it but such details are not available at that point. All
the information available at that point is derived from the command line
arguments!

Thank you for the explanation. I see we need to move this name check at the place where lv->status check can be used.

It might make sense to do it in this very spot... If the repair_ARG is present, why should we be checking lvname restrictions anyway? No new LVs are being created.

Something more like:
if (!arg_count(cmd, repair_ARG) && !apply_lvname_restrictions(lp-

Quoted 7 lines
Quoted 1 line

lv_name))

Anyone see anything wrong with that?

Taka, I've not been able to reproduce your seg faults with '--alloc anywhere' using two devices. Is there a special restriction you are using?

agk wants to see if we can /not/ use <lv>_mlog as the argument passed in. So, dmeventd would probably strip the '_mlog' portion.(?) There are definitely some items to clean up in this case. I'm going to give it a shot. If it turns out to be really bad, we might go with the above suggestion.

brassow

#6 lore raw

PATCH 1/1 Ignore _mlog name restriction for lvconvert repair

In reply to Jonathan Brassow

Hello Jon,

Quoted 3 lines

Taka, I've not been able to reproduce your seg faults with '--alloc anywhere' using two devices. Is there a special restriction you are using?

Here is the reproduction steps.

[case 1]
1. create VG with two devices.

  # vgcreate vg00 /dev/sd[ab]

2. create LV with mirrored log

  # lvcreate -m1 -L12m -nlv00 --mirrorlog mirrored --alloc anywhere vg00

3. disable device /dev/sdb

  # echo offline > /sys/block/sdb/device/state

4. Write data

  # dd if=/dev/zero of=/dev/vg00/lv00 bs=4096 count=1
  1+0 records in
  1+0 records out
  4096 bytes (4.1 kB) copied, 3.02835 seconds, 1.4 kB/s

5. convert LV to mirrored log

  # lvconvert -m1 --mirrorlog mirrored --alloc anywhere vg00/lv00
    /dev/sdd: open failed: No such device or address
  Segmentation fault

[case 2]

  # vgs
    No volume groups found
  # vgcreate vg00 /dev/sdc
    Volume group "vg00" successfully created
  # lvcreate -m1 -L12m -nlv00 --mirrorlog mirrored --alloc anywhere vg00
  Segmentation fault

I hope you could reproduce this issues.

Thanks,
Taka