[PATCH v2 2/3] scsi: lpfc: Report bsg mailbox failures as an errno
From: Wentao Liang
Date: Sat Nov 07 2026 - 14:05:07 EST
lpfc_bsg_issue_mbox() hands a command to the port with MBX_NOWAIT and, if
that does not start the command, returns the raw result to
lpfc_bsg_mbox_cmd(), which stores it in the bsg reply. bsg-lib only
reports a negative result as an error to the ioctl caller, so a positive
MBX status such as MBX_NOT_FINISHED is passed off as success, with
device_status holding the low byte of the status and no reply data.
Report -EIO instead, as the polled path in the same function already maps
its failures to -ETIME and -ENODEV.
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
New in v2.
drivers/scsi/lpfc/lpfc_bsg.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 7354ae9ba8e5..00c54a8818ed 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -5106,6 +5106,11 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct bsg_job *job,
if ((rc == MBX_SUCCESS) || (rc == MBX_BUSY))
return 1; /* job started */
+ /* bsg-lib only reports a negative result as an error, so a status
+ * from the MBX code space must not be passed back to it.
+ */
+ rc = -EIO;
+
job_done:
/* common exit for error or job completed inline */
if (pmboxq)