Re: [PATCH v2] nvme: fix cdev lifetime

John Garry <[email protected]>
Newsgroups org.infradead.lists.linux-nvme
Organization Oracle Corporation
Message-ID <[email protected]>
On 13/07/2026 10:30, Christoph Hellwig wrote:
>>   	.compat_ioctl	= compat_ptr_ioctl,
>>   	.uring_cmd	= nvme_ns_head_chr_uring_cmd,
>> @@ -666,10 +646,12 @@ static void nvme_add_ns_head_cdev(struct nvme_ns_head *head)
>>   	snprintf(name, sizeof(name), "ng%dn%d", head->subsys->instance,
>>   		 head->instance);
>>   
>> +	nvme_tryget_ns_head(head); /* Undone in nvme_cdev_rel() */
> I think we need to do a real get and not a tryget here.
> 

ok, np.

Then I am going to propose adding nvme_get_ns_head() also. It can be 
used elsewhere and it would match better with nvme_put_ns_head() (rather 
than using kref_fget(&head->kref) here)
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.