Author: cperciva
Date: Wed Nov 16 01:11:49 2016
New Revision: 308708
URL: https://svnweb.freebsd.org/changeset/base/308708

Log:
  Reduce NFS "NFSv4( mounted on)? fileid > 32bits" log spam.
  
  Rather than printing a warning for every time we receive a fileid > 2^32
  from the NFS server, count warnings and print at most one of each warning
  type per minute, e.g.,
  
  Nov 15 05:17:34 ip-172-30-1-221 kernel: NFSv4 fileid > 32bits (24730 
occurrences)
  Nov 15 05:17:56 ip-172-30-1-221 kernel: NFSv4 mounted on fileid > 32bits (178 
occurrences)
  Nov 15 05:18:53 ip-172-30-1-221 kernel: NFSv4 fileid > 32bits (7582 
occurrences)
  Nov 15 05:18:58 ip-172-30-1-221 kernel: NFSv4 mounted on fileid > 32bits (23 
occurrences)
  
  A buildworld with an NFS mounted /usr/obj can otherwise result in
  hundreds of thousands of lines being printed, which seems unnecessarily
  verbose.
  
  When ino_t becomes a 64-bit type, these printfs will no longer be needed
  (and the problems associated with truncating 64-bit fileids to generate
  32-bit inode numbers will also go away).
  
  Reviewed by:  rmacklem
  MFC after:    1 month
  Differential Revision:        https://reviews.freebsd.org/D8523

Modified:
  head/sys/fs/nfs/nfs_commonsubs.c

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonsubs.c    Wed Nov 16 01:03:42 2016        
(r308707)
+++ head/sys/fs/nfs/nfs_commonsubs.c    Wed Nov 16 01:11:49 2016        
(r308708)
@@ -827,6 +827,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd
        struct dqblk dqb;
        uid_t savuid;
 #endif
+       static struct timeval last64fileid;
+       static size_t count64fileid;
+       static struct timeval last64mountfileid;
+       static size_t count64mountfileid;
+       static struct timeval warninterval = { 60, 0 };
+
        if (compare) {
                retnotsup = 0;
                error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup);
@@ -1202,8 +1208,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd
                                        *retcmpp = NFSERR_NOTSAME;
                                }
                        } else if (nap != NULL) {
-                               if (*tl++)
-                                       printf("NFSv4 fileid > 32bits\n");
+                               if (*tl++) {
+                                       count64fileid++;
+                                       if (ratecheck(&last64fileid, 
&warninterval)) {
+                                               printf("NFSv4 fileid > 32bits 
(%zu occurrences)\n",
+                                                   count64fileid);
+                                               count64fileid = 0;
+                                       }
+                               }
                                nap->na_fileid = thyp;
                        }
                        attrsum += NFSX_HYPER;
@@ -1740,8 +1752,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd
                                }
                            }
                        } else if (nap != NULL) {
-                           if (*tl++)
-                               printf("NFSv4 mounted on fileid > 32bits\n");
+                           if (*tl++) {
+                               count64mountfileid++;
+                               if (ratecheck(&last64mountfileid, 
&warninterval)) {
+                                       printf("NFSv4 mounted on fileid > 
32bits (%zu occurrences)\n",
+                                           count64mountfileid);
+                                       count64mountfileid = 0;
+                               }
+                           }
                            nap->na_mntonfileno = thyp;
                        }
                        attrsum += NFSX_HYPER;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to