From owner-p4-projects Thu Oct 24 13:51:28 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8DFF337B401; Thu, 24 Oct 2002 13:51:25 -0700 (PDT) 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 240B737B404 for ; Thu, 24 Oct 2002 13:51:25 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8195543E3B for ; Thu, 24 Oct 2002 13:51:24 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id g9OKodmV028816 for ; Thu, 24 Oct 2002 13:50:39 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id g9OKocfP028813 for perforce@freebsd.org; Thu, 24 Oct 2002 13:50:38 -0700 (PDT) Date: Thu, 24 Oct 2002 13:50:38 -0700 (PDT) Message-Id: <200210242050.g9OKocfP028813@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 Subject: PERFORCE change 20080 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=20080 Change 20080 by rwatson@rwatson_tislabs on 2002/10/24 13:50:12 Avoid warning more than once per boot about the EA transaction issue if there's a file system that doesn't support EA transactions and yet has been frobbed by MAC as multilabel on extended attributes. While I'm here, document lack of locking on mac_late and ea_warn_once, and suggest why that's OK. Affected files ... .. //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#328 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/kern/kern_mac.c#328 (text+ko) ==== @@ -110,8 +110,19 @@ SYSCTL_UINT(_security_mac, OID_AUTO, max_policies, CTLFLAG_RD, &mac_max_policies, 0, ""); +/* + * Has the kernel started generating labeled objects yet? All read/write + * access to this variable is serialized during the boot process. Following + * the end of serialization, we don't update this flag; no locking. + */ static int mac_late = 0; +/* + * Warn about EA transactions only the first time they happen. + * Weak coherency, no locking. + */ +static int ea_warn_once = 0; + static int mac_enforce_fs = 1; SYSCTL_INT(_security_mac, OID_AUTO, enforce_fs, CTLFLAG_RW, &mac_enforce_fs, 0, "Enforce MAC policy on file system objects"); @@ -1803,7 +1814,11 @@ error = VOP_OPENEXTATTR(vp, cred, curthread); if (error == EOPNOTSUPP) { /* XXX: Optionally abort if transactions not supported. */ - printf("Warning: transactions not supported in EA write.\n"); + if (ea_warn_once == 0) { + printf("Warning: transactions not supported " + "in EA write.\n"); + ea_warn_once = 1; + } } else if (error) return (error); @@ -1834,7 +1849,11 @@ error = VOP_OPENEXTATTR(vp, cred, curthread); if (error == EOPNOTSUPP) { /* XXX: Optionally abort if transactions not supported. */ - printf("Warning: transactions not supported in EA write.\n"); + if (ea_warn_once == 0) { + printf("Warning: transactions not supported " + "in EA write.\n"); + ea_warn_once = 1; + } } else if (error) return (error); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message