Spdk/lib
Shuhei Matsumoto 139940d6c1 bdev/rpc: Fix race condition for per channel bdev_get_iostat
With per channel stats called on thread A,
spdk_bdev_for_each_channel calls
spdk_for_each_channel which immediately sends
a message to thread B.
If thread B has no workload, it may execute the
message relatively fast trying to write stats to
json_write_ctx.
As result, we may have 2 scenarious:
1. json_write_ctx is still not initialized on
thread A, so thread B dereferences a NULL pointer.
1. json_write_ctx is initialized but thread A writes
response header while thread B writes stats - it leads
to corrupted json response.

To fix this race condition, initialize json_write_ctx
before iterating bdevs/channels

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Reported-by: Or Gerlitz <ogerlitz@nvidia.com>
Change-Id: I5dae37f1f527437528fc8a8e9c6066f69687dec9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16366
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-01-23 17:48:55 +00:00
..
accel accel: temporarily disable iobuf thread caches 2023-01-20 17:56:44 +00:00
bdev bdev/rpc: Fix race condition for per channel bdev_get_iostat 2023-01-23 17:48:55 +00:00
blob blobstore: mark blobstore dirty on extent page write 2023-01-20 18:58:34 +00:00
blobfs lib/blobfs: add the missing lock operation 2023-01-13 08:55:34 +00:00
conf update Intel copyright notices 2022-11-10 08:28:53 +00:00
dma update Intel copyright notices 2022-11-10 08:28:53 +00:00
env_dpdk env_dpdk: Add function to iterate memory chunks in a pool 2023-01-20 17:56:34 +00:00
env_ocf update Intel copyright notices 2022-11-10 08:28:53 +00:00
event lib/event: free the resource in the error case 2023-01-12 08:15:42 +00:00
ftl ftl: fix FTL_LOG_COMMON to avoid annoying gcc-12 warnings 2023-01-19 11:22:46 +00:00
idxd lib/idxd: change max idxd completions processed 2022-12-08 12:55:58 +00:00
init misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
ioat lib/ioat: initialized ‘status’ variable before use 2023-01-18 21:27:01 +00:00
iscsi iscsi: add EXITING conns to pg after full_feature_migrate 2022-12-23 09:27:48 +00:00
json json: add spdk_json_write_named_double 2022-11-22 10:01:43 +00:00
jsonrpc lib/jsonrpc: check the return value from setsockopt 2022-12-20 09:17:59 +00:00
log log: add deprecated tracking API 2022-12-07 17:45:53 +00:00
lvol lvol: avoid premature reference to blob 2023-01-10 13:12:41 +00:00
mlx5 module/accel: Add mlx5 accel module 2023-01-19 22:00:58 +00:00
nbd update Intel copyright notices 2022-11-10 08:28:53 +00:00
notify update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme nvme_rdma: Support SRQ for I/O qpairs 2023-01-17 23:53:01 +00:00
nvmf util: add spdk_iov_memset() 2023-01-16 09:38:43 +00:00
rdma update Intel copyright notices 2022-11-10 08:28:53 +00:00
reduce bdev/compress: Port to use accel_fw instead of compressdev 2023-01-20 10:26:21 +00:00
rocksdb rocksdb: remove spdk_thread 2022-11-23 08:22:04 +00:00
rpc lib/rpc: add RPC allow list 2022-11-15 08:31:02 +00:00
scsi misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
sock sock: set errno in spdk_sock_flush() 2022-12-01 12:49:04 +00:00
thread lib/thread: iobuf get/put functions will not add offset 2023-01-16 08:35:33 +00:00
trace lib/trace: add trace_get_info RPC 2022-12-05 09:50:38 +00:00
trace_parser update Intel copyright notices 2022-11-10 08:28:53 +00:00
ublk ublk: break ublk_start_disk into two parts 2023-01-23 17:48:10 +00:00
ut_mock update Intel copyright notices 2022-11-10 08:28:53 +00:00
util util: add spdk_iov_one() 2023-01-16 09:38:43 +00:00
vfio_user update Intel copyright notices 2022-11-10 08:28:53 +00:00
vfu_tgt update Intel copyright notices 2022-11-10 08:28:53 +00:00
vhost virtio_blk: add dump opts 2023-01-20 18:57:38 +00:00
virtio lib/virtio: add the ctx NULL check before dereferencing it 2022-11-30 08:50:48 +00:00
vmd lib/vmd: fix build with clang 15 2023-01-10 13:10:00 +00:00
Makefile ublk: add configure and event/subsystem 2023-01-20 07:48:25 +00:00