diff options
author | James Smart <jsmart2021@gmail.com> | 2017-09-20 01:13:11 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-09-25 21:42:11 +0300 |
commit | 3688feb582a1bc4e58ad50f5eccfdb90615de27b (patch) | |
tree | 558dcb80c86311579b084d9533d29f08cdc4d023 | |
parent | e4d753d7e51c0648b9ee33efeed55d45f362fc3d (diff) | |
download | linux-3688feb582a1bc4e58ad50f5eccfdb90615de27b.tar.xz |
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: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/nvme/target/fc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index c48c83d97e30..6850672ad2a2 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -2530,13 +2530,17 @@ nvmet_fc_remove_port(struct nvmet_port *port) { struct nvmet_fc_tgtport *tgtport = port->priv; unsigned long flags; + bool matched = false; spin_lock_irqsave(&nvmet_fc_tgtlock, flags); if (tgtport->port == port) { - nvmet_fc_tgtport_put(tgtport); + matched = true; tgtport->port = NULL; } spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags); + + if (matched) + nvmet_fc_tgtport_put(tgtport); } static struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { |