Commit 2d97f463 authored by Chuck Lever's avatar Chuck Lever Committed by Anna Schumaker

xprtrdma: Use re_connect_status safely in rpcrdma_xprt_connect()

Clean up: Sometimes creating a fresh rpcrdma_ep can fail. That's why
xprt_rdma_connect() always checks if the r_xprt->rx_ep pointer is
valid before dereferencing it. Instead, xprt_rdma_connect() can
simply check rpcrdma_xprt_connect()'s return value.

Also, there's no need to set re_connect_status to zero just after
the rpcrdma_ep is created, since it is allocated with kzalloc.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 2acc5cae
...@@ -242,7 +242,7 @@ xprt_rdma_connect_worker(struct work_struct *work) ...@@ -242,7 +242,7 @@ xprt_rdma_connect_worker(struct work_struct *work)
rc = rpcrdma_xprt_connect(r_xprt); rc = rpcrdma_xprt_connect(r_xprt);
xprt_clear_connecting(xprt); xprt_clear_connecting(xprt);
if (r_xprt->rx_ep && r_xprt->rx_ep->re_connect_status > 0) { if (!rc) {
xprt->connect_cookie++; xprt->connect_cookie++;
xprt->stat.connect_count++; xprt->stat.connect_count++;
xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_time += (long)jiffies -
......
...@@ -528,7 +528,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -528,7 +528,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
return rc; return rc;
ep = r_xprt->rx_ep; ep = r_xprt->rx_ep;
ep->re_connect_status = 0;
xprt_clear_connected(xprt); xprt_clear_connected(xprt);
rpcrdma_reset_cwnd(r_xprt); rpcrdma_reset_cwnd(r_xprt);
...@@ -565,8 +564,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) ...@@ -565,8 +564,6 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt)
rpcrdma_mrs_create(r_xprt); rpcrdma_mrs_create(r_xprt);
out: out:
if (rc)
ep->re_connect_status = rc;
trace_xprtrdma_connect(r_xprt, rc); trace_xprtrdma_connect(r_xprt, rc);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment