From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3819D1519BD for ; Wed, 5 Mar 2025 14:17:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741184265; cv=none; b=aZFzFwTYPvJslZSn6sJNms249Lm49XYxZGBpMnJeaeHmqrmxL7SkARPMLtwoFIDps0PV14OJEs6xmVuDhKsfbIWFDnpQ3QnmbKEZcaGX4Dsb5oxxzllUDc/JpeTBgCRYsuDdXJTsRr6j8qjAcz4XiY0PMy3p6nx/rgGW0MU2vCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741184265; c=relaxed/simple; bh=eziZRf8ASee90hLp9xUQFCBux87w7fRv7r5l06eJlk4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=riG6LVrRzGUPVI1KB8iU73vzyF8wVgXYNEmQE1PxdEsvYRgoz/5pRRbkxoTAcfLjgC2kYYZVix3VvDB+EJwkMTGUKqGpufh1EyPB1Ek7YJBeZhyHdRnLYPVnveaymwYxMQBs1ZFUflYR9+9h8IbVk/iheoXOprTThibmGDLkzms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 753F068C7B; Wed, 5 Mar 2025 15:17:40 +0100 (CET) Date: Wed, 5 Mar 2025 15:17:40 +0100 From: Christoph Hellwig To: Daniel Wagner Cc: James Smart , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Hannes Reinecke , Keith Busch , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/11] nvmet-fcloop: add ref counting to lport Message-ID: <20250305141740.GC18065@lst.de> References: <20250226-nvmet-fcloop-v1-0-c0bd83d43e6a@kernel.org> <20250226-nvmet-fcloop-v1-2-c0bd83d43e6a@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250226-nvmet-fcloop-v1-2-c0bd83d43e6a@kernel.org> User-Agent: Mutt/1.5.17 (2007-11-01) 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.