Spdk/test/unit/lib
Jim Harris d33497d3f4 thread: defer unregistration when for_each ops exist
There may be for_each operations outstanding on an
io_device when it is unregistered.  Currently we just
return when this happens, not unregistering the
device but also not notifying the caller that this
happened (since it returns void, and the callback
function doesn't have a status parameter either).

We could just push this responsibility to the caller,
to never unregister an io_device if it knows it has
outstanding for_each calls waiting to complete.  But
I think we can simplify this a lot by just handling
this inside of the thread library.  Mark that the
device is pending registration, and unregister it
(on the original requesting thread!) when the
for_each count gets back to zero.  Also don't
allow any new for_each operations either.

Note this requires a bit of refactoring on the
thread unit tests, since it is now possible to
unregister a device with outstanding for_each
operations.

Fixes issue #2631.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I978f2d99a25e65d2b7d71ce9b1926a79a6c94263
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13890
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-08-09 08:27:15 +00:00
..
accel lib/accel: add RPC to get list of OP codes per module 2022-08-03 07:53:21 +00:00
bdev module/raid: raid5: rename to raid5f 2022-07-27 08:51:21 +00:00
blob lib/blob: Fix deleting a snapshot after decoupling it from its parent 2022-08-05 08:30:30 +00:00
blobfs check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
dma Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
env_dpdk check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
event Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
ftl ftl: superblock 2022-08-02 19:00:42 +00:00
idxd idxd: rename internal header file to idxd_internal.h 2022-07-21 07:03:26 +00:00
init Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
ioat check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
iscsi check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
json json: fix wrong param in json_parse_ut.c calling function 'spdk_json_parse' 2022-08-05 08:28:44 +00:00
jsonrpc check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
log check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
lvol blobstore: implement spdk_bs_grow and bdev_lvol_grow_lvstore RPC 2022-06-28 17:55:43 +00:00
notify Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
nvme nvme: Add transport controller ready step 2022-08-04 07:29:03 +00:00
nvmf nvmf/rdma: remove lock on few transport ops 2022-07-29 16:34:41 +00:00
reduce check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
rpc check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
scsi check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
sock sock: add assertions checking sock_impl_opts size 2022-07-29 16:49:54 +00:00
thread thread: defer unregistration when for_each ops exist 2022-08-09 08:27:15 +00:00
util util: Extract a common lib between iovs and buf. 2022-06-20 10:01:15 +00:00
vhost check_format: For C files only, fix return type breaks 2022-06-27 09:33:48 +00:00
json_mock.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
Makefile ftl: management framework 2022-07-11 07:23:58 +00:00