[PATCH 2/4] selftests: ublk: kublk: fix an error log line

Uday Shankar posted 4 patches 8 months, 4 weeks ago
[PATCH 2/4] selftests: ublk: kublk: fix an error log line
Posted by Uday Shankar 8 months, 4 weeks ago
When doing io_uring operations using liburing, errno is not used to
indicate errors, so the %m format specifier does not provide any
relevant information for failed io_uring commands. Fix a log line
emitted on get_params failure to translate the error code returned in
the cqe->res field instead.

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
---
 tools/testing/selftests/ublk/kublk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests/ublk/kublk.c
index b17eee643b2dbfd59903b61718afcbc21da91d97..ded1b93e7913011499ae5dae7b40f0e425982ee4 100644
--- a/tools/testing/selftests/ublk/kublk.c
+++ b/tools/testing/selftests/ublk/kublk.c
@@ -215,7 +215,7 @@ static void ublk_ctrl_dump(struct ublk_dev *dev)
 
 	ret = ublk_ctrl_get_params(dev, &p);
 	if (ret < 0) {
-		ublk_err("failed to get params %m\n");
+		ublk_err("failed to get params %d %s\n", ret, strerror(-ret));
 		return;
 	}
 

-- 
2.34.1
Re: [PATCH 2/4] selftests: ublk: kublk: fix an error log line
Posted by Ming Lei 8 months, 4 weeks ago
On Tue, Mar 25, 2025 at 04:19:32PM -0600, Uday Shankar wrote:
> When doing io_uring operations using liburing, errno is not used to
> indicate errors, so the %m format specifier does not provide any
> relevant information for failed io_uring commands. Fix a log line
> emitted on get_params failure to translate the error code returned in
> the cqe->res field instead.
> 
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> ---
>  tools/testing/selftests/ublk/kublk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests/ublk/kublk.c
> index b17eee643b2dbfd59903b61718afcbc21da91d97..ded1b93e7913011499ae5dae7b40f0e425982ee4 100644
> --- a/tools/testing/selftests/ublk/kublk.c
> +++ b/tools/testing/selftests/ublk/kublk.c
> @@ -215,7 +215,7 @@ static void ublk_ctrl_dump(struct ublk_dev *dev)
>  
>  	ret = ublk_ctrl_get_params(dev, &p);
>  	if (ret < 0) {
> -		ublk_err("failed to get params %m\n");
> +		ublk_err("failed to get params %d %s\n", ret, strerror(-ret));
>  		return;

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming