fa952fcd5a
We see a delay, especially in VMs, between when the block layer reports the nbd device as ready (with non-zero size) and when I/O will complete successfully without an -ENOSPC error. So to compensate, dd the first block of the nbd device to a temporary file, then check the size of that file to confirm the nbd device is ready for I/O. Note that dd with a zero-sized input file will always complete successfully just with 0 blocks transferred. So we cannot rely on the return value of dd - we check the size of the written file instead. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I84ea3b663668a27021619cbee502769af4922937 Reviewed-on: https://review.gerrithub.io/385936 Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>