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
This commit is contained in:
Colin Percival 2016-11-16 01:11:49 +00:00
parent 320ab9c026
commit 63659ba6df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308708

View File

@ -827,6 +827,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
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, vnode_t vp,
*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, vnode_t vp,
}
}
} 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;