[Top] [All Lists]

[PATCH xfstests] _qmount: mount w/o selinux xattrs

To: xfs mailing list <xfs@xxxxxxxxxxx>
Subject: [PATCH xfstests] _qmount: mount w/o selinux xattrs
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Thu, 01 Jul 2010 14:58:07 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100301 Fedora/3.0.3-1.fc11 Lightning/1.0b2pre Thunderbird/3.0.3
when selinux is on it can change quota usage due to extra
xattr blocks.

Mounting with a context prevents this.  We already do so
for xfs in general because so many things look at detailed
on-disk format, and extra xattrs confuses those tests.

For other filesystems, we've left selinux alone so far, 
as that seemed the best way to test.

However, it throws quota accounting off, so add a fixup
in _qmount()

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

diff --git a/common.quota b/common.quota
index d32e285..87a766c 100644
--- a/common.quota
+++ b/common.quota
@@ -131,8 +131,17 @@ _choose_prid()
+    # SELinux adds extra xattrs which can mess up our expected usage.
+    # So, mount with a context, and they won't be created
+    # nfs_t is a "liberal" context so we can use it.
+    # Only set it if we didn't inherit SELINUX_MOUNT_OPTIONS for
+    # all mounts anyway.
+    if [ -z "$SELINUX_MOUNT_OPTIONS" -a -x /usr/sbin/selinuxenabled ] && 
/usr/sbin/selinuxenabled; then
+        QUOTA_SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
+    fi
     umount $SCRATCH_DEV >/dev/null 2>&1
-    _scratch_mount || _fail "qmount failed"
+    _scratch_mount $QUOTA_SELINUX_MOUNT_OPTIONS || _fail "qmount failed"
     chmod ugo+rwx $SCRATCH_MNT

<Prev in Thread] Current Thread [Next in Thread>