Re: [PATCH] librdmacm: Return errno on create_qp failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 26, 2018 at 08:28:32PM +0300, Yuval Shaia wrote:
> On Mon, Mar 26, 2018 at 08:09:22PM +0300, Leon Romanovsky wrote:
> > On Mon, Mar 26, 2018 at 09:30:07AM -0600, Jason Gunthorpe wrote:
> > > On Mon, Mar 26, 2018 at 04:44:35PM +0300, Leon Romanovsky wrote:
> > > > On Sun, Mar 25, 2018 at 11:09:02PM +0300, Yuval Shaia wrote:
> > > > > Upon QP creation failure provider's create_qp function sets errno with
> > > > > error code and return NULL to caller.
> > > > >
> > > > > Let's return this errno to caller to reflect the exact reason for the
> > > > > error.
> > > > >
> > > > > Signed-off-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
> > > > >  librdmacm/cma.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/librdmacm/cma.c b/librdmacm/cma.c
> > > > > index fa370650..e92a022c 100644
> > > > > +++ b/librdmacm/cma.c
> > > > > @@ -1369,7 +1369,7 @@ int rdma_create_qp_ex(struct rdma_cm_id *id,
> > > > >  		attr->srq = id->srq;
> > > > >  	qp = ibv_create_qp_ex(id->verbs, attr);
> > > > >  	if (!qp) {
> > > > > -		ret = ERR(ENOMEM);
> > > > > +		ret = ERR(errno);
> > > >
> > > > It is not always correct, for example
> > > > ibv_create_qp_ex -> ibv_create_qp -> pd->context->ops.create_qp ->
> > > > mlx5_create_qp -> create_qp -> can return NULL without updating errno.
> > >
> > > That is a driver bug..
> > 
> > It was an example, does patch author go to check and update ALL paths in
> > all drivers?
> 
> No, only at specific scenario in mlx5.
> 
> ibv_create_qp_ex -> ibv_create_qp -> pd->context->ops.create_qp ->
> mlx5_create_qp -> create_qp -> mlx5_calc_wq_size -> mlx5_calc_sq_size which
> returns -EINVAL that was lost by rdma_create_qp_ex which eventually reports
> the user that there is some memory problem.

We don't have to fix every driver before fixing the common code.

Drivers are supposed to return errno, I'm sure lots and lots of them
have paths where they fail to do this.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux