[PATCH 05/11] nvmet-fcloop: track tport with ref counting
Daniel Wagner
dwagner at suse.de
Fri Feb 28 06:31:22 PST 2025
On Fri, Feb 28, 2025 at 09:30:42AM +0100, Daniel Wagner wrote:
> On Fri, Feb 28, 2025 at 08:27:40AM +0100, Hannes Reinecke wrote:
> > > if (!tport->remoteport) {
> > > tls_req->status = -ECONNREFUSED;
> > > spin_lock(&tport->lock);
> > > list_add_tail(&tls_req->ls_list, &tport->ls_list);
> > > spin_unlock(&tport->lock);
> > > - queue_work(nvmet_wq, &tport->ls_work);
> > > + if (queue_work(nvmet_wq, &tport->ls_work))
> > > + fcloop_tport_get(tport);
> >
> > Don't you need to remove the 'tls_req' from the list, too, seeing that
> > it'll never be transferred?
>
> Good point. I'll add the error handling.
In fact, I think a WARN_ONCE is the better choice here, as the element
should not be on the list (an error in the code) and queue_work will only
return false if the work item is already scheduled.
More information about the Linux-nvme
mailing list