From owner-svn-src-stable-11@freebsd.org Wed Mar 22 12:40:58 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AA2D17897; Wed, 22 Mar 2017 12:40:58 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46F7F1956; Wed, 22 Mar 2017 12:40:58 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1cqfZJ-000KTw-W7; Wed, 22 Mar 2017 15:40:50 +0300 Date: Wed, 22 Mar 2017 15:40:49 +0300 From: Slawa Olhovchenkov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r313450 - in stable/11: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys Message-ID: <20170322124049.GY70430@zxy.spb.ru> References: <201702081832.v18IWZlC001828@repo.freebsd.org> <20170315143053.GW15630@zxy.spb.ru> <18428734.CRRuMZqGsJ@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18428734.CRRuMZqGsJ@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Mar 2017 12:40:58 -0000 On Tue, Mar 21, 2017 at 08:05:31PM -0700, John Baldwin wrote: > On Wednesday, March 15, 2017 05:30:53 PM Slawa Olhovchenkov wrote: > > On Wed, Feb 08, 2017 at 06:32:35PM +0000, John Baldwin wrote: > > > > > Author: jhb > > > Date: Wed Feb 8 18:32:35 2017 > > > New Revision: 313450 > > > URL: https://svnweb.freebsd.org/changeset/base/313450 > > > > > > Log: > > > MFC 310638: > > > Rename the 'flags' argument to getfsstat() to 'mode' and validate it. > > > > > > This argument is not a bitmask of flags, but only accepts a single value. > > > Fail with EINVAL if an invalid value is passed to 'flag'. Rename the > > > 'flags' argument to getmntinfo(3) to 'mode' as well to match. > > > > > > This is a followup to r308088. > > > > > kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, > > > - size_t *countp, enum uio_seg bufseg, int flags) > > > + size_t *countp, enum uio_seg bufseg, int mode) > > > { > > > struct mount *mp, *nmp; > > > struct statfs *sfsp, *sp, *sptmp, *tofree; > > > size_t count, maxcount; > > > int error; > > > > > > + switch (mode) { > > > + case MNT_WAIT: > > > + case MNT_NOWAIT: > > > + break; > > > + default: > > > + return (EINVAL); > > > + } > > > restart: > > > > This is break net-snmp UCD-SNMP-MIB::dskTable oid: > > > > 82434 snmpd CALL getfsstat(0,0,) > > 82434 snmpd RET getfsstat -1 errno 22 Invalid argument > > 82434 snmpd CALL getfsstat(0,0xfffffffffffffe28,MNT_NOWAIT) > > 82434 snmpd RET getfsstat -1 errno 22 Invalid argument > > 82434 snmpd CALL write(0x9,0x800f162ea,0x1) > > This doesn't seem to match the code in the port: > > void > Init_HR_FileSys(void) > { > #if HAVE_GETFSSTAT > #if defined(HAVE_STATVFS) && defined(__NetBSD__) > fscount = getvfsstat(NULL, 0, ST_NOWAIT); > #else > fscount = getfsstat(NULL, 0, MNT_NOWAIT); > #endif > if (fsstats) > free((char *) fsstats); > fsstats = NULL; > fsstats = malloc(fscount * sizeof(*fsstats)); > #if defined(HAVE_STATVFS) && defined(__NetBSD__) > getvfsstat(fsstats, fscount * sizeof(*fsstats), ST_NOWAIT); > #else > getfsstat(fsstats, fscount * sizeof(*fsstats), MNT_NOWAIT); > #endif > HRFS_index = 0; > > (Here it always calls with MNT_NOWAIT) This is for net-snmp 5.7.3, > but it seems like that code hasn't changed in quite a while. I see, strange. I am also use net-snmp 5.7.3 (net-snmp-5.7.3_12). # dtrace -n 'syscall:freebsd:getfsstat:entry { printf("%s %p %d %d\n", execname, args[0], args[1], args[2]); stack(); ustack();}' dtrace: description 'syscall:freebsd:getfsstat:entry ' matched 1 probe CPU ID FUNCTION:NAME 22 43059 getfsstat:entry snmpd 0 0 0 kernel`amd64_syscall+0x36b kernel`0xffffffff8071c84b libc.so.7`getfsstat+0xa libnetsnmpmibs.so.30.0.3`netsnmp_fsys_load+0x9 libnetsnmpagent.so.30.0.3`0x80083dfbf libnetsnmpmibs.so.30.0.3`var_extensible_disk+0x38 libnetsnmpagent.so.30.0.3`netsnmp_old_api_helper+0x18f libnetsnmpagent.so.30.0.3`netsnmp_call_handler+0x134 libnetsnmpagent.so.30.0.3`netsnmp_bulk_to_next_helper+0x1a1 libnetsnmpagent.so.30.0.3`netsnmp_call_handler+0x134 libnetsnmpagent.so.30.0.3`handle_var_requests+0x67 libnetsnmpagent.so.30.0.3`handle_getnext_loop+0x244 libnetsnmpagent.so.30.0.3`netsnmp_handle_request+0x186 libnetsnmpagent.so.30.0.3`handle_snmp_packet+0x140 libnetsnmp.so.30.0.3`0x800ece6c6 libnetsnmp.so.30.0.3`_sess_read+0x5b9 libnetsnmp.so.30.0.3`snmp_read2+0x3b snmpd`0x404cab snmpd`0x40317f ld-elf.so.1`0x800629000 Ok, what is it: /* * Wrapper routine for re-loading filesystem statistics on demand */ int netsnmp_fsys_load( netsnmp_cache *cache, void *data ) { /* XXX - check cache timeliness */ return _fsys_load(); } /* * Architecture-independent processing of loading filesystem statistics */ static int _fsys_load( void ) { netsnmp_fsys_arch_load(); /* XXX - update cache timestamp */ return 0; } agent/mibgroup/hardware/fsys/fsys_getfsstats.c: void netsnmp_fsys_arch_load( void ) { int n, i; struct NSFS_STATFS *stats; netsnmp_fsys_info *entry; /* * Retrieve information about the currently mounted filesystems... */ n = NSFS_GETFSSTAT( NULL, 0, 0 ); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^