[PATCH] nvme: free pre-allocated queue if create ioq goes wrong

Sagi Grimberg sagi at grimberg.me
Sun Jan 14 08:24:42 PST 2018



On 01/14/2018 11:41 AM, Minwoo Im wrote:
> Sagi,
> 
> On Sun, Jan 14, 2018 at 6:18 PM, Sagi Grimberg <sagi at grimberg.me> wrote:
>> Minwoo,
>>
>>> If either create-sq or create-cq is failed with an NVMe status,
>>> nvme_init_queue() is invoked which was not expected to be called in
>>> nvme_create_queue().
>>> To prevent this inconsistency of queue_count, free queue(s) already
>>> allocated in nvme_create_io_queues() when it goes wrong in
>>> nvme_create_queue().
>>
>>
>> The fix looks good, but I think it would be better to cleanup the queue
>> in the call site where nvme_alloc_queue is called, having it here is a
>> bit awkward IMO.
> 
> Thanks for your kind review.
> 
> I agree with that allocation and freeing should be in the same place
> because it looks much more consistent in code.
> 
> What about below code?

Looks better, please send a proper patch, thanks.



More information about the Linux-nvme mailing list