bdev: fix write zeroes fallback error path

If an I/O fails during the write zeroes fallback to write on a split
I/O, the previous code would call spdk_bdev_io_complete() again on the
same I/O, causing infinite recursion.

Fix this by restoring the original user callback before completing the
I/O, as well as using _spdk_bdev_io_complete() rather than
spdk_bdev_io_complete() to avoid double-counting the statistics.

This also preserves the original bdev_io->status code set by the module,
rather than always setting it to SPDK_BDEV_IO_STATUS_FAILED.

Change-Id: Ib71fa6e54eed3d5823652971f7c439e0ff236fc1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383506
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
This commit is contained in:
Daniel Verkamp 2017-10-23 13:43:50 -07:00
parent 5d0bdadc4e
commit e36d36e4f9

View File

@ -2002,7 +2002,8 @@ spdk_bdev_write_zeroes_split(struct spdk_bdev_io *bdev_io, bool success, void *c
uint64_t len;
if (!success) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
bdev_io->cb = bdev_io->stored_user_cb;
_spdk_bdev_io_complete(bdev_io);
return;
}