Commit 8933ba21 authored by Jim Harris's avatar Jim Harris Committed by Ben Walker
Browse files

bdev/error: do not submit an I/O that will be failed



If error injection is enabled and we choose an I/O to
fail, do not submit the I/O and fail it when completed -
just fail it immediately.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ib58513f66e0df22c36137c0adb273fc31066c983

Reviewed-on: https://review.gerrithub.io/362386


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 5fafd5c2
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -68,16 +68,6 @@ spdk_vbdev_inject_error(uint32_t io_type_mask, uint32_t error_num)
	pthread_mutex_unlock(&g_vbdev_error_mutex);
}

static void
vbdev_error_task_complete(struct spdk_bdev_io *bdev_io, bool success,
			  void *cb_arg)
{
	struct spdk_bdev_io *bdevio = (struct spdk_bdev_io *)cb_arg;
	struct spdk_bdev_io *parent = bdevio->parent;

	spdk_bdev_io_complete(parent, SPDK_BDEV_IO_STATUS_FAILED);
}

static void
vbdev_error_reset(struct vbdev_error_disk *error_disk, struct spdk_bdev_io *bdev_io)
{
@@ -98,7 +88,6 @@ vbdev_error_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev
{
	struct vbdev_error_disk *error_disk = bdev_io->bdev->ctxt;
	uint32_t io_type_mask;
	struct spdk_bdev_io *child;

	switch (bdev_io->type) {
	case SPDK_BDEV_IO_TYPE_READ:
@@ -128,9 +117,7 @@ vbdev_error_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev
		spdk_bdev_io_resubmit(bdev_io, error_disk->base_bdev);
	} else {
		g_error_num--;
		child = spdk_bdev_get_child_io(bdev_io, &error_disk->disk, vbdev_error_task_complete, NULL);
		child->ch = bdev_io->ch;
		spdk_bdev_io_resubmit(child, error_disk->base_bdev);
		spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
	}
	pthread_mutex_unlock(&g_vbdev_error_mutex);
}