All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] scsi: Fix passthrough retry counter handling
@ 2022-08-12  1:12 Mike Christie
  2022-08-12  5:33 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Christie @ 2022-08-12  1:12 UTC (permalink / raw)
  To: hch, martin.petersen, linux-scsi, james.bottomley; +Cc: Mike Christie

Passthrough users will set the scsi_cmnd->allowed value and were
expecting up to $allowed retries. The problem is that before:

commit 6aded12b10e0 ("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.

Fixes: 6aded12b10e0 ("scsi: core: Remove struct scsi_request")
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---

v2:
- Remove passthrough check and just move initialization to after
existing check.

 drivers/scsi/scsi_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 4dbd29ab1dcc..e29cbc13a985 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1542,7 +1542,6 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
 	scsi_init_command(sdev, cmd);
 
 	cmd->eh_eflags = 0;
-	cmd->allowed = 0;
 	cmd->prot_type = 0;
 	cmd->prot_flags = 0;
 	cmd->submitter = 0;
@@ -1593,6 +1592,8 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
 			return ret;
 	}
 
+	/* usually overriden by the ULP */
+	cmd->allowed = 0;
 	memset(cmd->cmnd, 0, sizeof(cmd->cmnd));
 	return scsi_cmd_to_driver(cmd)->init_command(cmd);
 }
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/1] scsi: Fix passthrough retry counter handling
  2022-08-12  1:12 [PATCH v2 1/1] scsi: Fix passthrough retry counter handling Mike Christie
@ 2022-08-12  5:33 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2022-08-12  5:33 UTC (permalink / raw)
  To: Mike Christie; +Cc: hch, martin.petersen, linux-scsi, james.bottomley

On Thu, Aug 11, 2022 at 08:12:06PM -0500, Mike Christie wrote:
> Passthrough users will set the scsi_cmnd->allowed value and were
> expecting up to $allowed retries. The problem is that before:
> 
> commit 6aded12b10e0 ("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.
> 
> Fixes: 6aded12b10e0 ("scsi: core: Remove struct scsi_request")
> Signed-off-by: Mike Christie <michael.christie@oracle.com>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12  5:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12  1:12 [PATCH v2 1/1] scsi: Fix passthrough retry counter handling Mike Christie
2022-08-12  5:33 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.