Re: [PATCH 02/11] nvmet-fcloop: add ref counting to lport
From: Christoph Hellwig
Date: Wed Mar 05 2025 - 09:18:01 EST
On Wed, Feb 26, 2025 at 07:45:54PM +0100, Daniel Wagner wrote:
> +static void
> +fcloop_lport_free(struct kref *ref)
> +{
> + struct fcloop_lport *lport =
> + container_of(ref, struct fcloop_lport, ref);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&fcloop_lock, flags);
> + list_del(&lport->lport_list);
> + spin_unlock_irqrestore(&fcloop_lock, flags);
> +
> + kfree(lport);
Maybe it's just me, but I find the kref a really horrible pattern over
usig a simple refcount_t.
Otherwise adding proper refcounting looks fine.