* Re: More fun with spinlocks
@ 2001-04-19 5:30 Greg Lindahl
0 siblings, 0 replies; 3+ messages in thread
From: Greg Lindahl @ 2001-04-19 5:30 UTC (permalink / raw)
To: axp-list
I got a request to post the exact patch from trond. This was tested
by Craig Tierney and apparently resolved the problem.
----------
Urgh. I see what's going wrong: it's the mod_timer() thing in
xprt_add_tcp_timer() that's waiting on the bottom half to finish. Odd
that's never surfaced before.
Does the following patch fix it?
Cheers,
Trond
--- net/sunrpc/xprt.c.orig Sun Mar 25 18:37:42 2001
+++ net/sunrpc/xprt.c Wed Apr 18 11:10:21 2001
@@ -1145,9 +1145,11 @@
unsigned long oldflags;
spin_lock_irqsave(&xprt_sock_lock, oldflags);
xprt->snd_task = NULL;
- if (!rpc_wake_up_next(&xprt->sending) && xprt->stream)
+ if (!rpc_wake_up_next(&xprt->sending) && xprt->stream) {
+ spin_unlock_irqrestore(&xprt_sock_lock, oldflags);
xprt_add_tcp_timer(xprt, RPCXPRT_TIMEOUT);
- spin_unlock_irqrestore(&xprt_sock_lock, oldflags);
+ } else
+ spin_unlock_irqrestore(&xprt_sock_lock, oldflags);
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread* More fun with spinlocks
@ 2001-04-15 0:14 Greg Lindahl
2001-04-19 3:29 ` Greg Lindahl
0 siblings, 1 reply; 3+ messages in thread
From: Greg Lindahl @ 2001-04-15 0:14 UTC (permalink / raw)
To: axp-list
OK, so how do I read this:
xprt.c:1052 spinlock stuck in hybcst.d0000.fs at fffffc00003ee468(0)
owner rsh at fffffc00003ee900(1) xprt.c:1146
wait_on_bh, CPU 1: 0000000000000000
irq: 1 [1 0]
bh: 1 [1 0]
The machine is a 2-cpu UP2000 running 2.2.19. Looks like the 2
processes involved are rsh and hybcst (the weather code that is used
to predict weather for US airlines...), and the spinlock was taken at
linux/net/sunrpc/xprt.c line 1146 and the other guy who wants it is in
linux/net/sunrpc/xprt.c line 1052... known problem? It's an nfs v3
thing.
*
* Releases the socket for use by other requests.
*/
void
xprt_up_transmit(struct rpc_task *task)
{
struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
if (xprt->snd_task && xprt->snd_task == task) {
unsigned long oldflags;
spin_lock_irqsave(&xprt_sock_lock, oldflags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xprt->snd_task = NULL;
if (!rpc_wake_up_next(&xprt->sending) && xprt->stream)
xprt_add_tcp_timer(xprt, RPCXPRT_TIMEOUT);
spin_unlock_irqrestore(&xprt_sock_lock, oldflags);
}
}
And the person who wants it is xprt.c:1052:
/*
* The following 2 routines allow a task to sleep while socket memory is
* low.
*/
static void
tcp_write_space(struct sock *sk)
{
struct rpc_xprt *xprt;
unsigned long oldflags;
if (!(xprt = xprt_from_sock(sk)))
return;
if (xprt->shutdown)
return;
/* Wait until we have enough socket memory */
if (sock_wspace(sk) < min(sk->sndbuf,XPRT_MIN_WRITE_SPACE))
return;
if (xprt_test_and_set_wspace(xprt))
goto out;
spin_lock_irqsave(&xprt_sock_lock, oldflags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if (xprt->snd_task && xprt->snd_task->tk_rpcwait == &xprt->sending)
rpc_wake_up_task(xprt->snd_task);
spin_unlock_irqrestore(&xprt_sock_lock, oldflags);
out:
wake_up_interruptible(sk->sleep);
}
Is this a known problem?
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: More fun with spinlocks
2001-04-15 0:14 Greg Lindahl
@ 2001-04-19 3:29 ` Greg Lindahl
0 siblings, 0 replies; 3+ messages in thread
From: Greg Lindahl @ 2001-04-19 3:29 UTC (permalink / raw)
To: axp-list
Regarding my spinlock lockup... I posted it to the Linux nfs mailing
list and got a quick bugfix.
> spin_lock_irqsave(&xprt_sock_lock, oldflags);
> xprt->snd_task = NULL;
> if (!rpc_wake_up_next(&xprt->sending) && xprt->stream)
> xprt_add_tcp_timer(xprt, RPCXPRT_TIMEOUT);
> spin_unlock_irqrestore(&xprt_sock_lock, oldflags);
Trond immediately spotted a thinko in this code: xprt_add_tcp_timer()
sometimes does something that has to wait for the BH, and it shouldn't
be holding the spinlock while waiting. Fortunately it doesn't need
the spinlock.
He was surprised it hadn't shown up before, as am I; other people are
running 2.2.19 on 2 cpu UP2000s using NFS v3 over tcp, right?
-- g
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-04-19 5:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-19 5:30 More fun with spinlocks Greg Lindahl
-- strict thread matches above, loose matches on Subject: below --
2001-04-15 0:14 Greg Lindahl
2001-04-19 3:29 ` Greg Lindahl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox