Spdk/test
Mike Gerdts cc27c1ab11 blobstore: missing lock leads to md page race
Many parts of the blobstore.c seem to have gone with the assumption that
blob creation, deletion, etc. all happen on the md thread. This
assumption would allow modification of the bs->used_md_pages and
bs->used_clusters bit arrays without holding a lock. Placing
"assert(spdk_get_thread() == bs->md_thread)" in bs_claim_md_page() and
bs_claim_cluster() show that each of these functions are called on other
threads due writes to thin provisioned volumes.

This problem was first seen in the wild with this failed assertion:

  bs_claim_md_page: Assertion
     `spdk_bit_array_get(bs->used_md_pages, page) == false' failed.

This commit adds "assert(spdk_spin_held(&bs->used_lock))" in those
places where bs->used_md_pages and bs->used_lock are modified, then
holds bs->used_lock in the places needed to satisfy these assertions.

Signed-off-by: Mike Gerdts <mgerdts@nvidia.com>
Change-Id: I0523dd343ec490d994352932b2a73379a80e36f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15953
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
2022-12-20 09:19:09 +00:00
..
accel add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
app llvm_vfio_fuzz: call spdk_thread_exit() 2022-11-23 08:22:04 +00:00
bdev misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
blobfs add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
blobstore add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
common scripts/setup: Stop checking for broken uio_pci_generic driver 2022-12-14 08:03:17 +00:00
compress add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
cpp_headers update Intel copyright notices 2022-11-10 08:28:53 +00:00
dd add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
dma test/dma: call spdk_thread_exit() 2022-11-23 08:22:04 +00:00
dpdk_memory_utility add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
env add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
event Add SPDX header to various files 2022-11-29 08:27:51 +00:00
external_code add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
ftl add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
fuzz fuzz/vhost: assign unique core masks to vhost and fuzz app 2022-12-07 09:21:13 +00:00
interrupt Add SPDX header to various files 2022-11-29 08:27:51 +00:00
ioat add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
iscsi_tgt iscsi_tgt/fuzz.sh: change overlappling CPU masks 2022-12-08 14:16:00 +00:00
json_config module/iobuf: introduce iobuf module 2022-12-16 09:06:07 +00:00
lvol add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
make nvmf: Add copy command support 2022-11-30 08:50:06 +00:00
nvme misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
nvmf test/nvmf: Manually remove cpu lock files 2022-12-14 08:03:25 +00:00
ocf Add SPDX header to various files 2022-11-29 08:27:51 +00:00
openstack add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
packaging add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
pmem add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
rpc lib/trace: add trace_get_info RPC 2022-12-05 09:50:38 +00:00
rpc_client add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
rpc_plugins autotest: Use rpc_cmd() for rpc plugin-based tests 2021-04-02 08:22:42 +00:00
scheduler Add SPDX header to various files 2022-11-29 08:27:51 +00:00
setup scripts/setup: Stop checking for broken uio_pci_generic driver 2022-12-14 08:03:17 +00:00
sma sma test: disable line wrapping for base64 2022-12-16 09:22:52 +00:00
spdkcli spdkcli: add uring bdev support 2022-12-20 09:17:07 +00:00
thread thread: test SPDK spinlocks in an application 2022-12-06 21:20:17 +00:00
unit blobstore: missing lock leads to md page race 2022-12-20 09:19:09 +00:00
vfio_user Add SPDX header to various files 2022-11-29 08:27:51 +00:00
vhost test/vhost_boot: Use string to check for disk device 2022-12-06 08:40:46 +00:00
vmd add (c) and SPDX header to bash files as needed 2022-11-29 08:27:51 +00:00
Makefile update Intel copyright notices 2022-11-10 08:28:53 +00:00
spdk_cunit.h update Intel copyright notices 2022-11-10 08:28:53 +00:00