From 2e6bc2ca8f92b276b8044e67952137956dd4b69e Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Mon, 16 Dec 2024 08:30:13 +0000 Subject: [PATCH] ublksrv_tgt: avoid to dump lots of failure message in case that io_uring is disabled Signed-off-by: Ming Lei --- ublksrv_tgt.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ublksrv_tgt.cpp b/ublksrv_tgt.cpp index d1395be8..8f9cf283 100644 --- a/ublksrv_tgt.cpp +++ b/ublksrv_tgt.cpp @@ -984,7 +984,7 @@ static int list_one_dev(int number, bool log, bool verbose) if (!dev) { fprintf(stderr, "ublksrv_ctrl_init failed id %d\n", number); - return -errno; + return -ENODEV; } ret = ublksrv_ctrl_get_info(dev); if (ret < 0) { @@ -1030,8 +1030,12 @@ static int cmd_list_dev_info(int argc, char *argv[]) if (number >= 0) return list_one_dev(number, true, verbose); - for (i = 0; i < MAX_NR_UBLK_DEVS; i++) - list_one_dev(i, false, verbose); + for (i = 0; i < MAX_NR_UBLK_DEVS; i++) { + int ret = list_one_dev(i, false, verbose); + + if (ret == -ENODEV) + return ret; + } return 0; }