From b5b752792fd36ef68c8e79e303fb684ca34a9926 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Tue, 8 Feb 2022 17:50:52 +0300 Subject: [PATCH] bdev/aio: Correct error message when IO fails structure io_event defined in aio_abi.h has res member with type __s64 which is typically mapped to long long int. When we print error message, res member can be treated as an error code. In the following error message: failed to complete aio: requested len is 4096, but completed len is 18446744073709551611 the last digit in int representation is -5 which is -EIO Signed-off-by: Alexey Marchuk Reported-by: Anil Change-Id: I33b98d2118bbc9cace2d9da7cf9cd9bd06d784e6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11453 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Dong Yi Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- module/bdev/aio/bdev_aio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/bdev/aio/bdev_aio.c b/module/bdev/aio/bdev_aio.c index e81c2522d..d06a68550 100644 --- a/module/bdev/aio/bdev_aio.c +++ b/module/bdev/aio/bdev_aio.c @@ -3,6 +3,7 @@ * * Copyright (c) Intel Corporation. * All rights reserved. + * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -358,8 +359,7 @@ bdev_aio_io_channel_poll(struct bdev_aio_io_channel *io_ch) spdk_bdev_io_complete_aio_status(spdk_bdev_io_from_ctx(aio_task), -aio_errno); } else { - SPDK_ERRLOG("failed to complete aio: requested len is %lu, but completed len is %lu.\n", - aio_task->len, io_result); + SPDK_ERRLOG("failed to complete aio: rc %"PRId64"\n", events[i].res); spdk_bdev_io_complete(spdk_bdev_io_from_ctx(aio_task), SPDK_BDEV_IO_STATUS_FAILED); } }