sunrpc: Factor out rpc_xprt freeing

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
Pavel Emelyanov 2010-09-29 16:03:13 +04:00 committed by J. Bruce Fields
parent bd1722d431
commit e204e621b4
4 changed files with 14 additions and 13 deletions

View File

@ -281,6 +281,7 @@ void xprt_release(struct rpc_task *task);
struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
void xprt_put(struct rpc_xprt *xprt);
struct rpc_xprt * xprt_alloc(int size, int max_req);
void xprt_free(struct rpc_xprt *);
static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
{

View File

@ -984,6 +984,13 @@ out:
}
EXPORT_SYMBOL_GPL(xprt_alloc);
void xprt_free(struct rpc_xprt *xprt)
{
kfree(xprt->slot);
kfree(xprt);
}
EXPORT_SYMBOL_GPL(xprt_free);
/**
* xprt_reserve - allocate an RPC request slot
* @task: RPC task requesting a slot allocation

View File

@ -251,9 +251,7 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
xprt_rdma_free_addresses(xprt);
kfree(xprt->slot);
xprt->slot = NULL;
kfree(xprt);
xprt_free(xprt);
dprintk("RPC: %s: returning\n", __func__);
@ -401,8 +399,7 @@ out3:
out2:
rpcrdma_ia_close(&new_xprt->rx_ia);
out1:
kfree(xprt->slot);
kfree(xprt);
xprt_free(xprt);
return ERR_PTR(rc);
}

View File

@ -774,8 +774,7 @@ static void xs_destroy(struct rpc_xprt *xprt)
xs_close(xprt);
xs_free_peer_addresses(xprt);
kfree(xprt->slot);
kfree(xprt);
xprt_free(xprt);
module_put(THIS_MODULE);
}
@ -2362,8 +2361,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
return xprt;
ret = ERR_PTR(-EINVAL);
out_err:
kfree(xprt->slot);
kfree(xprt);
xprt_free(xprt);
return ret;
}
@ -2438,8 +2436,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
return xprt;
ret = ERR_PTR(-EINVAL);
out_err:
kfree(xprt->slot);
kfree(xprt);
xprt_free(xprt);
return ret;
}
@ -2519,8 +2516,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
return xprt;
ret = ERR_PTR(-EINVAL);
out_err:
kfree(xprt->slot);
kfree(xprt);
xprt_free(xprt);
return ret;
}