In a previous commit (e865e7809e), the
`local` keyword was removed in functions because of bashism.
Removing bashisms is correct, however this could cause variable overwrites,
since several functions use the same variable name.
So this commit make function variables unique in the (now) global name
space.
The problem from the original bug report (see #17963) could not be duplicated,
but it is still sane to make sure that variables stay unique.
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <robn@despairlabs.com>
Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Closes#18000