Skip to contentSkip to conversation

scsi_transport_fc: return -EBUSY for deleted vport

PATCH Applied Hannes Reinecke 2 participants 2 messages Jul 24, 2017 – Jul 25, 2017 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_transport_fc: return -EBUSY for deleted vport

When trying to delete a vport via 'vport_delete' sysfs attribute we should be checking if the port is already in state VPORT_DELETING; if so there's no need to do anything.

---
 drivers/scsi/scsi_transport_fc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/scsi_transport_fc.c +4 -2
index 6dd0922..ec9837e 100644
@@ -1286,7 +1286,7 @@ static FC_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR,
 	unsigned long flags;
 
 	spin_lock_irqsave(shost->host_lock, flags);
-	if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) {
+	if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING | FC_VPORT_DELETING)) {
 		spin_unlock_irqrestore(shost->host_lock, flags);
 		return -EBUSY;
 	}
@@ -2430,8 +2430,10 @@ void fc_release_transport(struct scsi_transport_template *t)
 	spin_lock_irqsave(shost->host_lock, flags);
 
 	/* Remove any vports */
-	list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers)
+	list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
+		vport->flags |= FC_VPORT_DELETING;
 		fc_queue_work(shost, &vport->vport_delete_work);
+	}
 
 	/* Remove any remote ports */
 	list_for_each_entry_safe(rport, next_rport,
Signature · 1 line
1.8.5.6
#1 lore raw

Hannes,

Quoted 3 lines

When trying to delete a vport via 'vport_delete' sysfs attribute we should be checking if the port is already in state VPORT_DELETING; if so there's no need to do anything.

Applied to 4.13/scsi-fixes. Thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering