bdev: disallow get_buf() calls from other threads
This is unsafe, because we touch need_buf_* queues, which aren't thread-safe. Also, documented this requirement in spdk_bdev_io_get_buf()'s description. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Iabc141e051c543fdd51f079ae212f69e980d8148 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15668 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
533470b214
commit
9e647c1f46
@ -968,7 +968,8 @@ const struct spdk_bdev_aliases_list *spdk_bdev_get_aliases(const struct spdk_bde
|
||||
* callback on read path. The buffer will be freed automatically
|
||||
* on \c spdk_bdev_free_io() call. This call will never fail.
|
||||
* In case of lack of memory given callback \c cb will be deferred
|
||||
* until enough memory is freed.
|
||||
* until enough memory is freed. This function *must* be called
|
||||
* from the thread issuing \c bdev_io.
|
||||
*
|
||||
* \param bdev_io I/O to allocate buffer for.
|
||||
* \param cb callback to be called when the buffer is allocated
|
||||
|
@ -1227,6 +1227,7 @@ bdev_io_get_buf(struct spdk_bdev_io *bdev_io, uint64_t len)
|
||||
uint64_t alignment, md_len;
|
||||
void *buf;
|
||||
|
||||
assert(spdk_bdev_io_get_thread(bdev_io) == spdk_get_thread());
|
||||
alignment = spdk_bdev_get_buf_align(bdev);
|
||||
md_len = spdk_bdev_is_md_separate(bdev) ? bdev_io->u.bdev.num_blocks * bdev->md_len : 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user