linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: remove OPT_acl parse when acl disabled
@ 2014-05-08  4:56 Guangliang Zhao
  2014-05-09 13:21 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Guangliang Zhao @ 2014-05-08  4:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: lucienchao

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.

Signed-off-by: Guangliang Zhao <lucienchao@gmail.com>
---
 fs/btrfs/super.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 363404b..68ae27c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: remove OPT_acl parse when acl disabled
  2014-05-08  4:56 [PATCH] Btrfs: remove OPT_acl parse when acl disabled Guangliang Zhao
@ 2014-05-09 13:21 ` David Sterba
  2014-05-12  2:42   ` Guangliang Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2014-05-09 13:21 UTC (permalink / raw)
  To: Guangliang Zhao; +Cc: linux-btrfs

On Thu, May 08, 2014 at 12:56:32PM +0800, Guangliang Zhao wrote:
> 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.
> 
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -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.

>  		case Opt_noacl:
>  			root->fs_info->sb->s_flags &= ~MS_POSIXACL;
>  			break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: remove OPT_acl parse when acl disabled
  2014-05-09 13:21 ` David Sterba
@ 2014-05-12  2:42   ` Guangliang Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Guangliang Zhao @ 2014-05-12  2:42 UTC (permalink / raw)
  To: dsterba, linux-btrfs

On Fri, May 09, 2014 at 03:21:09PM +0200, David Sterba wrote:
> On Thu, May 08, 2014 at 12:56:32PM +0800, Guangliang Zhao wrote:
> > 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.
> > 
> > --- a/fs/btrfs/super.c
> > +++ b/fs/btrfs/super.c
> > @@ -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.

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

> 
> 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.
> 
> >  		case Opt_noacl:
> >  			root->fs_info->sb->s_flags &= ~MS_POSIXACL;
> >  			break;

-- 
Best regards,
Guangliang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-12  2:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-08  4:56 [PATCH] Btrfs: remove OPT_acl parse when acl disabled Guangliang Zhao
2014-05-09 13:21 ` David Sterba
2014-05-12  2:42   ` Guangliang Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).