Commit 3688feb5 authored by James Smart's avatar James Smart Committed by Jens Axboe

nvmet-fc: on port remove call put outside lock

Avoid calling the put routine, as it may traverse to free routines while
holding the target lock.
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e4d753d7
...@@ -2530,13 +2530,17 @@ nvmet_fc_remove_port(struct nvmet_port *port) ...@@ -2530,13 +2530,17 @@ nvmet_fc_remove_port(struct nvmet_port *port)
{ {
struct nvmet_fc_tgtport *tgtport = port->priv; struct nvmet_fc_tgtport *tgtport = port->priv;
unsigned long flags; unsigned long flags;
bool matched = false;
spin_lock_irqsave(&nvmet_fc_tgtlock, flags); spin_lock_irqsave(&nvmet_fc_tgtlock, flags);
if (tgtport->port == port) { if (tgtport->port == port) {
nvmet_fc_tgtport_put(tgtport); matched = true;
tgtport->port = NULL; tgtport->port = NULL;
} }
spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags); spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags);
if (matched)
nvmet_fc_tgtport_put(tgtport);
} }
static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = {
......
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