Skip to content

Commit fac8e55

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: core: Fix passthrough retry counter handling
Passthrough users will set the scsi_cmnd->allowed value and were expecting up to $allowed retries. The problem is that before: commit 6aded12 ("scsi: core: Remove struct scsi_request") we used to set the retries on the scsi_request then copy them over to scsi_cmnd->allowed in scsi_setup_scsi_cmnd. With that patch we now set scsi_cmnd->allowed to 0 in scsi_prepare_cmd and overwrite what the passthrough user set. This moves the allowed initialization to after the blk_rq_is_passthrough() check so it's only done for the non-passthrough path where the ULD init_command will normally set an allowed value it prefers. Link: https://lore.kernel.org/r/[email protected] Fixes: 6aded12 ("scsi: core: Remove struct scsi_request") Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8f2c964 commit fac8e55

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,6 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
15481548
scsi_init_command(sdev, cmd);
15491549

15501550
cmd->eh_eflags = 0;
1551-
cmd->allowed = 0;
15521551
cmd->prot_type = 0;
15531552
cmd->prot_flags = 0;
15541553
cmd->submitter = 0;
@@ -1599,6 +1598,8 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
15991598
return ret;
16001599
}
16011600

1601+
/* Usually overridden by the ULP */
1602+
cmd->allowed = 0;
16021603
memset(cmd->cmnd, 0, sizeof(cmd->cmnd));
16031604
return scsi_cmd_to_driver(cmd)->init_command(cmd);
16041605
}

0 commit comments

Comments
 (0)