diff --git a/include/spdk/bdev_module.h b/include/spdk/bdev_module.h index de6e4a745..fc70278e1 100644 --- a/include/spdk/bdev_module.h +++ b/include/spdk/bdev_module.h @@ -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 diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 6b3af2559..713fc3e00 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -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;