[PATCH 1/2] nvmet: fix ctlr ref counting

James Smart james.smart at broadcom.com
Sat Sep 30 12:04:47 PDT 2017


On 9/30/2017 11:00 AM, Sagi Grimberg wrote:
>
>> Current code:
>> initializes the reference at allocation
>> increments reference when ctlr finds are done
>> has decrements to back out of ctlr finds
>> decrements in admin queue connect cmd failures to
>>    cause ctlr free
>> in nvmet_sq_destroy() decrements to cause ctlr free
>>
>> Issue is: nvmet_sq_destroy is called for every queue (admin and
>> io), thus the controller is freed upon the first queue termination.
>> It's an early "free". There could be other ctlr struct changes made
>> while subsequent queues are being torn down.
>
> This is not true, each sq takes a reference on the controller, so
> the controller is actually freed only on the _last_ sq destroy.

Looked at it again. And yeah - you are right. The get is by the find 
routine.
I've got to go look at this again.

-- james




More information about the Linux-nvme mailing list