[PATCH WIP/RFC 3/6] nvme_rdma: keep a ref on the ctrl during delete/flush

Steve Wise swise at opengridcomputing.com
Fri Aug 26 07:41:32 PDT 2016


> 
> This looks good to me:
> 
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> 
> Minor nitpick in case you're going to respin it anyway:
> 
> > +	/*
> > +	 * Keep a reference until all work is flushed since
> > +	 * __nvme_rdma_del_ctrl can free the ctrl mem
> > +	 */
> > +	kref_get(&ctrl->ctrl.kref);
> >
> >  	ret = __nvme_rdma_del_ctrl(ctrl);
> >  	if (ret)
> > -		return ret;
> > +		goto out;
> >
> >  	flush_work(&ctrl->delete_work);
> > -
> > -	return 0;
> > +out:
> > +	nvme_put_ctrl(&ctrl->ctrl);
> > +	return ret;
> 
> How about:
> 
> 	kref_get(&ctrl->ctrl.kref);
> 	ret = __nvme_rdma_del_ctrl(ctrl);
> 	if (!ret)
> 		flush_work(&ctrl->delete_work);
> 	nvme_put_ctrl(&ctrl->ctrl);
> 	return ret;
> 
> here?

That looks cleaner.




More information about the Linux-nvme mailing list