Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2002 13:50:38 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 20080 for review
Message-ID:  <200210242050.g9OKocfP028813@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210242050.g9OKocfP028813>