Commit 260f4aed authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: 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.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 50292710
...@@ -1286,7 +1286,7 @@ store_fc_vport_delete(struct device *dev, struct device_attribute *attr, ...@@ -1286,7 +1286,7 @@ store_fc_vport_delete(struct device *dev, struct device_attribute *attr,
unsigned long flags; unsigned long flags;
spin_lock_irqsave(shost->host_lock, 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); spin_unlock_irqrestore(shost->host_lock, flags);
return -EBUSY; return -EBUSY;
} }
...@@ -2430,8 +2430,10 @@ fc_remove_host(struct Scsi_Host *shost) ...@@ -2430,8 +2430,10 @@ fc_remove_host(struct Scsi_Host *shost)
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
/* Remove any vports */ /* 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); fc_queue_work(shost, &vport->vport_delete_work);
}
/* Remove any remote ports */ /* Remove any remote ports */
list_for_each_entry_safe(rport, next_rport, list_for_each_entry_safe(rport, next_rport,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment