Message ID | 20220512111236.109851-5-hare@suse.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: EH rework prep patches, part 1 | expand |
This patch appears to change the EH activity from issuing a target reset to a LUN reset only (since it does not add an entry in the host templates for .eh_target_reset_handler to invoke the new mptscsih_target_reset() function, nor does any other patch in the series). Is this going to work properly, and without escalating to a host reset which might not have happened before? -Ewan On Thu, May 12, 2022 at 7:13 AM Hannes Reinecke <hare@suse.de> wrote: > > From: Hannes Reinecke <hare@suse.com> > > mptscsih_dev_reset() is _not_ a device reset, but rather a > target reset. Nevertheless it's being used for either purpose. > This patch adds a correct implementation for mptscsih_dev_reset(), > and renames the original function to mptscsih_target_reset(). > > Signed-off-by: Hannes Reinecke <hare@suse.com> > Reviewed-by: Christoph Hellwig <hch@lst.de> > Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > --- > drivers/message/fusion/mptscsih.c | 55 ++++++++++++++++++++++++++++++- > drivers/message/fusion/mptscsih.h | 1 + > 2 files changed, 55 insertions(+), 1 deletion(-) > > diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c > index 276084ed04a6..ed21cc4d2c77 100644 > --- a/drivers/message/fusion/mptscsih.c > +++ b/drivers/message/fusion/mptscsih.c > @@ -1794,7 +1794,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) > > /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ > /** > - * mptscsih_dev_reset - Perform a SCSI TARGET_RESET! new_eh variant > + * mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET! > * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to > * > * (linux scsi_host_template.eh_dev_reset_handler routine) > @@ -1809,6 +1809,58 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) > VirtDevice *vdevice; > MPT_ADAPTER *ioc; > > + /* If we can't locate our host adapter structure, return FAILED status. > + */ > + if ((hd = shost_priv(SCpnt->device->host)) == NULL){ > + printk(KERN_ERR MYNAM ": lun reset: " > + "Can't locate host! (sc=%p)\n", SCpnt); > + return FAILED; > + } > + > + ioc = hd->ioc; > + printk(MYIOC_s_INFO_FMT "attempting lun reset! (sc=%p)\n", > + ioc->name, SCpnt); > + scsi_print_command(SCpnt); > + > + vdevice = SCpnt->device->hostdata; > + if (!vdevice || !vdevice->vtarget) { > + retval = 0; > + goto out; > + } > + > + retval = mptscsih_IssueTaskMgmt(hd, > + MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET, > + vdevice->vtarget->channel, > + vdevice->vtarget->id, vdevice->lun, 0, > + mptscsih_get_tm_timeout(ioc)); > + > + out: > + printk (MYIOC_s_INFO_FMT "lun reset: %s (sc=%p)\n", > + ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); > + > + if (retval == 0) > + return SUCCESS; > + else > + return FAILED; > +} > + > +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ > +/** > + * mptscsih_target_reset - Perform a SCSI TARGET_RESET! > + * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to > + * > + * (linux scsi_host_template.eh_target_reset_handler routine) > + * > + * Returns SUCCESS or FAILED. > + **/ > +int > +mptscsih_target_reset(struct scsi_cmnd * SCpnt) > +{ > + MPT_SCSI_HOST *hd; > + int retval; > + VirtDevice *vdevice; > + MPT_ADAPTER *ioc; > + > /* If we can't locate our host adapter structure, return FAILED status. > */ > if ((hd = shost_priv(SCpnt->device->host)) == NULL){ > @@ -3257,6 +3309,7 @@ EXPORT_SYMBOL(mptscsih_slave_destroy); > EXPORT_SYMBOL(mptscsih_slave_configure); > EXPORT_SYMBOL(mptscsih_abort); > EXPORT_SYMBOL(mptscsih_dev_reset); > +EXPORT_SYMBOL(mptscsih_target_reset); > EXPORT_SYMBOL(mptscsih_bus_reset); > EXPORT_SYMBOL(mptscsih_host_reset); > EXPORT_SYMBOL(mptscsih_bios_param); > diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h > index a22c5eaf703c..e3d92c392673 100644 > --- a/drivers/message/fusion/mptscsih.h > +++ b/drivers/message/fusion/mptscsih.h > @@ -120,6 +120,7 @@ extern void mptscsih_slave_destroy(struct scsi_device *device); > extern int mptscsih_slave_configure(struct scsi_device *device); > extern int mptscsih_abort(struct scsi_cmnd * SCpnt); > extern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt); > +extern int mptscsih_target_reset(struct scsi_cmnd * SCpnt); > extern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt); > extern int mptscsih_host_reset(struct scsi_cmnd *SCpnt); > extern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]); > -- > 2.29.2 >
On 5/19/22 19:27, Ewan Milne wrote: > This patch appears to change the EH activity from issuing a target > reset to a LUN reset only > (since it does not add an entry in the host templates for > .eh_target_reset_handler to invoke > the new mptscsih_target_reset() function, nor does any other patch in > the series). > > Is this going to work properly, and without escalating to a host reset > which might not have happened before? > You are correct, the drivers need to be changed to refer to target_reset now. Will be fixing it with the next version. Cheers, Hannes
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 276084ed04a6..ed21cc4d2c77 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1794,7 +1794,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /** - * mptscsih_dev_reset - Perform a SCSI TARGET_RESET! new_eh variant + * mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET! * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to * * (linux scsi_host_template.eh_dev_reset_handler routine) @@ -1809,6 +1809,58 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) VirtDevice *vdevice; MPT_ADAPTER *ioc; + /* If we can't locate our host adapter structure, return FAILED status. + */ + if ((hd = shost_priv(SCpnt->device->host)) == NULL){ + printk(KERN_ERR MYNAM ": lun reset: " + "Can't locate host! (sc=%p)\n", SCpnt); + return FAILED; + } + + ioc = hd->ioc; + printk(MYIOC_s_INFO_FMT "attempting lun reset! (sc=%p)\n", + ioc->name, SCpnt); + scsi_print_command(SCpnt); + + vdevice = SCpnt->device->hostdata; + if (!vdevice || !vdevice->vtarget) { + retval = 0; + goto out; + } + + retval = mptscsih_IssueTaskMgmt(hd, + MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET, + vdevice->vtarget->channel, + vdevice->vtarget->id, vdevice->lun, 0, + mptscsih_get_tm_timeout(ioc)); + + out: + printk (MYIOC_s_INFO_FMT "lun reset: %s (sc=%p)\n", + ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); + + if (retval == 0) + return SUCCESS; + else + return FAILED; +} + +/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +/** + * mptscsih_target_reset - Perform a SCSI TARGET_RESET! + * @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to + * + * (linux scsi_host_template.eh_target_reset_handler routine) + * + * Returns SUCCESS or FAILED. + **/ +int +mptscsih_target_reset(struct scsi_cmnd * SCpnt) +{ + MPT_SCSI_HOST *hd; + int retval; + VirtDevice *vdevice; + MPT_ADAPTER *ioc; + /* If we can't locate our host adapter structure, return FAILED status. */ if ((hd = shost_priv(SCpnt->device->host)) == NULL){ @@ -3257,6 +3309,7 @@ EXPORT_SYMBOL(mptscsih_slave_destroy); EXPORT_SYMBOL(mptscsih_slave_configure); EXPORT_SYMBOL(mptscsih_abort); EXPORT_SYMBOL(mptscsih_dev_reset); +EXPORT_SYMBOL(mptscsih_target_reset); EXPORT_SYMBOL(mptscsih_bus_reset); EXPORT_SYMBOL(mptscsih_host_reset); EXPORT_SYMBOL(mptscsih_bios_param); diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index a22c5eaf703c..e3d92c392673 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h @@ -120,6 +120,7 @@ extern void mptscsih_slave_destroy(struct scsi_device *device); extern int mptscsih_slave_configure(struct scsi_device *device); extern int mptscsih_abort(struct scsi_cmnd * SCpnt); extern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt); +extern int mptscsih_target_reset(struct scsi_cmnd * SCpnt); extern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt); extern int mptscsih_host_reset(struct scsi_cmnd *SCpnt); extern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]);