From owner-p4-projects@FreeBSD.ORG Sun Mar 19 20:25:27 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9EC3E16A423; Sun, 19 Mar 2006 20:25:27 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E39A16A401 for ; Sun, 19 Mar 2006 20:25:27 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0D7F443D49 for ; Sun, 19 Mar 2006 20:25:27 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2JKPQHl023422 for ; Sun, 19 Mar 2006 20:25:26 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2JKPQYd023419 for perforce@freebsd.org; Sun, 19 Mar 2006 20:25:26 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 19 Mar 2006 20:25:26 GMT Message-Id: <200603192025.k2JKPQYd023419@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 93596 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Mar 2006 20:25:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=93596 Change 93596 by rwatson@rwatson_peppercorn on 2006/03/19 20:24:58 No longer unconditionally drain the audit record queue if there is not an active audit trail: instead, continue to iterate through each record in case an audit pipe is interested. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_worker.c#8 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_worker.c#8 (text+ko) ==== @@ -304,24 +304,6 @@ } /* - * Drain the audit commit queue and free the records. Used if there are - * records present, but no audit log target. - */ -static void -audit_worker_drain(void) -{ - struct kaudit_record *ar; - - mtx_assert(&audit_mtx, MA_OWNED); - - while ((ar = TAILQ_FIRST(&audit_q))) { - TAILQ_REMOVE(&audit_q, ar, k_q); - audit_free(ar); - audit_q_len--; - } -} - -/* * Given a kernel audit record, process as required. Kernel audit records * are converted to one, or possibly two, BSM records, depending on whether * there is a user audit record present also. Kernel records need be @@ -424,23 +406,11 @@ audit_worker_rotate(&audit_cred, &audit_vp, audit_td); /* - * If we have records, but there's no active vnode to write - * to, drain the record queue. Generally, we prevent the - * unnecessary allocation of records elsewhere, but we need - * to allow for races between conditional allocation and - * queueing. Go back to waiting when we're done. - */ - if (audit_vp == NULL) { - audit_worker_drain(); - continue; - } - - /* - * We have both records to write and an active vnode to write - * to. Dequeue a record, and start the write. Eventually, - * it might make sense to dequeue several records and perform - * our own clustering, if the lower layers aren't doing it - * automatically enough. + * If there are records in the global audit record queue, + * transfer them to a thread-local queue and process them + * one by one. If we cross the low watermark threshold, + * signal any waiting processes that they may wake up and + * continue generating records. */ lowater_signal = 0; while ((ar = TAILQ_FIRST(&audit_q))) {