mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: Hannes Reinecke <hare@suse.de>
Cc: Daniel Wagner <wagi@kernel.org>,
	 James Smart <james.smart@broadcom.com>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	 Chaitanya Kulkarni <kch@nvidia.com>,
	Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 01/14] nvmet-fcloop: track ref counts for nports
Date: Thu, 8 May 2025 12:06:46 +0200	[thread overview]
Message-ID: <a42eca0f-8a13-443e-a380-86609d88b4ee@flourine.local> (raw)
In-Reply-To: <4d262ac0-f27c-44d4-82c0-f50b31be606e@suse.de>

On Wed, May 07, 2025 at 03:50:30PM +0200, Hannes Reinecke wrote:
> > +	spin_lock_irqsave(&fcloop_lock, flags);
> > +	tport = __unlink_target_port(nport);
> >   	spin_unlock_irqrestore(&fcloop_lock, flags);
> > -	if (!nport)
> > -		return -ENOENT;
> > +	if (!tport) {
> > +		ret = -ENOENT;
> > +		goto out_nport_put;
> > +	}
> >   	ret = __targetport_unreg(nport, tport);
> 
> The lock needs to extend across both lookup and unlink,
> ie don't drop the lock in between.

No, this wont wor. There will be a nested lock in
nvmet_fc_unregister_targetport. The lock only protects the list
insert/delete/iterate operations not anything else.

FWIW, this is hasn't changed the unregister step was already done uside
the lock.

BTW, I've played with turning the spin lock into a mutex as there
doesn't seem to be any necessity to use a spin lock then we could in
theory keep the lock over the whole section but this is something I
would leave for the future.

  reply	other threads:[~2025-05-08 10:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 12:22 [PATCH v6 00/14] nvmet-fcloop: track resources via reference counting Daniel Wagner
2025-05-07 12:22 ` [PATCH v6 01/14] nvmet-fcloop: track ref counts for nports Daniel Wagner
2025-05-07 13:50   ` Hannes Reinecke
2025-05-08 10:06     ` Daniel Wagner [this message]
2025-05-07 12:22 ` [PATCH v6 02/14] nvmet-fcloop: remove nport from list on last user Daniel Wagner
2025-05-07 12:22 ` [PATCH v6 03/14] nvmet-fcloop: refactor fcloop_nport_alloc and track lport Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 04/14] nvmet-fcloop: refactor fcloop_delete_local_port Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 05/14] nvmet-fcloop: update refs on tfcp_req Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 06/14] nvmet-fcloop: add missing fcloop_callback_host_done Daniel Wagner
2025-05-07 13:51   ` Hannes Reinecke
2025-05-07 12:23 ` [PATCH v6 07/14] nvmet-fcloop: access fcpreq only when holding reqlock Daniel Wagner
2025-05-07 13:52   ` Hannes Reinecke
2025-05-07 12:23 ` [PATCH v6 08/14] nvmet-fcloop: prevent double port deletion Daniel Wagner
2025-05-07 13:59   ` Hannes Reinecke
2025-05-07 12:23 ` [PATCH v6 09/14] nvmet-fcloop: allocate/free fcloop_lsreq directly Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 10/14] nvmet-fcloop: don't wait for lport cleanup Daniel Wagner
2025-05-07 13:59   ` Hannes Reinecke
2025-05-07 12:23 ` [PATCH v6 11/14] nvmet-fcloop: drop response if targetport is gone Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 12/14] nvmet-fc: free pending reqs on tgtport unregister Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 13/14] nvmet-fc: take tgtport refs for portentry Daniel Wagner
2025-05-07 12:23 ` [PATCH v6 14/14] nvme-fc: do not reference lsrsp after failure Daniel Wagner
2025-05-07 14:00   ` Hannes Reinecke
2025-05-12 14:16 ` [PATCH v6 00/14] nvmet-fcloop: track resources via reference counting Christoph Hellwig

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=a42eca0f-8a13-443e-a380-86609d88b4ee@flourine.local \
    --to=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=james.smart@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=wagi@kernel.org \
    /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

all inboxes | Powered by JetHome®