[PATCH RFC] nvme: fix NS head cdev lifetime
Christoph Hellwig
hch at lst.de
Wed Jul 8 09:18:46 PDT 2026
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.
More information about the Linux-nvme
mailing list