[PATCH 04/11] nvmet-fcloop: track ref counts for nports

Daniel Wagner dwagner at suse.de
Fri Feb 28 00:18:44 PST 2025


On Fri, Feb 28, 2025 at 08:19:19AM +0100, Hannes Reinecke wrote:
> >   static int
> >   __targetport_unreg(struct fcloop_nport *nport, struct fcloop_tport *tport)
> >   {
> > -	if (!tport)
> > -		return -EALREADY;
> > +	int ret;
> That's iffy.
> Q1: How can you end up with a NULL tport?

The existing code doesn't get the life time right. I don't think it's
necessary anymore. This gets removed in the next two patches.

> Q2: Why do we have _two_ arguments? Can't we use 'nport->tport'?

This is addressed when the rport and tport get their own ref counting
(next two patches).

> Q3: What do you do when tport is valid and tport != nport->tport?

That is not going to happen after the full series.

I've tried to keep the changes logically separated. This patch here is
only updating the nport ref counters. It took a long time to get these
changes into a readable state. I really would like to avoid doing to
many things in one patch.



More information about the Linux-nvme mailing list