scsi: cxlflash: Convert to scsi_execute_cmd()

scsi_execute() is going to be removed. Convert cxlflash to use
scsi_execute_cmd().

[mkp: roll in fix for issue reported by sfr]

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Mike Christie 2022-12-29 13:01:53 -06:00 committed by Martin K. Petersen
parent e335795f27
commit 1035c9893f
2 changed files with 34 additions and 32 deletions

View file

@ -308,19 +308,19 @@ static int afu_attach(struct cxlflash_cfg *cfg, struct ctx_info *ctxi)
* @lli: LUN destined for capacity request. * @lli: LUN destined for capacity request.
* *
* The READ_CAP16 can take quite a while to complete. Should an EEH occur while * The READ_CAP16 can take quite a while to complete. Should an EEH occur while
* in scsi_execute(), the EEH handler will attempt to recover. As part of the * in scsi_execute_cmd(), the EEH handler will attempt to recover. As part of
* recovery, the handler drains all currently running ioctls, waiting until they * the recovery, the handler drains all currently running ioctls, waiting until
* have completed before proceeding with a reset. As this routine is used on the * they have completed before proceeding with a reset. As this routine is used
* ioctl path, this can create a condition where the EEH handler becomes stuck, * on the ioctl path, this can create a condition where the EEH handler becomes
* infinitely waiting for this ioctl thread. To avoid this behavior, temporarily * stuck, infinitely waiting for this ioctl thread. To avoid this behavior,
* unmark this thread as an ioctl thread by releasing the ioctl read semaphore. * temporarily unmark this thread as an ioctl thread by releasing the ioctl
* This will allow the EEH handler to proceed with a recovery while this thread * read semaphore. This will allow the EEH handler to proceed with a recovery
* is still running. Once the scsi_execute() returns, reacquire the ioctl read * while this thread is still running. Once the scsi_execute_cmd() returns,
* semaphore and check the adapter state in case it changed while inside of * reacquire the ioctl read semaphore and check the adapter state in case it
* scsi_execute(). The state check will wait if the adapter is still being * changed while inside of scsi_execute_cmd(). The state check will wait if the
* recovered or return a failure if the recovery failed. In the event that the * adapter is still being recovered or return a failure if the recovery failed.
* adapter reset failed, simply return the failure as the ioctl would be unable * In the event that the adapter reset failed, simply return the failure as the
* to continue. * ioctl would be unable to continue.
* *
* Note that the above puts a requirement on this routine to only be called on * Note that the above puts a requirement on this routine to only be called on
* an ioctl thread. * an ioctl thread.
@ -333,6 +333,9 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)
struct device *dev = &cfg->dev->dev; struct device *dev = &cfg->dev->dev;
struct glun_info *gli = lli->parent; struct glun_info *gli = lli->parent;
struct scsi_sense_hdr sshdr; struct scsi_sense_hdr sshdr;
const struct scsi_exec_args exec_args = {
.sshdr = &sshdr,
};
u8 *cmd_buf = NULL; u8 *cmd_buf = NULL;
u8 *scsi_cmd = NULL; u8 *scsi_cmd = NULL;
int rc = 0; int rc = 0;
@ -357,9 +360,8 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli)
/* Drop the ioctl read semahpore across lengthy call */ /* Drop the ioctl read semahpore across lengthy call */
up_read(&cfg->ioctl_rwsem); up_read(&cfg->ioctl_rwsem);
result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, cmd_buf,
CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES, CMD_BUFSIZE, to, CMD_RETRIES, &exec_args);
0, 0, NULL);
down_read(&cfg->ioctl_rwsem); down_read(&cfg->ioctl_rwsem);
rc = check_state(cfg); rc = check_state(cfg);
if (rc) { if (rc) {

View file

@ -397,19 +397,19 @@ static int init_vlun(struct llun_info *lli)
* @nblks: Number of logical blocks to write same. * @nblks: Number of logical blocks to write same.
* *
* The SCSI WRITE_SAME16 can take quite a while to complete. Should an EEH occur * The SCSI WRITE_SAME16 can take quite a while to complete. Should an EEH occur
* while in scsi_execute(), the EEH handler will attempt to recover. As part of * while in scsi_execute_cmd(), the EEH handler will attempt to recover. As
* the recovery, the handler drains all currently running ioctls, waiting until * part of the recovery, the handler drains all currently running ioctls,
* they have completed before proceeding with a reset. As this routine is used * waiting until they have completed before proceeding with a reset. As this
* on the ioctl path, this can create a condition where the EEH handler becomes * routine is used on the ioctl path, this can create a condition where the
* stuck, infinitely waiting for this ioctl thread. To avoid this behavior, * EEH handler becomes stuck, infinitely waiting for this ioctl thread. To
* temporarily unmark this thread as an ioctl thread by releasing the ioctl read * avoid this behavior, temporarily unmark this thread as an ioctl thread by
* semaphore. This will allow the EEH handler to proceed with a recovery while * releasing the ioctl read semaphore. This will allow the EEH handler to
* this thread is still running. Once the scsi_execute() returns, reacquire the * proceed with a recovery while this thread is still running. Once the
* ioctl read semaphore and check the adapter state in case it changed while * scsi_execute_cmd() returns, reacquire the ioctl read semaphore and check the
* inside of scsi_execute(). The state check will wait if the adapter is still * adapter state in case it changed while inside of scsi_execute_cmd(). The
* being recovered or return a failure if the recovery failed. In the event that * state check will wait if the adapter is still being recovered or return a
* the adapter reset failed, simply return the failure as the ioctl would be * failure if the recovery failed. In the event that the adapter reset failed,
* unable to continue. * simply return the failure as the ioctl would be unable to continue.
* *
* Note that the above puts a requirement on this routine to only be called on * Note that the above puts a requirement on this routine to only be called on
* an ioctl thread. * an ioctl thread.
@ -450,9 +450,9 @@ static int write_same16(struct scsi_device *sdev,
/* Drop the ioctl read semahpore across lengthy call */ /* Drop the ioctl read semahpore across lengthy call */
up_read(&cfg->ioctl_rwsem); up_read(&cfg->ioctl_rwsem);
result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf, result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_OUT,
CMD_BUFSIZE, NULL, NULL, to, cmd_buf, CMD_BUFSIZE, to,
CMD_RETRIES, 0, 0, NULL); CMD_RETRIES, NULL);
down_read(&cfg->ioctl_rwsem); down_read(&cfg->ioctl_rwsem);
rc = check_state(cfg); rc = check_state(cfg);
if (rc) { if (rc) {