There is a race condition when a bdev is unregistered while reset is submitted from the upper layer very frequently. spdk_io_device_unregister() may fail because it is called while spdk_for_each_channel() is processed. spdk_io_device_unregister io_device bdev_Nvme0n1 (0x7f4be8053aa1) has 1 for_each calls outstanding To avoid this failure, defer calling spdk_io_device_unregister() until reset completes if reset is in progress when unregistration is ready to do, and then reset completion calls spdk_io_device_unregister() later. A bdev cannot be opened if it is already deleting. So we do not need to hold mutex. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: Ida1681ba9f3096670ff62274b35bb3e4fd69398a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12222 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> |
||
---|---|---|
.. | ||
bdev_ut.c | ||
Makefile |