From ea141f84750a3fad551968b0e3840df4ec5fe20f Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 22 Sep 2025 14:38:38 +0000 Subject: [PATCH] fix: only try to read unit serial if lun != -1 iscsi-ls --show-luns connects to lun -1 for which iscsi inquiry fails on some storage. Signed-off-by: Peter Lieven --- lib/connect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/connect.c b/lib/connect.c index e35e5a4..c7660d4 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -237,7 +237,7 @@ iscsi_login_cb(struct iscsi_context *iscsi, int status, void *command_data, ct->cb(iscsi, SCSI_STATUS_ERROR, NULL, ct->private_data); iscsi_free(iscsi, ct); } - } else { + } else if (ct->lun != -1) { if (iscsi_inquiry_page_0x80_connect(iscsi, ct->lun, iscsi_inquiry_page_0x80_cb, ct) == NULL) { @@ -245,6 +245,10 @@ iscsi_login_cb(struct iscsi_context *iscsi, int status, void *command_data, ct->cb(iscsi, SCSI_STATUS_ERROR, NULL, ct->private_data); iscsi_free(iscsi, ct); } + } else { + ct->cb(iscsi, SCSI_STATUS_GOOD, NULL, ct->private_data); + iscsi_free(iscsi, ct); + return; } }