]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nvmet-fc: on port remove call put outside lock
authorJames Smart <jsmart2021@gmail.com>
Tue, 19 Sep 2017 22:13:11 +0000 (15:13 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Sep 2017 18:42:11 +0000 (12:42 -0600)
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>
drivers/nvme/target/fc.c

index c48c83d97e304169185ddfad622bed93155e0412..6850672ad2a2ae16c378a30b04e6ddc7ece5b1a6 100644 (file)
@@ -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 = {