Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] libsas: don't recover end devices attached to disabled phys

If userspace has decided to disable a phy the kernel should honor that
and not inadvertantly re-enable the phy via error recovery. This is
more straightforward in the sata case where link recovery (via
libata-eh) is separate from sas_task cancelling in libsas-eh. Teach
libsas to accept -ENODEV as a successful response from I_T_nexus_reset
('successful' in terms of not escalating further).

This is a more comprehensive fix then "libsas: don't recover 'gone'
devices in sas_ata_hard_reset()", as it is no longer sata-specific.

aic94xx does check the return value from sas_phy_reset() so if the phy
is disabled we proceed with clearing the I_T_nexus.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Dan Williams and committed by
James Bottomley
26a2e68f 77c309f3

+8 -5
+1 -1
drivers/scsi/aic94xx/aic94xx_tmf.c
··· 192 192 ASD_DPRINTK("sending %s reset to %s\n", 193 193 reset_type ? "hard" : "soft", dev_name(&phy->dev)); 194 194 res = sas_phy_reset(phy, reset_type); 195 - if (res == TMF_RESP_FUNC_COMPLETE) { 195 + if (res == TMF_RESP_FUNC_COMPLETE || res == -ENODEV) { 196 196 /* wait for the maximum settle time */ 197 197 msleep(500); 198 198 /* clear all outstanding commands (keep nexus suspended) */
+2 -3
drivers/scsi/libsas/sas_ata.c
··· 407 407 struct domain_device *dev = ap->private_data; 408 408 struct sas_internal *i = dev_to_sas_internal(dev); 409 409 410 - if (test_bit(SAS_DEV_GONE, &dev->state)) 411 - return -ENODEV; 412 - 413 410 res = i->dft->lldd_I_T_nexus_reset(dev); 411 + if (res == -ENODEV) 412 + return res; 414 413 415 414 if (res != TMF_RESP_FUNC_COMPLETE) 416 415 sas_ata_printk(KERN_DEBUG, dev, "Unable to reset ata device?\n");
+3
drivers/scsi/libsas/sas_init.c
··· 298 298 int ret; 299 299 enum phy_func reset_type; 300 300 301 + if (!phy->enabled) 302 + return -ENODEV; 303 + 301 304 if (hard_reset) 302 305 reset_type = PHY_FUNC_HARD_RESET; 303 306 else
+2 -1
drivers/scsi/libsas/sas_scsi_host.c
··· 607 607 SAS_DPRINTK("task 0x%p is not at LU: I_T recover\n", 608 608 task); 609 609 tmf_resp = sas_recover_I_T(task->dev); 610 - if (tmf_resp == TMF_RESP_FUNC_COMPLETE) { 610 + if (tmf_resp == TMF_RESP_FUNC_COMPLETE || 611 + tmf_resp == -ENODEV) { 611 612 struct domain_device *dev = task->dev; 612 613 SAS_DPRINTK("I_T %016llx recovered\n", 613 614 SAS_ADDR(task->dev->sas_addr));