patch-2.3.4 linux/net/ipv4/timer.c
Next file: linux/net/ipv4/udp.c
Previous file: linux/net/ipv4/tcp_timer.c
Back to the patch index
Back to the overall index
- Lines: 55
- Date:
Wed May 26 18:14:38 1999
- Orig file:
v2.3.3/linux/net/ipv4/timer.c
- Orig date:
Mon Feb 22 09:05:55 1999
diff -u --recursive --new-file v2.3.3/linux/net/ipv4/timer.c linux/net/ipv4/timer.c
@@ -5,7 +5,7 @@
*
* TIMER - implementation of software timers for IP.
*
- * Version: $Id: timer.c,v 1.15 1999/02/22 13:54:29 davem Exp $
+ * Version: $Id: timer.c,v 1.16 1999/05/27 00:37:39 davem Exp $
*
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -69,13 +69,15 @@
*/
void net_timer (unsigned long data)
{
- struct sock *sk = (struct sock*)data;
+ struct sock *sk = (struct sock *) data;
int why = sk->timeout;
/* Only process if socket is not in use. */
- if (atomic_read(&sk->sock_readers)) {
+ bh_lock_sock(sk);
+ if (sk->lock.users) {
/* Try again later. */
mod_timer(&sk->timer, jiffies+HZ/20);
+ bh_unlock_sock(sk);
return;
}
@@ -99,15 +101,15 @@
printk (KERN_DEBUG "non CLOSE socket in time_done\n");
break;
}
- destroy_sock (sk);
- break;
+ destroy_sock(sk);
+ return;
case TIME_DESTROY:
/* We've waited for a while for all the memory associated with
* the socket to be freed.
*/
destroy_sock(sk);
- break;
+ return;
case TIME_CLOSE:
/* We've waited long enough, close the socket. */
@@ -123,5 +125,8 @@
printk ("net_timer: timer expired - reason %d is unknown\n", why);
break;
}
+
+ /* We only need to unlock if the socket was not destroyed. */
+ bh_unlock_sock(sk);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)