salvaged: Fix "-parallel all<number>" parsing 01/14201/5
authorKailas Zadbuke <kailashsz@in.ibm.com>
Fri, 8 May 2020 03:55:39 +0000 (23:55 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 12 May 2020 15:43:10 +0000 (11:43 -0400)
In salavageserver -parallel option takes "all<number>" argument.
However the code does not parse the numeric part correctly. Due
to this, only single instance of salvageserver process was running
even if we provide the larger number with "all" argument.

With this fix, numeric part of "all" argument will be parsed
correctly and will start required number of salvageserver instances.

Change-Id: Ib6318b1d57d04fecb84915e2dabe40930ea76499
Reviewed-on: https://gerrit.openafs.org/14201
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/vol/salvaged.c

index bb6de65..54c4a63 100644 (file)
@@ -211,11 +211,13 @@ handleit(struct cmd_syndesc *opts, void *arock)
     cmd_OptionAsFlag(opts, OPT_salvagedirs, &RebuildDirs);
     cmd_OptionAsFlag(opts, OPT_blockreads, &forceR);
     if (cmd_OptionAsString(opts, OPT_parallel, &optstring) == 0) {
+       char *input = optstring;
        if (strncmp(optstring, "all", 3) == 0) {
            PartsPerDisk = 1;
+           input += 3;
        }
-       if (strlen(optstring) != 0) {
-           Parallel = atoi(optstring);
+       if (strlen(input) != 0) {
+           Parallel = atoi(input);
            if (Parallel < 1)
                Parallel = 1;
            if (Parallel > MAXPARALLEL) {