Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>,
	Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	James Smart <james.smart@broadcom.com>,
	linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 1/3] nvmet/fc: Sanitize tgtport reference counting for LS requests
Date: Tue, 10 Mar 2020 17:52:15 +0100	[thread overview]
Message-ID: <20200310165215.GA7034@lst.de> (raw)
In-Reply-To: <20200306130440.16864-2-hare@suse.de>

> @@ -482,14 +476,19 @@ nvmet_fc_xmt_disconnect_assoc(struct nvmet_fc_tgt_assoc *assoc)
>  	struct nvmefc_ls_req *lsreq;
>  	int ret;
>  
> +	if (!nvmet_fc_tgtport_get(tgtport))
> +		return;
> +
>  	/*
>  	 * If ls_req is NULL or no hosthandle, it's an older lldd and no
>  	 * message is normal. Otherwise, send unless the hostport has
>  	 * already been invalidated by the lldd.
>  	 */
>  	if (!tgtport->ops->ls_req || !assoc->hostport ||
> -	    assoc->hostport->invalid)
> +	    assoc->hostport->invalid) {
> +		nvmet_fc_tgtport_put(tgtport);
>  		return;
> +	}
>  
>  	lsop = kzalloc((sizeof(*lsop) +
>  			sizeof(*discon_rqst) + sizeof(*discon_acc) +
> @@ -498,6 +497,7 @@ nvmet_fc_xmt_disconnect_assoc(struct nvmet_fc_tgt_assoc *assoc)
>  		dev_info(tgtport->dev,
>  			"{%d:%d} send Disconnect Association failed: ENOMEM\n",
>  			tgtport->fc_target_port.port_num, assoc->a_id);
> +		nvmet_fc_tgtport_put(tgtport);
>  		return;
>  	}
>  
> @@ -522,6 +522,7 @@ nvmet_fc_xmt_disconnect_assoc(struct nvmet_fc_tgt_assoc *assoc)
>  			"{%d:%d} XMT Disconnect Association failed: %d\n",
>  			tgtport->fc_target_port.port_num, assoc->a_id, ret);
>  		kfree(lsop);
> +		nvmet_fc_tgtport_put(tgtport);

Can you consolidate all the calls in this function using goto
unwinding?

Otherwise looks good.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2020-03-10 16:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 13:04 [PATCH 0/3] nvmet/fcloop fixes Hannes Reinecke
2020-03-06 13:04 ` [PATCH 1/3] nvmet/fc: Sanitize tgtport reference counting for LS requests Hannes Reinecke
2020-03-06 22:11   ` Sagi Grimberg
2020-03-07  1:00   ` James Smart
2020-03-10 16:52   ` Christoph Hellwig [this message]
2020-03-06 13:04 ` [PATCH 2/3] nvme/fcloop: short-circuit LS requests if no association is present Hannes Reinecke
2020-03-06 22:12   ` Sagi Grimberg
2020-03-07  1:11   ` James Smart
2020-03-07  8:39     ` Hannes Reinecke
2020-03-06 13:04 ` [PATCH 3/3] nvme/fcloop: flush workqueue before calling nvme_fc_unregister_remoteport() Hannes Reinecke
2020-03-06 22:12   ` Sagi Grimberg
2020-03-07  1:12   ` James Smart
2020-03-07  8:41     ` Hannes Reinecke
2020-03-31 14:24 ` [PATCH 0/3] nvmet/fcloop fixes Christoph Hellwig
2020-04-16 10:37   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200310165215.GA7034@lst.de \
    --to=hch@lst.de \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=hare@suse.de \
    --cc=james.smart@broadcom.com \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox