Module Name:    src
Committed By:   yamt
Date:           Mon Oct 31 12:56:46 UTC 2011

Modified Files:
        src/sys/netinet: tcp_subr.c

Log Message:
tcp_drain: grab softnet_lock where appropriate


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/netinet/tcp_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/tcp_subr.c
diff -u src/sys/netinet/tcp_subr.c:1.241 src/sys/netinet/tcp_subr.c:1.242
--- src/sys/netinet/tcp_subr.c:1.241	Tue May  3 18:28:45 2011
+++ src/sys/netinet/tcp_subr.c	Mon Oct 31 12:56:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_subr.c,v 1.241 2011/05/03 18:28:45 dyoung Exp $	*/
+/*	$NetBSD: tcp_subr.c,v 1.242 2011/10/31 12:56:45 yamt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.241 2011/05/03 18:28:45 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.242 2011/10/31 12:56:45 yamt Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1328,8 +1328,7 @@ tcp_drainstub(void)
 
 /*
  * Protocol drain routine.  Called when memory is in short supply.
- * Don't acquire softnet_lock as can be called from hardware
- * interrupt handler.
+ * Called from pr_fasttimo thus a callout context.
  */
 void
 tcp_drain(void)
@@ -1337,6 +1336,7 @@ tcp_drain(void)
 	struct inpcb_hdr *inph;
 	struct tcpcb *tp;
 
+	mutex_enter(softnet_lock);
 	KERNEL_LOCK(1, NULL);
 
 	/*
@@ -1371,6 +1371,7 @@ tcp_drain(void)
 	}
 
 	KERNEL_UNLOCK_ONE(NULL);
+	mutex_exit(softnet_lock);
 }
 
 /*

Reply via email to