Module Name:    src
Committed By:   riz
Date:           Tue Mar 29 19:34:46 UTC 2011

Modified Files:
        src/sys/nfs [netbsd-5]: nfs_socket.c

Log Message:
Pull up following revision(s) (requested by tls in ticket #1580):
        sys/nfs/nfs_socket.c: revision 1.175
avoid noisy nfs_timer/nfs_reply DEBUG output that occurs when the
NFS server goes away.  use ratelimit(9) and only print the console
error once every 10 seconds.  PR#31562.


To generate a diff of this commit:
cvs rdiff -u -r1.173.4.4 -r1.173.4.5 src/sys/nfs/nfs_socket.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/nfs/nfs_socket.c
diff -u src/sys/nfs/nfs_socket.c:1.173.4.4 src/sys/nfs/nfs_socket.c:1.173.4.5
--- src/sys/nfs/nfs_socket.c:1.173.4.4	Fri Nov 13 20:34:03 2009
+++ src/sys/nfs/nfs_socket.c	Tue Mar 29 19:34:45 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_socket.c,v 1.173.4.4 2009/11/13 20:34:03 sborrill Exp $	*/
+/*	$NetBSD: nfs_socket.c,v 1.173.4.5 2011/03/29 19:34:45 riz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.173.4.4 2009/11/13 20:34:03 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.173.4.5 2011/03/29 19:34:45 riz Exp $");
 
 #include "fs_nfs.h"
 #include "opt_nfs.h"
@@ -114,6 +114,16 @@
 extern const int nfsv3_procid[NFS_NPROCS];
 extern int nfs_ticks;
 
+#ifdef DEBUG
+/*
+ * Avoid spamming the console with debugging messages.  We only print
+ * the nfs timer and reply error debugs every 10 seconds.
+ */
+static const struct timeval nfs_err_interval = { 10, 0 };
+static struct timeval nfs_reply_last_err_time;
+static struct timeval nfs_timer_last_err_time;
+#endif
+
 /*
  * Defines which timer to use for the procnum.
  * 0 - default
@@ -842,7 +852,10 @@
 			if (NFSIGNORE_SOERROR(nmp->nm_soflags, error)) {
 				nmp->nm_so->so_error = 0;
 #ifdef DEBUG
-				printf("nfs_reply: ignoring error %d\n", error);
+				if (ratecheck(&nfs_reply_last_err_time,
+				    &nfs_err_interval))
+					printf("%s: ignoring error %d\n",
+					       __func__, error);
 #endif
 				continue;
 			}
@@ -1694,8 +1707,10 @@
 			if (error) {
 				if (NFSIGNORE_SOERROR(nmp->nm_soflags, error)) {
 #ifdef DEBUG
-					printf("nfs_timer: ignoring error %d\n",
-						error);
+					if (ratecheck(&nfs_timer_last_err_time,
+					    &nfs_err_interval))
+						printf("%s: ignoring error "
+						       "%d\n", __func__, error);
 #endif
 					so->so_error = 0;
 				}

Reply via email to