[PATCH v2] nvme: fix cdev lifetime
John Garry
john.g.garry at oracle.com
Mon Jul 13 02:46:26 PDT 2026
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)
More information about the Linux-nvme
mailing list