Skip to contentSkip to conversation

Btrfs: remove OPT_acl parse when acl disabled

PATCH Superseded Guangliang Zhao 2 participants 3 messages May 8, 2014 – May 12, 2014 Btrfs file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: remove OPT_acl parse when acl disabled

Even CONFIG_BTRFS_FS_POSIX_ACL is not defined, the acl still could been enabled using a mount option, and now fs/btrfs/acl.o is not built, so the mount options will appear to be supported but will be silently ignored.

---
 fs/btrfs/super.c |    2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/super.c +2 -0
index 363404b..68ae27c 100644
@@ -579,9 +579,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
 				goto out;
 			}
 			break;
+#ifdef CONFIG_BTRFS_FS_POSIX_ACL
 		case Opt_acl:
 			root->fs_info->sb->s_flags |= MS_POSIXACL;
 			break;
+#endif
 		case Opt_noacl:
 			root->fs_info->sb->s_flags &= ~MS_POSIXACL;
 			break;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 8 lines · Guangliang Zhao

Even CONFIG_BTRFS_FS_POSIX_ACL is not defined, the acl still could been enabled using a mount option, and now fs/btrfs/acl.o is not built, so the mount options will appear to be supported but will be silently ignored.

fs/btrfs/super.c int btrfs_parse_options(struct btrfs_root *root, char *options) · line 586

Quoted 8 lines
fs/btrfs/super.c +2 -0
@@ -579,9 +579,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
 				goto out;
 			}
 			break;
+#ifdef CONFIG_BTRFS_FS_POSIX_ACL
 		case Opt_acl:
 			root->fs_info->sb->s_flags |= MS_POSIXACL;
 			break;
+#endif

This will still silently accept the 'acl' mount option:

  token = match_token(p, tokens, args);

token will be Opt_acl

and in the switch(token), caught by the default: branch and will return 0.

What' needed here is a #if/#else/#endif sequence where the #else block says that something like "acls requested but not compiled in".

Similar to how the Opt_check_integrity* options are handled.

Quoted 3 lines
fs/btrfs/super.c +0 -0
 		case Opt_noacl:
 			root->fs_info->sb->s_flags &= ~MS_POSIXACL;
 			break;
#2 lore raw
Quoted 20 lines · David Sterba
Quoted 8 lines · Guangliang Zhao

Even CONFIG_BTRFS_FS_POSIX_ACL is not defined, the acl still could been enabled using a mount option, and now fs/btrfs/acl.o is not built, so the mount options will appear to be supported but will be silently ignored.

fs/btrfs/super.c int btrfs_parse_options(struct btrfs_root *root, char *options) · line 586

Quoted 8 lines
fs/btrfs/super.c +2 -0
@@ -579,9 +579,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
 				goto out;
 			}
 			break;
+#ifdef CONFIG_BTRFS_FS_POSIX_ACL
 		case Opt_acl:
 			root->fs_info->sb->s_flags |= MS_POSIXACL;
 			break;
+#endif

This will still silently accept the 'acl' mount option:

Quoted 5 lines
  token = match_token(p, tokens, args);

token will be Opt_acl

and in the switch(token), caught by the default: branch and will return 0.

Didn't take care of it, good catch :-). I will send V2 ASAP.

Quoted 9 lines

What' needed here is a #if/#else/#endif sequence where the #else block says that something like "acls requested but not compiled in".

Similar to how the Opt_check_integrity* options are handled.

Quoted 3 lines
fs/btrfs/super.c +0 -0
 		case Opt_noacl:
 			root->fs_info->sb->s_flags &= ~MS_POSIXACL;
 			break;
Signature · 2 lines
Best regards,
Guangliang