public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi_transport_fc: return -EBUSY for deleted vport
@ 2017-07-24 10:09 Hannes Reinecke
  2017-07-25  2:17 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2017-07-24 10:09 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: James Smart, Christoph Hellwig, James Bottomley, linux-scsi,
	Hannes Reinecke

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: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/scsi_transport_fc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 6dd0922..ec9837e 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -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,
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi_transport_fc: return -EBUSY for deleted vport
  2017-07-24 10:09 [PATCH] scsi_transport_fc: return -EBUSY for deleted vport Hannes Reinecke
@ 2017-07-25  2:17 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2017-07-25  2:17 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, James Smart, Christoph Hellwig,
	James Bottomley, linux-scsi


Hannes,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-25  2:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 10:09 [PATCH] scsi_transport_fc: return -EBUSY for deleted vport Hannes Reinecke
2017-07-25  2:17 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox