Btrfs: remove OPT_acl parse when acl disabled
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
@@ -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
Quoted 8 lines · Guangliang Zhao
Even
CONFIG_BTRFS_FS_POSIX_ACLis not defined, the acl still could been enabled using a mount option, and nowfs/btrfs/acl.ois 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
-0case Opt_noacl: root->fs_info->sb->s_flags &= ~MS_POSIXACL ;break ;
Quoted 20 lines · David Sterba
Quoted 8 lines · Guangliang Zhao
Even
CONFIG_BTRFS_FS_POSIX_ACLis not defined, the acl still could been enabled using a mount option, and nowfs/btrfs/acl.ois 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_acland 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
-0case Opt_noacl: root->fs_info->sb->s_flags &= ~MS_POSIXACL ;break ;
Signature · 2 lines
Best regards, Guangliang