mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 02:36:21 +00:00
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:
parent
e335795f27
commit
1035c9893f
@ -308,19 +308,19 @@ out:
|
||||
* @lli: LUN destined for capacity request.
|
||||
*
|
||||
* 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
|
||||
* recovery, the handler drains all currently running ioctls, waiting until they
|
||||
* have completed before proceeding with a reset. As this routine is used on the
|
||||
* ioctl path, this can create a condition where the EEH handler becomes stuck,
|
||||
* infinitely waiting for this ioctl thread. To avoid this behavior, temporarily
|
||||
* unmark this thread as an ioctl thread by releasing the ioctl read semaphore.
|
||||
* This will allow the EEH handler to proceed with a recovery while this thread
|
||||
* is still running. Once the scsi_execute() returns, reacquire the ioctl read
|
||||
* semaphore and check the adapter state in case it changed while inside of
|
||||
* scsi_execute(). The state check will wait if the adapter is still being
|
||||
* recovered or return a failure if the recovery failed. In the event that the
|
||||
* adapter reset failed, simply return the failure as the ioctl would be unable
|
||||
* to continue.
|
||||
* in scsi_execute_cmd(), the EEH handler will attempt to recover. As part of
|
||||
* the recovery, the handler drains all currently running ioctls, waiting until
|
||||
* they have completed before proceeding with a reset. As this routine is used
|
||||
* on the ioctl path, this can create a condition where the EEH handler becomes
|
||||
* stuck, infinitely waiting for this ioctl thread. To avoid this behavior,
|
||||
* temporarily unmark this thread as an ioctl thread by releasing the ioctl
|
||||
* read semaphore. This will allow the EEH handler to proceed with a recovery
|
||||
* while this thread is still running. Once the scsi_execute_cmd() returns,
|
||||
* reacquire the ioctl read semaphore and check the adapter state in case it
|
||||
* changed while inside of scsi_execute_cmd(). The state check will wait if the
|
||||
* adapter is still being recovered or return a failure if the recovery failed.
|
||||
* In the event that the adapter reset failed, 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
|
||||
* 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 glun_info *gli = lli->parent;
|
||||
struct scsi_sense_hdr sshdr;
|
||||
const struct scsi_exec_args exec_args = {
|
||||
.sshdr = &sshdr,
|
||||
};
|
||||
u8 *cmd_buf = NULL;
|
||||
u8 *scsi_cmd = NULL;
|
||||
int rc = 0;
|
||||
@ -357,9 +360,8 @@ retry:
|
||||
|
||||
/* Drop the ioctl read semahpore across lengthy call */
|
||||
up_read(&cfg->ioctl_rwsem);
|
||||
result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf,
|
||||
CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES,
|
||||
0, 0, NULL);
|
||||
result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, cmd_buf,
|
||||
CMD_BUFSIZE, to, CMD_RETRIES, &exec_args);
|
||||
down_read(&cfg->ioctl_rwsem);
|
||||
rc = check_state(cfg);
|
||||
if (rc) {
|
||||
|
@ -397,19 +397,19 @@ static int init_vlun(struct llun_info *lli)
|
||||
* @nblks: Number of logical blocks to write same.
|
||||
*
|
||||
* 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
|
||||
* the recovery, the handler drains all currently running ioctls, waiting until
|
||||
* they have completed before proceeding with a reset. As this routine is used
|
||||
* on the ioctl path, this can create a condition where the EEH handler becomes
|
||||
* stuck, infinitely waiting for this ioctl thread. To avoid this behavior,
|
||||
* temporarily unmark this thread as an ioctl thread by releasing the ioctl read
|
||||
* semaphore. This will allow the EEH handler to proceed with a recovery while
|
||||
* this thread is still running. Once the scsi_execute() returns, reacquire the
|
||||
* ioctl read semaphore and check the adapter state in case it changed while
|
||||
* inside of scsi_execute(). The state check will wait if the adapter is still
|
||||
* being recovered or return a failure if the recovery failed. In the event that
|
||||
* the adapter reset failed, simply return the failure as the ioctl would be
|
||||
* unable to continue.
|
||||
* while in scsi_execute_cmd(), the EEH handler will attempt to recover. As
|
||||
* part of the recovery, the handler drains all currently running ioctls,
|
||||
* waiting until they have completed before proceeding with a reset. As this
|
||||
* routine is used on the ioctl path, this can create a condition where the
|
||||
* EEH handler becomes stuck, infinitely waiting for this ioctl thread. To
|
||||
* avoid this behavior, temporarily unmark this thread as an ioctl thread by
|
||||
* releasing the ioctl read semaphore. This will allow the EEH handler to
|
||||
* proceed with a recovery while this thread is still running. Once the
|
||||
* scsi_execute_cmd() returns, reacquire the ioctl read semaphore and check the
|
||||
* adapter state in case it changed while inside of scsi_execute_cmd(). The
|
||||
* state check will wait if the adapter is still being recovered or return a
|
||||
* failure if the recovery failed. In the event that the adapter reset failed,
|
||||
* 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
|
||||
* an ioctl thread.
|
||||
@ -450,9 +450,9 @@ static int write_same16(struct scsi_device *sdev,
|
||||
|
||||
/* Drop the ioctl read semahpore across lengthy call */
|
||||
up_read(&cfg->ioctl_rwsem);
|
||||
result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf,
|
||||
CMD_BUFSIZE, NULL, NULL, to,
|
||||
CMD_RETRIES, 0, 0, NULL);
|
||||
result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_OUT,
|
||||
cmd_buf, CMD_BUFSIZE, to,
|
||||
CMD_RETRIES, NULL);
|
||||
down_read(&cfg->ioctl_rwsem);
|
||||
rc = check_state(cfg);
|
||||
if (rc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user