Re: [PATCH RFC] nvme: fix NS head cdev lifetime

Christoph Hellwig <[email protected]>
Newsgroups org.infradead.lists.linux-nvme
Message-ID <[email protected]>
On Wed, Jul 08, 2026 at 10:57:02AM +0100, John Garry wrote:
> If we put the nvne_ns_head (vs nvme_ns) in the driver data, then I can't 
> see a check to know is the driver data points to a nvne_ns_head or nvme_ns. 
> Unless we keep NULL for one, but that is not so nice.

I think NULL just for one is fine, and I'm pretty sure we already do
something like this in the nvme code (or at least used to in the
past).

>
>> but shouldn't we warn for the nvme_tryget_ns_head failure as well?
>> Or can that even happen here?
>>
> It should not happen as we have a pointer to nvme_ns_head. If the recount 
> was zero and we referenced ns_head, then we have bigger problems.

That's what I though, so we could do a plain kref_get here.
And maybe replace the annoying krefs with a plain refcount_t one day.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.