Commit 488d6e84 authored by jun.ran's avatar jun.ran Committed by Tomasz Zawadzki
Browse files

bdev_aio: handle unexpected res=0 correctly



If res = 0, do not pass this value directly to bdev io completion function,
otherwise it will be treated as a successful completion.
Fix issue: 2679

Signed-off-by: default avatarjun.ran <ranjunsh@163.com>
Change-Id: Ice525de1bb5b0ada9ac30d3b59e5c731419efe2f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14364


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent c3f628f1
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ bdev_user_io_getevents(io_context_t io_ctx, unsigned int max, struct io_event *u
static int
bdev_aio_io_channel_poll(struct bdev_aio_io_channel *io_ch)
{
	int nr, i = 0;
	int nr, i, res = 0;
	struct bdev_aio_task *aio_task;
	struct io_event events[SPDK_AIO_QUEUE_DEPTH];

@@ -328,7 +328,12 @@ bdev_aio_io_channel_poll(struct bdev_aio_io_channel *io_ch)
			 * convert it to signed value for error detection.
			 */
			SPDK_ERRLOG("failed to complete aio: rc %"PRId64"\n", events[i].res);
			spdk_bdev_io_complete_aio_status(spdk_bdev_io_from_ctx(aio_task), (int)events[i].res);
			res = (int)events[i].res;
			if (res < 0) {
				spdk_bdev_io_complete_aio_status(spdk_bdev_io_from_ctx(aio_task), res);
			} else {
				spdk_bdev_io_complete(spdk_bdev_io_from_ctx(aio_task), SPDK_BDEV_IO_STATUS_FAILED);
			}
		}
	}