bdev: Avoid assert when read/write to bdev fails in _spdk_bdev_io_split

Currently when read/write to bdev fails in _spdk_bdev_io_split_with_payload
due to other than -ENOMEM, assert is called.

RAID bdev that utilizes the split IO feature is generally availale now
and it will be OK to remove this assert and return error instead.

Change-Id: I6ea6fd45b94bff0ea84e498e0c4dfd1dd31e0260
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/427025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-09-27 16:21:15 +09:00 committed by Changpeng Liu
parent 3c7894ffff
commit 9872b99206

View File

@ -1205,13 +1205,15 @@ _spdk_bdev_io_split_with_payload(void *_bdev_io)
if (rc == 0) {
bdev_io->u.bdev.split_current_offset_blocks += to_next_boundary;
bdev_io->u.bdev.split_remaining_num_blocks -= to_next_boundary;
} else {
assert(rc == -ENOMEM);
} else if (rc == -ENOMEM) {
bdev_io->internal.waitq_entry.bdev = bdev_io->bdev;
bdev_io->internal.waitq_entry.cb_fn = _spdk_bdev_io_split_with_payload;
bdev_io->internal.waitq_entry.cb_arg = bdev_io;
spdk_bdev_queue_io_wait(bdev_io->bdev, spdk_io_channel_from_ctx(bdev_io->internal.ch),
&bdev_io->internal.waitq_entry);
} else {
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_FAILED;
bdev_io->internal.cb(bdev_io, false, bdev_io->internal.caller_ctx);
}
}