bdev/passthru: add error check in get buffer read callback

Was simply missing.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ia8ff3825e5d78c8814c3c57b779608ebe6be34ac
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454467
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
paul luse 2019-05-14 06:35:09 -07:00 committed by Jim Harris
parent 634af37b46
commit 02064419e2

View File

@ -216,16 +216,28 @@ pt_read_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, boo
struct vbdev_passthru *pt_node = SPDK_CONTAINEROF(bdev_io->bdev, struct vbdev_passthru, struct vbdev_passthru *pt_node = SPDK_CONTAINEROF(bdev_io->bdev, struct vbdev_passthru,
pt_bdev); pt_bdev);
struct pt_io_channel *pt_ch = spdk_io_channel_get_ctx(ch); struct pt_io_channel *pt_ch = spdk_io_channel_get_ctx(ch);
struct passthru_bdev_io *io_ctx = (struct passthru_bdev_io *)bdev_io->driver_ctx;
int rc;
if (!success) { if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED); spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return; return;
} }
spdk_bdev_readv_blocks(pt_node->base_desc, pt_ch->base_ch, bdev_io->u.bdev.iovs, rc = spdk_bdev_readv_blocks(pt_node->base_desc, pt_ch->base_ch, bdev_io->u.bdev.iovs,
bdev_io->u.bdev.iovcnt, bdev_io->u.bdev.offset_blocks, bdev_io->u.bdev.iovcnt, bdev_io->u.bdev.offset_blocks,
bdev_io->u.bdev.num_blocks, _pt_complete_io, bdev_io->u.bdev.num_blocks, _pt_complete_io,
bdev_io); bdev_io);
if (rc != 0) {
if (rc == -ENOMEM) {
SPDK_ERRLOG("No memory, start to queue io for passthru.\n");
io_ctx->ch = ch;
vbdev_passthru_queue_io(bdev_io);
} else {
SPDK_ERRLOG("ERROR on bdev_io submission!\n");
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
}
}
} }
/* Called when someone above submits IO to this pt vbdev. We're simply passing it on here /* Called when someone above submits IO to this pt vbdev. We're simply passing it on here