[PATCH 2/5] nvme-rdma: rework create_ctrl error flow
Christoph Hellwig
hch at lst.de
Mon Oct 23 07:32:55 PDT 2017
On Wed, Oct 18, 2017 at 02:07:41PM +0300, Sagi Grimberg wrote:
> From: Roy Shterman <roys at lightbitslabs.com>
>
> The magic ctrl refcount handling we have due to the asymmetric
> behavior in nvme_init/uninit_ctrl is making the controller
> creation error sequence a bit awkward and error prone as we
> rely on magic refcounting to invoke ->free_ctrl from create_ctrl
> error sequence.
>
> Now that we have nvme_init/uninit_ctrl doing the right thing, we
> can fix this by making the error sequence sane and simple (just
> undo what we did until the error).
>
> Also, allocate ctrl->queues before calling nvme_init_ctrl, just
> to separate the driver private resource allocation and the core
> resource allocations.
Once we did the init we'll have to do a put and not just free it.
That will become even more important when using a struct device for
refcounting the controller.
More information about the Linux-nvme
mailing list