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

[lvm-devel] [PATCH lvconvert] Fix missing warning on '-R|--regionsize' for already mirrored LV



-R|--regionsize options for lvconvert only work when
converting from non-mirrored to mirrored.

        /*
         * Region size must not change on existing mirrors
         */
        if (arg_count(cmd, regionsize_ARG) && (lv->status & MIRRORED) &&
            (lp->region_size != seg->region_size)) {
                log_error("Mirror log region size cannot be changed on "
                          "an existing mirror.");
                return 0;
        }

However, the change in 2.02.30 about lvconvert to start polling if
no action specified, has missed the regionsize_ARG check
so it decided that 'no action was specified' before the warning.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Region size option of lvconvert (-R or --regionsize) should have
effect only on converting non-mirrored LV to mirrored LV.
So 'lvconvert -R <size> <lv>' used to warn:
  "Mirror log region size cannot be changed on an existing mirror."

However, since 2.02.30, it tries to start polling of the conversion
instead of warning.
It's because lvconvert checks whether any action is specified
and tries to start polling if none is specified.
The 'no action' check didn't include the '-R' option so it didn't
reach to the warning code above.

This patch recovers the original behavior.

Index: LVM2.work/tools/lvconvert.c
===================================================================
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -389,7 +389,7 @@ static int lvconvert_mirrors(struct cmd_
 
 	/* If called with no argument, try collapsing the resync layers */
 	if (!arg_count(cmd, mirrors_ARG) && !arg_count(cmd, mirrorlog_ARG) &&
-	    !arg_count(cmd, corelog_ARG)) {
+	    !arg_count(cmd, corelog_ARG) && !arg_count(cmd, regionsize_ARG)) {
 		lp->need_polling = 1;
 		return 1;
 	}

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