Jesse Keating 3494df0
From: Shi Weihua <shiwh@cn.fujitsu.com>
Jesse Keating 3494df0
Date: Tue, 18 May 2010 00:51:54 +0000 (+0000)
Jesse Keating 3494df0
Subject: Btrfs: prohibit a operation of changing acl's mask when noacl mount option used
Jesse Keating 3494df0
X-Git-Tag: v2.6.35-rc3~3^2~3
Jesse Keating 3494df0
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=731e3d1b
Jesse Keating 3494df0
Jesse Keating 3494df0
Btrfs: prohibit a operation of changing acl's mask when noacl mount option used
Jesse Keating 3494df0
Jesse Keating 3494df0
when used Posix File System Test Suite(pjd-fstest) to test btrfs,
Jesse Keating 3494df0
some cases about setfacl failed when noacl mount option used.
Jesse Keating 3494df0
I simplified used commands in pjd-fstest, and the following steps
Jesse Keating 3494df0
can reproduce it.
Jesse Keating 3494df0
------------------------
Jesse Keating 3494df0
# cd btrfs-part/
Jesse Keating 3494df0
# mkdir aaa
Jesse Keating 3494df0
# setfacl -m m::rw aaa    <- successed, but not expected by pjd-fstest.
Jesse Keating 3494df0
------------------------
Jesse Keating 3494df0
I checked ext3, a warning message occured, like as:
Jesse Keating 3494df0
  setfacl: aaa/: Operation not supported
Jesse Keating 3494df0
Certainly, it's expected by pjd-fstest.
Jesse Keating 3494df0
Jesse Keating 3494df0
So, i compared acl.c of btrfs and ext3. Based on that, a patch created.
Jesse Keating 3494df0
Fortunately, it works.
Jesse Keating 3494df0
Jesse Keating 3494df0
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Jesse Keating 3494df0
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Jesse Keating 3494df0
---
Jesse Keating 3494df0
Jesse Keating 3494df0
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
Jesse Keating 3494df0
index 6b4d0cc..a372985 100644
Jesse Keating 3494df0
--- a/fs/btrfs/acl.c
Jesse Keating 3494df0
+++ b/fs/btrfs/acl.c
Jesse Keating 3494df0
@@ -163,6 +163,9 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
Jesse Keating 3494df0
 	if (!is_owner_or_cap(dentry->d_inode))
Jesse Keating 3494df0
 		return -EPERM;
Jesse Keating 3494df0
 
Jesse Keating 3494df0
+	if (!IS_POSIXACL(dentry->d_inode))
Jesse Keating 3494df0
+		return -EOPNOTSUPP;
Jesse Keating 3494df0
+
Jesse Keating 3494df0
 	if (value) {
Jesse Keating 3494df0
 		acl = posix_acl_from_xattr(value, size);
Jesse Keating 3494df0
 		if (acl == NULL) {