Whamcloud - gitweb
LU-13589 utils: fix lfs setstripe unit parsing 80/38680/2
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 20 May 2020 18:19:32 +0000 (12:19 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 27 May 2020 17:30:01 +0000 (17:30 +0000)
The "size_units" variable was not being reset while parsing different
"lfs setstripe" arguments, so e.g. "lfs setstripe -E 1M -S 65536 ..."
ended up using the 'M' unit for the stripe size, which resulted in a
stripe_size of 65536MiB = 64GiB, which resulted in an error.

This only appeared with PFL or other layout patterns which had more
than one unit being parsed, and was already fixed in master via SEL.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ib3f9be86f5104aaea4f77d87853255a518cbc3a0
Reviewed-on: https://review.whamcloud.com/38680
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/lfs.c

index 9616c2f..f4ef2f1 100644 (file)
@@ -2801,6 +2801,7 @@ static int lfs_setstripe_internal(int argc, char **argv,
        while ((c = getopt_long(argc, argv,
                                "bc:dDE:f:H:i:I:m:N::no:p:L:s:S:vy:", long_opts,
                                NULL)) >= 0) {
+               size_units = 1;
                switch (c) {
                case 0:
                        /* Long options. */