diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2007-12-30 22:07:59 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-02-01 16:42:11 -0500 |
commit | a50fea26b9d2aa7b66fdd6d9579de10827ec086a (patch) | |
tree | efb7893e6e45b417405e9320d3b82100b1684daf /net/sunrpc | |
parent | f6150c3cab6e788afacb07470be3c6b4a722f1ed (diff) |
svc: Make svc_send transport neutral
Move the sk_mutex field to the transport independent svc_xprt structure.
Now all the fields that svc_send touches are transport neutral. Change the
svc_send function to use the transport independent svc_xprt directly instead
of the transport dependent svc_sock structure.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Acked-by: Neil Brown <neilb@suse.de>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Greg Banks <gnb@sgi.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 1 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 19 |
2 files changed, 9 insertions, 11 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 95186b548099..3e6a1c81d4ce 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -99,6 +99,7 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt, | |||
99 | xprt->xpt_server = serv; | 99 | xprt->xpt_server = serv; |
100 | INIT_LIST_HEAD(&xprt->xpt_list); | 100 | INIT_LIST_HEAD(&xprt->xpt_list); |
101 | INIT_LIST_HEAD(&xprt->xpt_ready); | 101 | INIT_LIST_HEAD(&xprt->xpt_ready); |
102 | mutex_init(&xprt->xpt_mutex); | ||
102 | } | 103 | } |
103 | EXPORT_SYMBOL_GPL(svc_xprt_init); | 104 | EXPORT_SYMBOL_GPL(svc_xprt_init); |
104 | 105 | ||
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index d95a0c894d4f..2016d9c63f88 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1632,15 +1632,13 @@ svc_drop(struct svc_rqst *rqstp) | |||
1632 | int | 1632 | int |
1633 | svc_send(struct svc_rqst *rqstp) | 1633 | svc_send(struct svc_rqst *rqstp) |
1634 | { | 1634 | { |
1635 | struct svc_sock *svsk; | 1635 | struct svc_xprt *xprt; |
1636 | int len; | 1636 | int len; |
1637 | struct xdr_buf *xb; | 1637 | struct xdr_buf *xb; |
1638 | 1638 | ||
1639 | if ((svsk = rqstp->rq_sock) == NULL) { | 1639 | xprt = rqstp->rq_xprt; |
1640 | printk(KERN_WARNING "NULL socket pointer in %s:%d\n", | 1640 | if (!xprt) |
1641 | __FILE__, __LINE__); | ||
1642 | return -EFAULT; | 1641 | return -EFAULT; |
1643 | } | ||
1644 | 1642 | ||
1645 | /* release the receive skb before sending the reply */ | 1643 | /* release the receive skb before sending the reply */ |
1646 | rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp); | 1644 | rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp); |
@@ -1651,13 +1649,13 @@ svc_send(struct svc_rqst *rqstp) | |||
1651 | xb->page_len + | 1649 | xb->page_len + |
1652 | xb->tail[0].iov_len; | 1650 | xb->tail[0].iov_len; |
1653 | 1651 | ||
1654 | /* Grab svsk->sk_mutex to serialize outgoing data. */ | 1652 | /* Grab mutex to serialize outgoing data. */ |
1655 | mutex_lock(&svsk->sk_mutex); | 1653 | mutex_lock(&xprt->xpt_mutex); |
1656 | if (test_bit(XPT_DEAD, &svsk->sk_xprt.xpt_flags)) | 1654 | if (test_bit(XPT_DEAD, &xprt->xpt_flags)) |
1657 | len = -ENOTCONN; | 1655 | len = -ENOTCONN; |
1658 | else | 1656 | else |
1659 | len = svsk->sk_xprt.xpt_ops->xpo_sendto(rqstp); | 1657 | len = xprt->xpt_ops->xpo_sendto(rqstp); |
1660 | mutex_unlock(&svsk->sk_mutex); | 1658 | mutex_unlock(&xprt->xpt_mutex); |
1661 | svc_sock_release(rqstp); | 1659 | svc_sock_release(rqstp); |
1662 | 1660 | ||
1663 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) | 1661 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) |
@@ -1759,7 +1757,6 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, | |||
1759 | svsk->sk_lastrecv = get_seconds(); | 1757 | svsk->sk_lastrecv = get_seconds(); |
1760 | spin_lock_init(&svsk->sk_lock); | 1758 | spin_lock_init(&svsk->sk_lock); |
1761 | INIT_LIST_HEAD(&svsk->sk_deferred); | 1759 | INIT_LIST_HEAD(&svsk->sk_deferred); |
1762 | mutex_init(&svsk->sk_mutex); | ||
1763 | 1760 | ||
1764 | /* Initialize the socket */ | 1761 | /* Initialize the socket */ |
1765 | if (sock->type == SOCK_DGRAM) | 1762 | if (sock->type == SOCK_DGRAM) |