On 6/19/24 16:29, Daniel Wagner wrote: > On Wed, Jun 19, 2024 at 04:16:40PM GMT, Nilay Shroff wrote: >> + # start iteration from ns-id 2 because ns-id 1 is created >> + # by default when nvme target is setup. Also ns-id 1 is >> + # deleted when nvme target is cleaned up. >> + for ((i = 2; i <= iterations; i++)); do { >> + truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path).$i" >> + _create_nvmet_ns "${def_subsysnqn}" "${i}" "$(_nvme_def_file_path).$i" >> + >> + # allow async request to be processed >> + sleep 1 > > This looks a bit fragile to ensure all request have been processed. Would > it possible to wait on a state? E.g. something like > > nvmf_wait_for_state() > > ? OK that's a good idea! I think it's possible to wait using _find_nvme_ns() instead of using sleep here. We can write a wrapper around _find_nvme_ns() and wait until namespace is ready/created. I will send next patch with the above change. > >> + >> + _remove_nvmet_ns "${def_subsysnqn}" "${i}" >> + rm "$(_nvme_def_file_path).$i" >> + } > Thanks, --Nilay