bdev: process failure of spdk_bdev_io_get_buf_cb in each bdev module

If success is false in each bdev module's spdk_bdev_io_get_buf_cb,
call spdk_bdev_io_complete with SPDK_BDEV_IO_STATUS_FAILED, and
then return.

Change-Id: I6f106d8d39a3616f7305201fa2efc4805d4d00ee
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/446046
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-02-25 10:43:13 +09:00 committed by Changpeng Liu
parent de68dfee47
commit 0f01513359
14 changed files with 62 additions and 16 deletions

View File

@ -398,7 +398,10 @@ static void
bdev_aio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bdev_aio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
switch (bdev_io->type) { switch (bdev_io->type) {
case SPDK_BDEV_IO_TYPE_READ: case SPDK_BDEV_IO_TYPE_READ:

View File

@ -1657,7 +1657,10 @@ static void
_spdk_bdev_io_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, _spdk_bdev_io_split_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
_spdk_bdev_io_split(ch, bdev_io); _spdk_bdev_io_split(ch, bdev_io);
} }

View File

@ -913,7 +913,10 @@ crypto_read_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
struct crypto_io_channel *crypto_ch = spdk_io_channel_get_ctx(ch); struct crypto_io_channel *crypto_ch = spdk_io_channel_get_ctx(ch);
int rc; int rc;
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
rc = spdk_bdev_readv_blocks(crypto_bdev->base_desc, crypto_ch->base_ch, bdev_io->u.bdev.iovs, rc = spdk_bdev_readv_blocks(crypto_bdev->base_desc, crypto_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,

View File

@ -315,7 +315,11 @@ static void
bdev_ftl_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bdev_ftl_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
bdev_ftl_complete_io((struct ftl_bdev_io *)bdev_io->driver_ctx,
SPDK_BDEV_IO_STATUS_FAILED);
return;
}
int rc = bdev_ftl_readv((struct ftl_bdev *)bdev_io->bdev->ctxt, int rc = bdev_ftl_readv((struct ftl_bdev *)bdev_io->bdev->ctxt,
ch, (struct ftl_bdev_io *)bdev_io->driver_ctx); ch, (struct ftl_bdev_io *)bdev_io->driver_ctx);

View File

@ -400,7 +400,10 @@ static void
bdev_iscsi_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bdev_iscsi_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
bdev_iscsi_readv((struct bdev_iscsi_lun *)bdev_io->bdev->ctxt, bdev_iscsi_readv((struct bdev_iscsi_lun *)bdev_io->bdev->ctxt,
(struct bdev_iscsi_io *)bdev_io->driver_ctx, (struct bdev_iscsi_io *)bdev_io->driver_ctx,

View File

@ -843,7 +843,10 @@ lvol_reset(struct spdk_bdev_io *bdev_io)
static void static void
lvol_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success) lvol_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
lvol_read(ch, bdev_io); lvol_read(ch, bdev_io);
} }

View File

@ -379,7 +379,10 @@ bdev_nvme_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
{ {
int ret; int ret;
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
ret = bdev_nvme_readv((struct nvme_bdev *)bdev_io->bdev->ctxt, ret = bdev_nvme_readv((struct nvme_bdev *)bdev_io->bdev->ctxt,
ch, ch,

View File

@ -296,7 +296,7 @@ static void
io_handle(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io) io_handle(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
{ {
struct vbdev_ocf *vbdev = bdev_io->bdev->ctxt; struct vbdev_ocf *vbdev = bdev_io->bdev->ctxt;
struct ocf_io *io; struct ocf_io *io = NULL;
struct bdev_ocf_data *data = NULL; struct bdev_ocf_data *data = NULL;
struct vbdev_ocf_qcxt *qctx = spdk_io_channel_get_ctx(ch); struct vbdev_ocf_qcxt *qctx = spdk_io_channel_get_ctx(ch);
int err; int err;
@ -345,7 +345,10 @@ static void
vbdev_ocf_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, vbdev_ocf_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
io_handle(ch, bdev_io); io_handle(ch, bdev_io);
} }

View File

@ -217,7 +217,10 @@ pt_read_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, boo
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);
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
spdk_bdev_readv_blocks(pt_node->base_desc, pt_ch->base_ch, bdev_io->u.bdev.iovs, 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,

View File

@ -187,7 +187,10 @@ static void
bdev_pmem_io_get_buf_cb(struct spdk_io_channel *channel, struct spdk_bdev_io *bdev_io, bdev_pmem_io_get_buf_cb(struct spdk_io_channel *channel, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
bdev_pmem_submit_io(bdev_io, bdev_pmem_submit_io(bdev_io,
bdev_io->bdev->ctxt, bdev_io->bdev->ctxt,

View File

@ -607,7 +607,10 @@ static void
raid_bdev_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, raid_bdev_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
raid_bdev_start_rw_request(ch, bdev_io); raid_bdev_start_rw_request(ch, bdev_io);
} }

View File

@ -379,7 +379,10 @@ bdev_rbd_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
{ {
int ret; int ret;
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
ret = bdev_rbd_rw(bdev_io->bdev->ctxt, ret = bdev_rbd_rw(bdev_io->bdev->ctxt,
ch, ch,

View File

@ -187,7 +187,10 @@ static void
bdev_virtio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bdev_virtio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
bdev_virtio_command(ch, bdev_io); bdev_virtio_command(ch, bdev_io);
} }

View File

@ -587,7 +587,10 @@ bdev_virtio_unmap(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool
uint64_t offset_blocks, num_blocks; uint64_t offset_blocks, num_blocks;
uint16_t cmd_len; uint16_t cmd_len;
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
buf = bdev_io->u.bdev.iovs[0].iov_base; buf = bdev_io->u.bdev.iovs[0].iov_base;
@ -628,7 +631,10 @@ static void
bdev_virtio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bdev_virtio_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
bool success) bool success)
{ {
assert(success == true); if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
return;
}
bdev_virtio_rw(ch, bdev_io); bdev_virtio_rw(ch, bdev_io);
} }