From owner-freebsd-bugs@FreeBSD.ORG Fri Apr 27 05:26:35 2012 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7C47106566B for ; Fri, 27 Apr 2012 05:26:35 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta10.westchester.pa.mail.comcast.net (qmta10.westchester.pa.mail.comcast.net [76.96.62.17]) by mx1.freebsd.org (Postfix) with ESMTP id 727698FC15 for ; Fri, 27 Apr 2012 05:26:35 +0000 (UTC) Received: from omta18.westchester.pa.mail.comcast.net ([76.96.62.90]) by qmta10.westchester.pa.mail.comcast.net with comcast id 2tQ51j0011wpRvQ5AtSWH2; Fri, 27 Apr 2012 05:26:30 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta18.westchester.pa.mail.comcast.net with comcast id 2tST1j00R1t3BNj3etSUoa; Fri, 27 Apr 2012 05:26:28 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id EA71E102C1E; Thu, 26 Apr 2012 22:26:27 -0700 (PDT) Resent-From: Jeremy Chadwick Resent-Date: Thu, 26 Apr 2012 22:26:27 -0700 Resent-Message-ID: <20120427052627.GA89388@icarus.home.lan> Resent-To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org Date: Thu, 26 Apr 2012 22:17:56 -0700 From: Jeremy Chadwick To: John Baldwin Message-ID: <20120427051756.GA89097@icarus.home.lan> References: <201204260930.01677.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201204260930.01677.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: kern/167321: [sysctl] [patch] Implement sysctl to control kernel accounting log messages (e.g. acct(2)) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2012 05:26:35 -0000 On Thu, Apr 26, 2012 at 09:30:01AM -0400, John Baldwin wrote: > Hmm, reading the rc.d script and the kernel code, it is not clear to me why > you are seeing "Accounting disabled" messages at all. You should be seeing > two "Accounting enabled" messages, but no disabled. Taken from our logs on one box (but they all show the same behaviour): /var/log/messages:Apr 26 00:39:47 ra kernel: Accounting enabled /var/log/messages:Apr 26 03:01:00 ra kernel: Accounting disabled /var/log/messages:Apr 26 03:01:00 ra kernel: Accounting enabled /var/log/messages:Apr 26 03:01:00 ra kernel: Accounting disabled /var/log/messages:Apr 26 03:01:00 ra kernel: Accounting enabled /var/log/messages:Apr 26 04:38:40 ra kernel: Accounting disabled 00:39 = when we enabled accounting for the very first time 03:01 = entries caused by periodic script 04:38 = when we disabled accounting due to this problem. > However, it seems that the 'rotate_log' command in > /etc/rc.d/accounting can be simplified. The kernel doesn't care about > the pathname, so it doesn't need to have accton re- run when the file > is renamed from its temporary filename to it's full name. > > You could then update the acct() system call to not log the message > when accounting is switched from one file to another atomically. I > think these two changes will address your problem while preserving the > useful logging: Your kernel patch looks a *lot* more elegant and logical (yep I understand it :-) ). I'll give it a try on my home machine here and report back the results. Might be a few days though given health problems and doctors visits going on. Thanks as usual, John! -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB | > Index: etc/rc.d/accounting > =================================================================== > --- etc/rc.d/accounting (revision 234685) > +++ etc/rc.d/accounting (working copy) > @@ -65,9 +65,7 @@ > mv ${accounting_file} ${accounting_file}.0 > > if checkyesno accounting_enable; then > - ln $_file ${accounting_file##*/} > - ${accounting_command} ${accounting_file} > - unlink $_file > + mv $_file ${accounting_file} > fi > } > > Index: sys/kern/kern_acct.c > =================================================================== > --- sys/kern/kern_acct.c (revision 234685) > +++ sys/kern/kern_acct.c (working copy) > @@ -297,9 +297,11 @@ > return (error); > } > } > - acct_configured = 1; > + if (!acct_configured) { > + acct_configured = 1; > + log(LOG_NOTICE, "Accounting enabled\n"); > + } > sx_xunlock(&acct_sx); > - log(LOG_NOTICE, "Accounting enabled\n"); > return (error); > } > > > -- > John Baldwin