From f3cedcc7fe38d40cd622b572e219e36d790f898f Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 6 Sep 2018 12:10:44 -0700 Subject: [PATCH] bdev: set iovs on correct bdev_io in spdk_bdev_io_put_buf spdk_bdev_io_put_buf() is responsible for reclaiming bdev-allocated buffers from a bdev_io. If there are bdev_ios waiting for one of these buffers, it calls spdk_bdev_io_set_buf() on the next bdev_io in the queue. This will set the iov_base and iov_len on the bdev_io to point to the bdev-allocated buffer. But spdk_bdev_io_put_buf() was calling spdk_bdev_io_set_buf() on the just completed bdev_io, not the next bdev_io in the queue. So fix that. Fixes: 844aedf8 ("bdev: Simplify get/set/put buf functions") Reported-by: Alan Tu Signed-off-by: Jim Harris Change-Id: Ibbcad6e35a3db6991bd7deb3516229572f021638 Reviewed-on: https://review.gerrithub.io/424881 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- lib/bdev/bdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 4d91da380..f9b099c2b 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -420,7 +420,7 @@ spdk_bdev_io_put_buf(struct spdk_bdev_io *bdev_io) tmp = STAILQ_FIRST(stailq); aligned_buf = (void *)(((uintptr_t)buf + 511) & ~511UL); - spdk_bdev_io_set_buf(bdev_io, aligned_buf, tmp->internal.buf_len); + spdk_bdev_io_set_buf(tmp, aligned_buf, tmp->internal.buf_len); STAILQ_REMOVE_HEAD(stailq, internal.buf_link); tmp->internal.buf = buf;