Commit e36d36e4 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383506


Reviewed-by: default avatarSeth Howell <seth.howell5141@gmail.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarZiye Yang <optimistyzy@gmail.com>
parent 5d0bdadc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
	}