Skip to contentSkip to conversation

scsi: libsas: Directly kick-off EH when ATA device fell off

PATCH Superseded Xingui Yang 2 participants 5 messages Dec 16, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: libsas: Directly kick-off EH when ATA device fell off

If the ATA device fell off, call sas_ata_device_link_abort() directly and mark all outstanding QCs as failed and kick-off EH Immediately. This avoids having to wait for block layer timeouts.

---
 drivers/scsi/libsas/sas_discover.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/scsi/libsas/sas_discover.c +5 -0
index d5bc1314c341..bd22741daa99 100644
@@ -362,6 +362,11 @@ static void sas_destruct_ports(struct asd_sas_port *port)
 
 void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
 {
+	if (test_bit(SAS_DEV_GONE, &dev->state) &&
+	    (dev->dev_type == SAS_SATA_DEV ||
+	    (dev->tproto & SAS_PROTOCOL_STP)))
+		sas_ata_device_link_abort(dev, false);
+
 	if (!test_bit(SAS_DEV_DESTROY, &dev->state) &&
 	    !list_empty(&dev->disco_list_node)) {
 		/* this rphy never saw sas_rphy_add */
Signature · 1 line
2.17.1
reviewer
#1 lore raw

Hi Xingui,

Quoted 4 lines · Xingui Yang

If the ATA device fell off, call sas_ata_device_link_abort() directly and mark all outstanding QCs as failed and kick-off EH Immediately. This avoids having to wait for block layer timeouts.

Why does ATA device need this special operation? SAS device does not have to wait for block layer timeouts?

Thanks,
Jason

Quoted 22 lines
---
  drivers/scsi/libsas/sas_discover.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/scsi/libsas/sas_discover.c +5 -0
index d5bc1314c341..bd22741daa99 100644
@@ -362,6 +362,11 @@ static void sas_destruct_ports(struct asd_sas_port *port)
 
  void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
  {
+	if (test_bit(SAS_DEV_GONE, &dev->state) &&
+	    (dev->dev_type == SAS_SATA_DEV ||
+	    (dev->tproto & SAS_PROTOCOL_STP)))
+		sas_ata_device_link_abort(dev, false);
+
  	if (!test_bit(SAS_DEV_DESTROY, &dev->state) &&
  	    !list_empty(&dev->disco_list_node)) {
  		/* this rphy never saw sas_rphy_add */
author
#2 lore raw
Quoted 9 lines · Jason Yan

Hi Xingui,

Quoted 4 lines · Xingui Yang

If the ATA device fell off, call sas_ata_device_link_abort() directly and mark all outstanding QCs as failed and kick-off EH Immediately. This avoids having to wait for block layer timeouts.

Why does ATA device need this special operation? SAS device does not have to wait for block layer timeouts?

Hi Jason,
Applications that depend on I/O return may be blocked for 30 seconds, and this can be optimized for SATA disks.

Different from SATA disks, I/Os on SAS disks can still be returned if they are quickly plugged in after the SAS disks fall off. So I'm not sure if this is appropriate for a sas disk. BTW, I wish the sas disk did the same.

Thanks,
Xingui

Quoted 27 lines

Thanks,
Jason

Quoted 18 lines

---
  drivers/scsi/libsas/sas_discover.c | 5 +++++

  1 file changed, 5 insertions(+)
drivers/scsi/libsas/sas_discover.c +5 -0
index d5bc1314c341..bd22741daa99 100644
@@ -362,6 +362,11 @@ static void sas_destruct_ports(struct 
 asd_sas_port *port)
   void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
   {
+    if (test_bit(SAS_DEV_GONE, &dev->state) &&
+        (dev->dev_type == SAS_SATA_DEV ||
+        (dev->tproto & SAS_PROTOCOL_STP)))
+        sas_ata_device_link_abort(dev, false);
+
Quoted 4 lines

      if (!test_bit(SAS_DEV_DESTROY, &dev->state) && !list_empty(&dev->disco_list_node)) { /* this rphy never saw sas_rphy_add */

.

reviewer
#3 lore raw
In reply to Xingui Yang
Quoted 14 lines · Xingui Yang

If the ATA device fell off, call sas_ata_device_link_abort() directly and mark all outstanding QCs as failed and kick-off EH Immediately. This avoids having to wait for block layer timeouts.

---
  drivers/scsi/libsas/sas_discover.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/scsi/libsas/sas_discover.c +0 -0
index d5bc1314c341..bd22741daa99 100644

drivers/scsi/libsas/sas_discover.c static void sas_destruct_ports(struct asd_sas_port *port) · line 367

Quoted 6 lines
drivers/scsi/libsas/sas_discover.c +3 -0
@@ -362,6 +362,11 @@ static void sas_destruct_ports(struct asd_sas_port *port)
 
  void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
  {
+	if (test_bit(SAS_DEV_GONE, &dev->state) &&
+	    (dev->dev_type == SAS_SATA_DEV ||
+	    (dev->tproto & SAS_PROTOCOL_STP)))

dev_is_sata() would be better here.

Thanks,
Jason

Quoted 6 lines
drivers/scsi/libsas/sas_discover.c +2 -0
+		sas_ata_device_link_abort(dev, false);
+
  	if (!test_bit(SAS_DEV_DESTROY, &dev->state) &&
  	    !list_empty(&dev->disco_list_node)) {
  		/* this rphy never saw sas_rphy_add */
author
#4 lore raw
Quoted 10 lines · Jason Yan
Quoted 9 lines · Xingui Yang

If the ATA device fell off, call sas_ata_device_link_abort() directly and mark all outstanding QCs as failed and kick-off EH Immediately. This avoids having to wait for block layer timeouts.

---
  drivers/scsi/libsas/sas_discover.c | 5 +++++

  1 file changed, 5 insertions(+)
Quoted 13 lines

drivers/scsi/libsas/sas_discover.c static void sas_destruct_ports(struct · line 367

Quoted 11 lines
drivers/scsi/libsas/sas_discover.c +3 -0
index d5bc1314c341..bd22741daa99 100644
@@ -362,6 +362,11 @@ static void sas_destruct_ports(struct 
 asd_sas_port *port)
   void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
   {
+    if (test_bit(SAS_DEV_GONE, &dev->state) &&
+        (dev->dev_type == SAS_SATA_DEV ||
+        (dev->tproto & SAS_PROTOCOL_STP)))

dev_is_sata() would be better here.

ok, Thanks for your advice.

Thanks,
Xingui

Quoted 11 lines

Thanks,
Jason

Quoted 6 lines
drivers/scsi/libsas/sas_discover.c +2 -0
+        sas_ata_device_link_abort(dev, false);
+

      if (!test_bit(SAS_DEV_DESTROY, &dev->state) && !list_empty(&dev->disco_list_node)) { /* this rphy never saw sas_rphy_add */

.