Skip to content

Commit e662908

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: message: fusion: Correct definitions for mptscsih_dev_reset()
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.de> Link: https://lore.kernel.org/r/20231002154328.43718-3-hare@suse.de Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d9987d4 commit e662908

2 files changed

Lines changed: 55 additions & 1 deletion

File tree

drivers/message/fusion/mptscsih.c

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
17931793

17941794
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
17951795
/**
1796-
* mptscsih_dev_reset - Perform a SCSI TARGET_RESET! new_eh variant
1796+
* mptscsih_dev_reset - Perform a SCSI LOGICAL_UNIT_RESET!
17971797
* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
17981798
*
17991799
* (linux scsi_host_template.eh_dev_reset_handler routine)
@@ -1808,6 +1808,58 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
18081808
VirtDevice *vdevice;
18091809
MPT_ADAPTER *ioc;
18101810

1811+
/* If we can't locate our host adapter structure, return FAILED status.
1812+
*/
1813+
if ((hd = shost_priv(SCpnt->device->host)) == NULL){
1814+
printk(KERN_ERR MYNAM ": lun reset: "
1815+
"Can't locate host! (sc=%p)\n", SCpnt);
1816+
return FAILED;
1817+
}
1818+
1819+
ioc = hd->ioc;
1820+
printk(MYIOC_s_INFO_FMT "attempting lun reset! (sc=%p)\n",
1821+
ioc->name, SCpnt);
1822+
scsi_print_command(SCpnt);
1823+
1824+
vdevice = SCpnt->device->hostdata;
1825+
if (!vdevice || !vdevice->vtarget) {
1826+
retval = 0;
1827+
goto out;
1828+
}
1829+
1830+
retval = mptscsih_IssueTaskMgmt(hd,
1831+
MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET,
1832+
vdevice->vtarget->channel,
1833+
vdevice->vtarget->id, vdevice->lun, 0,
1834+
mptscsih_get_tm_timeout(ioc));
1835+
1836+
out:
1837+
printk (MYIOC_s_INFO_FMT "lun reset: %s (sc=%p)\n",
1838+
ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
1839+
1840+
if (retval == 0)
1841+
return SUCCESS;
1842+
else
1843+
return FAILED;
1844+
}
1845+
1846+
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1847+
/**
1848+
* mptscsih_target_reset - Perform a SCSI TARGET_RESET!
1849+
* @SCpnt: Pointer to scsi_cmnd structure, IO which reset is due to
1850+
*
1851+
* (linux scsi_host_template.eh_target_reset_handler routine)
1852+
*
1853+
* Returns SUCCESS or FAILED.
1854+
**/
1855+
int
1856+
mptscsih_target_reset(struct scsi_cmnd * SCpnt)
1857+
{
1858+
MPT_SCSI_HOST *hd;
1859+
int retval;
1860+
VirtDevice *vdevice;
1861+
MPT_ADAPTER *ioc;
1862+
18111863
/* If we can't locate our host adapter structure, return FAILED status.
18121864
*/
18131865
if ((hd = shost_priv(SCpnt->device->host)) == NULL){
@@ -3256,6 +3308,7 @@ EXPORT_SYMBOL(mptscsih_slave_destroy);
32563308
EXPORT_SYMBOL(mptscsih_slave_configure);
32573309
EXPORT_SYMBOL(mptscsih_abort);
32583310
EXPORT_SYMBOL(mptscsih_dev_reset);
3311+
EXPORT_SYMBOL(mptscsih_target_reset);
32593312
EXPORT_SYMBOL(mptscsih_bus_reset);
32603313
EXPORT_SYMBOL(mptscsih_host_reset);
32613314
EXPORT_SYMBOL(mptscsih_bios_param);

drivers/message/fusion/mptscsih.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ extern void mptscsih_slave_destroy(struct scsi_device *device);
120120
extern int mptscsih_slave_configure(struct scsi_device *device);
121121
extern int mptscsih_abort(struct scsi_cmnd * SCpnt);
122122
extern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt);
123+
extern int mptscsih_target_reset(struct scsi_cmnd * SCpnt);
123124
extern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt);
124125
extern int mptscsih_host_reset(struct scsi_cmnd *SCpnt);
125126
extern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]);

0 commit comments

Comments
 (0)