Skip to content

Commit

Permalink
scsi: scsi_dh_alua: Check for negative result value
Browse files Browse the repository at this point in the history
[ Upstream commit 7e26e3e ]

scsi_execute() will now return a negative error if there was an error prior
to command submission; evaluate that instead if checking for DRIVER_ERROR.

[mkp: build fix]

Link: https://lore.kernel.org/r/20210427083046.31620-6-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
hreinecke authored and gregkh committed Jul 20, 2021
1 parent 89b033d commit 936440f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/scsi/device_handler/scsi_dh_alua.c
Expand Up @@ -562,12 +562,12 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
kfree(buff);
return SCSI_DH_OK;
}
if (!scsi_sense_valid(&sense_hdr)) {
if (retval < 0 || !scsi_sense_valid(&sense_hdr)) {
sdev_printk(KERN_INFO, sdev,
"%s: rtpg failed, result %d\n",
ALUA_DH_NAME, retval);
kfree(buff);
if (driver_byte(retval) == DRIVER_ERROR)
if (retval < 0)
return SCSI_DH_DEV_TEMP_BUSY;
return SCSI_DH_IO;
}
Expand Down Expand Up @@ -791,11 +791,11 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg)
retval = submit_stpg(sdev, pg->group_id, &sense_hdr);

if (retval) {
if (!scsi_sense_valid(&sense_hdr)) {
if (retval < 0 || !scsi_sense_valid(&sense_hdr)) {
sdev_printk(KERN_INFO, sdev,
"%s: stpg failed, result %d",
ALUA_DH_NAME, retval);
if (driver_byte(retval) == DRIVER_ERROR)
if (retval < 0)
return SCSI_DH_DEV_TEMP_BUSY;
} else {
sdev_printk(KERN_INFO, sdev, "%s: stpg failed\n",
Expand Down

0 comments on commit 936440f

Please sign in to comment.