6fdc71ec18
Current SPDK thread library has a issue which occurs if there is a race between exiting thread and unregistering io_device. For example, there are two threads. Thread 1 registers a device and thread 2 gets a channel of the device. Then if thread 1 starts exiting and unregisters the device, and then thread 2 puts the channel, thread 2 sends a message to thread 1 to complete releasing the device, thread 1 already moved exited. Hence thread 2 failed to send the message. This patch fixes the race issue. The code is verified by adding a unit test case. In detail, add a count, unregistering_dev, to struct spdk_thread, increment it if a callback is specified to spdk_io_device_unregister(), and then decrement it in _finish_unregister(), and thread_exit() checks if it is zero. The contents of struct spdk_thread is changed but it is not public data structure, and hence suppress it for ABI testing. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Idf5faa55335c3ea89f47ccce32687a6be2e26c68 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5796 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: <dongx.yi@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> |
||
---|---|---|
.. | ||
Makefile | ||
spdk_thread.map | ||
thread.c |