Re: 1.3.66: double lock on socket

Linus Torvalds (Linus.Torvalds@cs.helsinki.fi)
Mon, 19 Feb 1996 07:14:52 +0200


Thomas =?ISO-8859-1?Q?K=F6nig?=: "1.3.66: double lock on socket" (Feb 18, 19:48):
> I just got two 'double lock on socket' conditions with 1.3.66:
>
> Feb 18 19:37:47 mvmap66 kernel: double lock on socket at 00145aa3
> Feb 18 19:37:47 mvmap66 kernel: double lock on socket at 00145aa3
>
> 00144f10 t _wait_for_tcp_memory
> 00144fd0 t _do_tcp_sendmsg
> 00145a10 t _tcp_sendmsg <================
> 00145b24 T _tcp_read_wakeup
> 00145dec t _tcp_recv_urg
>
> gdb tells me this is in /usr/src/linux/include/net/sock.h:364.
> I'd like to give you some more info, but for this, I'd need at
> least the address of sk.

Was there anything bad associated with this message, or did the kernel
continue running (with no sockets getting stuck or similar)?

The reason I ask is that the "double lock" message is actually harmless
in itself: the message is printed if something locks an already locked
socket. Now, this is a completely permissible thing in itself, and it's
actually the reason for the 1.3.65 and 66 patches in the first place: it
only shows that the new code is working fine.

The "double lock" condition is the condition that used to crash linux,
and with the new code the kernel should be fine. So in that sense the
message is something you should be able to ignore.

However, the reason I asked people to send in reports about this thing
(thanks), is that if you can re-produce this message at will by using a
certain program or similar, then it might be a problem with the locking
code in the kernel. The old locking code was rather broken (it didn't
allow two processes to lock down the socket at the same time), and I
might not have fixed it all 100%.

So keep sending me the messages (and if they seem to happen under some
certain circumstances, I'm very interested to know about it), but don't
worry too much about them if the machine seems to work fine - it's a
debugging message that _may_ point to a problem, but may be quite safe.

(Now, if you get a "trying to unlock unlocked socket", then that's a
real bug 100% of the time.)

Linus