2002-04-10 05:53:06

by minoura makoto

[permalink] [raw]
Subject: [PATCH] deadlock/panic in increasing/decreasing nfsd


The following patch for 2.5.7 fixes a problem that it can sleep with
a spinlock(_bh) grabbed. This may cause a deadlock or kernel panic
when you try to increase/decrease the number of nfsd kernel threads.

I think lock_sock is not necessary in current implementation of the
network stack; for safety, we have to do this in some other way.

--
Minoura Makoto <[email protected]>
Engineering Dept., VA Linux Systems Japan

--- net/sunrpc/svcsock.c.orig Wed Mar 27 19:14:25 2002
+++ net/sunrpc/svcsock.c Wed Mar 27 21:24:55 2002
@@ -422,11 +422,14 @@
* on not having CAP_SYS_RESOURCE or similar, we go direct...
* DaveM said I could!
*/
- lock_sock(sock->sk);
+ /* Previously these operations are done after locking sock->sk.
+ * However we are holding the spinlock serv->sv_locked, and
+ * lock_sock() may sleep, this caused deadlock or kernel panic.
+ * I believe removing this lock is safe in current TCP implementation.
+ */
+ sock->sk->userlocks |= SOCK_SNDBUF_LOCK|SOCK_RCVBUF_LOCK;
sock->sk->sndbuf = snd * 2;
sock->sk->rcvbuf = rcv * 2;
- sock->sk->userlocks |= SOCK_SNDBUF_LOCK|SOCK_RCVBUF_LOCK;
- release_sock(sock->sk);
#endif
}
/*

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs