Commit 4a0f8c04 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

[PATCH] RPC: Rename sock_lock

 Clean-up: replace a name reference to sockets in the generic parts of the RPC
 client by renaming sock_lock in the rpc_xprt structure.

 Test-plan:
 Compile kernel with CONFIG_NFS enabled.

 Version: Thu, 11 Aug 2005 16:05:00 -0400
Signed-off-by: default avatarChuck Lever <cel@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b4b5cc85
...@@ -198,7 +198,7 @@ struct rpc_xprt { ...@@ -198,7 +198,7 @@ struct rpc_xprt {
/* /*
* Send stuff * Send stuff
*/ */
spinlock_t sock_lock; /* lock socket info */ spinlock_t transport_lock; /* lock transport info */
spinlock_t xprt_lock; /* lock xprt info */ spinlock_t xprt_lock; /* lock xprt info */
struct rpc_task * snd_task; /* Task blocked in send */ struct rpc_task * snd_task; /* Task blocked in send */
......
...@@ -106,9 +106,9 @@ xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) ...@@ -106,9 +106,9 @@ xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task)
{ {
int retval; int retval;
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
retval = __xprt_lock_write(xprt, task); retval = __xprt_lock_write(xprt, task);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
return retval; return retval;
} }
...@@ -161,9 +161,9 @@ __xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) ...@@ -161,9 +161,9 @@ __xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task)
static inline void static inline void
xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task)
{ {
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
__xprt_release_write(xprt, task); __xprt_release_write(xprt, task);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
} }
/* /*
...@@ -266,9 +266,9 @@ int xprt_adjust_timeout(struct rpc_rqst *req) ...@@ -266,9 +266,9 @@ int xprt_adjust_timeout(struct rpc_rqst *req)
req->rq_retries = 0; req->rq_retries = 0;
xprt_reset_majortimeo(req); xprt_reset_majortimeo(req);
/* Reset the RTT counters == "slow start" */ /* Reset the RTT counters == "slow start" */
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
rpc_init_rtt(req->rq_task->tk_client->cl_rtt, to->to_initval); rpc_init_rtt(req->rq_task->tk_client->cl_rtt, to->to_initval);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
pprintk("RPC: %lu timeout\n", jiffies); pprintk("RPC: %lu timeout\n", jiffies);
status = -ETIMEDOUT; status = -ETIMEDOUT;
} }
...@@ -298,10 +298,10 @@ xprt_socket_autoclose(void *args) ...@@ -298,10 +298,10 @@ xprt_socket_autoclose(void *args)
void xprt_disconnect(struct rpc_xprt *xprt) void xprt_disconnect(struct rpc_xprt *xprt)
{ {
dprintk("RPC: disconnected transport %p\n", xprt); dprintk("RPC: disconnected transport %p\n", xprt);
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
xprt_clear_connected(xprt); xprt_clear_connected(xprt);
rpc_wake_up_status(&xprt->pending, -ENOTCONN); rpc_wake_up_status(&xprt->pending, -ENOTCONN);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
} }
static void static void
...@@ -309,12 +309,12 @@ xprt_init_autodisconnect(unsigned long data) ...@@ -309,12 +309,12 @@ xprt_init_autodisconnect(unsigned long data)
{ {
struct rpc_xprt *xprt = (struct rpc_xprt *)data; struct rpc_xprt *xprt = (struct rpc_xprt *)data;
spin_lock(&xprt->sock_lock); spin_lock(&xprt->transport_lock);
if (!list_empty(&xprt->recv) || xprt->shutdown) if (!list_empty(&xprt->recv) || xprt->shutdown)
goto out_abort; goto out_abort;
if (test_and_set_bit(XPRT_LOCKED, &xprt->sockstate)) if (test_and_set_bit(XPRT_LOCKED, &xprt->sockstate))
goto out_abort; goto out_abort;
spin_unlock(&xprt->sock_lock); spin_unlock(&xprt->transport_lock);
/* Let keventd close the socket */ /* Let keventd close the socket */
if (test_bit(XPRT_CONNECTING, &xprt->sockstate) != 0) if (test_bit(XPRT_CONNECTING, &xprt->sockstate) != 0)
xprt_release_write(xprt, NULL); xprt_release_write(xprt, NULL);
...@@ -322,7 +322,7 @@ xprt_init_autodisconnect(unsigned long data) ...@@ -322,7 +322,7 @@ xprt_init_autodisconnect(unsigned long data)
schedule_work(&xprt->task_cleanup); schedule_work(&xprt->task_cleanup);
return; return;
out_abort: out_abort:
spin_unlock(&xprt->sock_lock); spin_unlock(&xprt->transport_lock);
} }
/** /**
...@@ -482,7 +482,7 @@ xprt_timer(struct rpc_task *task) ...@@ -482,7 +482,7 @@ xprt_timer(struct rpc_task *task)
struct rpc_rqst *req = task->tk_rqstp; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = req->rq_xprt; struct rpc_xprt *xprt = req->rq_xprt;
spin_lock(&xprt->sock_lock); spin_lock(&xprt->transport_lock);
if (req->rq_received) if (req->rq_received)
goto out; goto out;
...@@ -496,7 +496,7 @@ xprt_timer(struct rpc_task *task) ...@@ -496,7 +496,7 @@ xprt_timer(struct rpc_task *task)
out: out:
task->tk_timeout = 0; task->tk_timeout = 0;
rpc_wake_up_task(task); rpc_wake_up_task(task);
spin_unlock(&xprt->sock_lock); spin_unlock(&xprt->transport_lock);
} }
/** /**
...@@ -515,7 +515,7 @@ int xprt_prepare_transmit(struct rpc_task *task) ...@@ -515,7 +515,7 @@ int xprt_prepare_transmit(struct rpc_task *task)
if (xprt->shutdown) if (xprt->shutdown)
return -EIO; return -EIO;
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
if (req->rq_received && !req->rq_bytes_sent) { if (req->rq_received && !req->rq_bytes_sent) {
err = req->rq_received; err = req->rq_received;
goto out_unlock; goto out_unlock;
...@@ -530,7 +530,7 @@ int xprt_prepare_transmit(struct rpc_task *task) ...@@ -530,7 +530,7 @@ int xprt_prepare_transmit(struct rpc_task *task)
goto out_unlock; goto out_unlock;
} }
out_unlock: out_unlock:
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
return err; return err;
} }
...@@ -552,13 +552,13 @@ void xprt_transmit(struct rpc_task *task) ...@@ -552,13 +552,13 @@ void xprt_transmit(struct rpc_task *task)
smp_rmb(); smp_rmb();
if (!req->rq_received) { if (!req->rq_received) {
if (list_empty(&req->rq_list)) { if (list_empty(&req->rq_list)) {
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
/* Update the softirq receive buffer */ /* Update the softirq receive buffer */
memcpy(&req->rq_private_buf, &req->rq_rcv_buf, memcpy(&req->rq_private_buf, &req->rq_rcv_buf,
sizeof(req->rq_private_buf)); sizeof(req->rq_private_buf));
/* Add request to the receive list */ /* Add request to the receive list */
list_add_tail(&req->rq_list, &xprt->recv); list_add_tail(&req->rq_list, &xprt->recv);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
xprt_reset_majortimeo(req); xprt_reset_majortimeo(req);
/* Turn off autodisconnect */ /* Turn off autodisconnect */
del_singleshot_timer_sync(&xprt->timer); del_singleshot_timer_sync(&xprt->timer);
...@@ -592,7 +592,7 @@ void xprt_transmit(struct rpc_task *task) ...@@ -592,7 +592,7 @@ void xprt_transmit(struct rpc_task *task)
out_receive: out_receive:
dprintk("RPC: %4d xmit complete\n", task->tk_pid); dprintk("RPC: %4d xmit complete\n", task->tk_pid);
/* Set the task's receive timeout value */ /* Set the task's receive timeout value */
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
if (!xprt->nocong) { if (!xprt->nocong) {
int timer = task->tk_msg.rpc_proc->p_timer; int timer = task->tk_msg.rpc_proc->p_timer;
task->tk_timeout = rpc_calc_rto(clnt->cl_rtt, timer); task->tk_timeout = rpc_calc_rto(clnt->cl_rtt, timer);
...@@ -607,7 +607,7 @@ void xprt_transmit(struct rpc_task *task) ...@@ -607,7 +607,7 @@ void xprt_transmit(struct rpc_task *task)
else if (!req->rq_received) else if (!req->rq_received)
rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer); rpc_sleep_on(&xprt->pending, task, NULL, xprt_timer);
__xprt_release_write(xprt, task); __xprt_release_write(xprt, task);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
} }
static inline void do_xprt_reserve(struct rpc_task *task) static inline void do_xprt_reserve(struct rpc_task *task)
...@@ -683,7 +683,7 @@ void xprt_release(struct rpc_task *task) ...@@ -683,7 +683,7 @@ void xprt_release(struct rpc_task *task)
if (!(req = task->tk_rqstp)) if (!(req = task->tk_rqstp))
return; return;
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
__xprt_release_write(xprt, task); __xprt_release_write(xprt, task);
__xprt_put_cong(xprt, req); __xprt_put_cong(xprt, req);
if (!list_empty(&req->rq_list)) if (!list_empty(&req->rq_list))
...@@ -692,7 +692,7 @@ void xprt_release(struct rpc_task *task) ...@@ -692,7 +692,7 @@ void xprt_release(struct rpc_task *task)
if (list_empty(&xprt->recv) && !xprt->shutdown) if (list_empty(&xprt->recv) && !xprt->shutdown)
mod_timer(&xprt->timer, mod_timer(&xprt->timer,
xprt->last_used + RPC_IDLE_DISCONNECT_TIMEOUT); xprt->last_used + RPC_IDLE_DISCONNECT_TIMEOUT);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
task->tk_rqstp = NULL; task->tk_rqstp = NULL;
memset(req, 0, sizeof(*req)); /* mark unused */ memset(req, 0, sizeof(*req)); /* mark unused */
...@@ -750,7 +750,7 @@ static struct rpc_xprt *xprt_setup(int proto, struct sockaddr_in *ap, struct rpc ...@@ -750,7 +750,7 @@ static struct rpc_xprt *xprt_setup(int proto, struct sockaddr_in *ap, struct rpc
return ERR_PTR(result); return ERR_PTR(result);
} }
spin_lock_init(&xprt->sock_lock); spin_lock_init(&xprt->transport_lock);
spin_lock_init(&xprt->xprt_lock); spin_lock_init(&xprt->xprt_lock);
init_waitqueue_head(&xprt->cong_wait); init_waitqueue_head(&xprt->cong_wait);
......
...@@ -307,7 +307,7 @@ static int xs_send_request(struct rpc_task *task) ...@@ -307,7 +307,7 @@ static int xs_send_request(struct rpc_task *task)
if (status == -EAGAIN) { if (status == -EAGAIN) {
if (test_bit(SOCK_ASYNC_NOSPACE, &xprt->sock->flags)) { if (test_bit(SOCK_ASYNC_NOSPACE, &xprt->sock->flags)) {
/* Protect against races with xs_write_space */ /* Protect against races with xs_write_space */
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
/* Don't race with disconnect */ /* Don't race with disconnect */
if (!xprt_connected(xprt)) if (!xprt_connected(xprt))
task->tk_status = -ENOTCONN; task->tk_status = -ENOTCONN;
...@@ -315,7 +315,7 @@ static int xs_send_request(struct rpc_task *task) ...@@ -315,7 +315,7 @@ static int xs_send_request(struct rpc_task *task)
task->tk_timeout = req->rq_timeout; task->tk_timeout = req->rq_timeout;
rpc_sleep_on(&xprt->pending, task, NULL, NULL); rpc_sleep_on(&xprt->pending, task, NULL, NULL);
} }
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
return status; return status;
} }
/* Keep holding the socket if it is blocked */ /* Keep holding the socket if it is blocked */
...@@ -415,7 +415,7 @@ static void xs_udp_data_ready(struct sock *sk, int len) ...@@ -415,7 +415,7 @@ static void xs_udp_data_ready(struct sock *sk, int len)
goto dropit; goto dropit;
/* Look up and lock the request corresponding to the given XID */ /* Look up and lock the request corresponding to the given XID */
spin_lock(&xprt->sock_lock); spin_lock(&xprt->transport_lock);
rovr = xprt_lookup_rqst(xprt, *xp); rovr = xprt_lookup_rqst(xprt, *xp);
if (!rovr) if (!rovr)
goto out_unlock; goto out_unlock;
...@@ -436,7 +436,7 @@ static void xs_udp_data_ready(struct sock *sk, int len) ...@@ -436,7 +436,7 @@ static void xs_udp_data_ready(struct sock *sk, int len)
xprt_complete_rqst(xprt, rovr, copied); xprt_complete_rqst(xprt, rovr, copied);
out_unlock: out_unlock:
spin_unlock(&xprt->sock_lock); spin_unlock(&xprt->transport_lock);
dropit: dropit:
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
out: out:
...@@ -531,13 +531,13 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc ...@@ -531,13 +531,13 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
ssize_t r; ssize_t r;
/* Find and lock the request corresponding to this xid */ /* Find and lock the request corresponding to this xid */
spin_lock(&xprt->sock_lock); spin_lock(&xprt->transport_lock);
req = xprt_lookup_rqst(xprt, xprt->tcp_xid); req = xprt_lookup_rqst(xprt, xprt->tcp_xid);
if (!req) { if (!req) {
xprt->tcp_flags &= ~XPRT_COPY_DATA; xprt->tcp_flags &= ~XPRT_COPY_DATA;
dprintk("RPC: XID %08x request not found!\n", dprintk("RPC: XID %08x request not found!\n",
ntohl(xprt->tcp_xid)); ntohl(xprt->tcp_xid));
spin_unlock(&xprt->sock_lock); spin_unlock(&xprt->transport_lock);
return; return;
} }
...@@ -597,7 +597,7 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc ...@@ -597,7 +597,7 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
req->rq_task->tk_pid); req->rq_task->tk_pid);
xprt_complete_rqst(xprt, req, xprt->tcp_copied); xprt_complete_rqst(xprt, req, xprt->tcp_copied);
} }
spin_unlock(&xprt->sock_lock); spin_unlock(&xprt->transport_lock);
xs_tcp_check_recm(xprt); xs_tcp_check_recm(xprt);
} }
...@@ -696,7 +696,7 @@ static void xs_tcp_state_change(struct sock *sk) ...@@ -696,7 +696,7 @@ static void xs_tcp_state_change(struct sock *sk)
switch (sk->sk_state) { switch (sk->sk_state) {
case TCP_ESTABLISHED: case TCP_ESTABLISHED:
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
if (!xprt_test_and_set_connected(xprt)) { if (!xprt_test_and_set_connected(xprt)) {
/* Reset TCP record info */ /* Reset TCP record info */
xprt->tcp_offset = 0; xprt->tcp_offset = 0;
...@@ -705,7 +705,7 @@ static void xs_tcp_state_change(struct sock *sk) ...@@ -705,7 +705,7 @@ static void xs_tcp_state_change(struct sock *sk)
xprt->tcp_flags = XPRT_COPY_RECM | XPRT_COPY_XID; xprt->tcp_flags = XPRT_COPY_RECM | XPRT_COPY_XID;
rpc_wake_up(&xprt->pending); rpc_wake_up(&xprt->pending);
} }
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
break; break;
case TCP_SYN_SENT: case TCP_SYN_SENT:
case TCP_SYN_RECV: case TCP_SYN_RECV:
...@@ -753,10 +753,10 @@ static void xs_write_space(struct sock *sk) ...@@ -753,10 +753,10 @@ static void xs_write_space(struct sock *sk)
if (!test_and_clear_bit(SOCK_NOSPACE, &sock->flags)) if (!test_and_clear_bit(SOCK_NOSPACE, &sock->flags))
goto out; goto out;
spin_lock_bh(&xprt->sock_lock); spin_lock_bh(&xprt->transport_lock);
if (xprt->snd_task) if (xprt->snd_task)
rpc_wake_up_task(xprt->snd_task); rpc_wake_up_task(xprt->snd_task);
spin_unlock_bh(&xprt->sock_lock); spin_unlock_bh(&xprt->transport_lock);
out: out:
read_unlock(&sk->sk_callback_lock); read_unlock(&sk->sk_callback_lock);
} }
......
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