提交 5ae711a2 编写于 作者: C Chuck Lever 提交者: Anna Schumaker

xprtrdma: Free the pd if ib_query_qp() fails

If ib_query_qp() fails or the memory registration mode isn't
supported, don't leak the PD. An orphaned IB/core resource will
cause IB module removal to hang.

Fixes: bd7ed1d1 ("RPC/RDMA: check selected memory registration ...")
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Reviewed-by: NSteve Wise <swise@opengridcomputing.com>
Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
上级 afadc468
...@@ -614,7 +614,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) ...@@ -614,7 +614,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
if (rc) { if (rc) {
dprintk("RPC: %s: ib_query_device failed %d\n", dprintk("RPC: %s: ib_query_device failed %d\n",
__func__, rc); __func__, rc);
goto out2; goto out3;
} }
if (devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) { if (devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) {
...@@ -672,14 +672,14 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) ...@@ -672,14 +672,14 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
"phys register failed with %lX\n", "phys register failed with %lX\n",
__func__, PTR_ERR(ia->ri_bind_mem)); __func__, PTR_ERR(ia->ri_bind_mem));
rc = -ENOMEM; rc = -ENOMEM;
goto out2; goto out3;
} }
break; break;
default: default:
printk(KERN_ERR "RPC: Unsupported memory " printk(KERN_ERR "RPC: Unsupported memory "
"registration mode: %d\n", memreg); "registration mode: %d\n", memreg);
rc = -ENOMEM; rc = -ENOMEM;
goto out2; goto out3;
} }
dprintk("RPC: %s: memory registration strategy is %d\n", dprintk("RPC: %s: memory registration strategy is %d\n",
__func__, memreg); __func__, memreg);
...@@ -689,6 +689,10 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) ...@@ -689,6 +689,10 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
rwlock_init(&ia->ri_qplock); rwlock_init(&ia->ri_qplock);
return 0; return 0;
out3:
ib_dealloc_pd(ia->ri_pd);
ia->ri_pd = NULL;
out2: out2:
rdma_destroy_id(ia->ri_id); rdma_destroy_id(ia->ri_id);
ia->ri_id = NULL; ia->ri_id = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册