diff --git a/WHATS_NEW b/WHATS_NEW index 05218ee3b..9a3da7598 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.106 - ==================================== + Do not allow stripe size to be bigger then extent size for lvresize. Zero snapshot COW header when creating read-only snapshot. Comment out config lines in dumpconfig output without default values defined. Improve detection of clustered mirror support. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 9dd8f0e84..57ce2d9db 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -3406,6 +3406,7 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv, #define SIZE_BUF 128 +/* TODO: unify stripe size validation across source code */ static int _validate_stripesize(struct cmd_context *cmd, const struct volume_group *vg, struct lvresize_params *lp) @@ -3419,11 +3420,11 @@ static int _validate_stripesize(struct cmd_context *cmd, if (!(vg->fid->fmt->features & FMT_SEGMENTS)) log_warn("Varied stripesize not supported. Ignoring."); - else if (lp->ac_stripesize_value > (uint64_t) vg->extent_size * 2) { - log_error("Reducing stripe size %s to maximum, " - "physical extent size %s", - display_size(cmd,lp->ac_stripesize_value), - display_size(cmd, (uint64_t) vg->extent_size)); + else if (lp->ac_stripesize_value > vg->extent_size) { + log_print_unless_silent("Reducing stripe size %s to maximum, " + "physical extent size %s", + display_size(cmd, lp->ac_stripesize_value), + display_size(cmd, vg->extent_size)); lp->stripe_size = vg->extent_size; } else lp->stripe_size = lp->ac_stripesize_value; diff --git a/man/lvresize.8.in b/man/lvresize.8.in index 14fc7ba8c..75d20a0f0 100644 --- a/man/lvresize.8.in +++ b/man/lvresize.8.in @@ -95,7 +95,9 @@ Defaults to whatever the last segment of the Logical Volume uses. Not applicable to LVs using the original metadata LVM format, which must use a single value throughout. .br -StripeSize must be 2^n (n = 2 to 9). +StripeSize must be 2^n (n = 2 to 9) for metadata in LVM1 format. +For metadata in LVM2 format, the stripe size may be a larger +power of 2 but must not exceed the physical extent size. .TP .B \-\-noudevsync Disable udev synchronisation. The diff --git a/test/shell/lvresize-usage.sh b/test/shell/lvresize-usage.sh index 51ef22156..84431ed93 100644 --- a/test/shell/lvresize-usage.sh +++ b/test/shell/lvresize-usage.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2007-2008 Red Hat, Inc. All rights reserved. +# Copyright (C) 2007-2014 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions @@ -11,7 +11,7 @@ . lib/test -aux prepare_vg 2 +aux prepare_vg 2 80 lvcreate -L 10M -n lv -i2 $vg lvresize -l +4 $vg/lv @@ -19,3 +19,8 @@ lvremove -ff $vg lvcreate -L 64M -n $lv -i2 $vg not lvresize -v -l +4 xxx/$lv + +# Check stripe size is reduced to extent size when it's bigger +ESIZE=$(get vg_field $vg vg_extent_size --units b) +lvextend -L+64m -i 2 -I$(( ${ESIZE%%B} * 2 ))B $vg/$lv 2>&1 | tee err +grep "Reducing stripe size" err