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