Commit de4d9619 authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ibbcad6e35a3db6991bd7deb3516229572f021638

Reviewed-on: https://review.gerrithub.io/424880


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent f118de60
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -445,7 +445,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;