[PATCH v3 2/7] nvme: consolidate some nvme-cli utility functions
Logan Gunthorpe
logang at deltatee.com
Wed Aug 12 11:49:04 EDT 2020
On 2020-08-11 3:00 p.m., Sagi Grimberg wrote:
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 320aa4b2b475..6d57cf591300 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -64,7 +64,7 @@ _cleanup_nvmet() {
> transport="$(cat "/sys/class/nvme/${dev}/transport")"
> if [[ "$transport" == "loop" ]]; then
> echo "WARNING: Test did not clean up loop device: ${dev}"
> - nvme disconnect -d "${dev}"
> + _nvme_disconnect_ctrl "${dev}"
> fi
> done
>
> @@ -97,6 +97,33 @@ _setup_nvmet() {
> modprobe nvme-loop
> }
>
> +_nvme_disconnect_ctrl() {
> + local ctrl="$1"
> +
> + nvme disconnect -d ${ctrl}
We're missing some quotes here and in many other places in this
patchset. Have you run shellcheck on this? I'd expect it to complain
about these.
> +}
> +
> +_nvme_disconnect_subsys() {
> + local subsysnqn="$1"
> +
> + nvme disconnect -n ${subsysnqn}
> +}
> +
> +_nvme_connect_subsys() {
> + local trtype="$1"
> + local subsysnqn="$2"
> +
> + cmd="nvme connect -t ${trtype} -n ${subsysnqn}"
> + eval $cmd
Why eval? It makes the quoting here questionable...
Logan
More information about the Linux-nvme
mailing list