From: Li Zetao <lizetao1@huawei.com> To: <richard@nod.at>, <chengzhihao1@huawei.com> Cc: <lizetao1@huawei.com>, <linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org> Subject: [RFC PATCH 4/5] ubifs: Introduce ACLs mount options Date: Wed, 20 Mar 2024 00:16:45 +0800 [thread overview] Message-ID: <20240319161646.2153867-5-lizetao1@huawei.com> (raw) In-Reply-To: <20240319161646.2153867-1-lizetao1@huawei.com> Implement the ability to enable or disable the ACLs feature through mount options. "-o acl" option means enable and "-o noacl" means disable and it is enable by default. Signed-off-by: Li Zetao <lizetao1@huawei.com> --- fs/ubifs/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ fs/ubifs/ubifs.h | 2 ++ 2 files changed, 42 insertions(+) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 7f4031a15f4d..ed03bf11e51d 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -457,6 +457,13 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",assert=%s", ubifs_assert_action_name(c)); seq_printf(s, ",ubi=%d,vol=%d", c->vi.ubi_num, c->vi.vol_id); +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + if (c->mount_opts.acl == 2) + seq_puts(s, ",acl"); + else if (c->mount_opts.acl == 1) + seq_puts(s, ",noacl"); +#endif + return 0; } @@ -967,6 +974,8 @@ static int check_volume_empty(struct ubifs_info *c) * Opt_assert: set ubifs_assert() action * Opt_auth_key: The key name used for authentication * Opt_auth_hash_name: The hash type used for authentication + * Opt_acl: enable posix acl + * Opt_noacl: disable posix acl * Opt_err: just end of array marker */ enum { @@ -981,6 +990,8 @@ enum { Opt_auth_key, Opt_auth_hash_name, Opt_ignore, + Opt_acl, + Opt_noacl, Opt_err, }; @@ -997,6 +1008,8 @@ static const match_table_t tokens = { {Opt_ignore, "ubi=%s"}, {Opt_ignore, "vol=%s"}, {Opt_assert, "assert=%s"}, + {Opt_acl, "acl"}, + {Opt_noacl, "noacl"}, {Opt_err, NULL}, }; @@ -1137,6 +1150,23 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, break; case Opt_ignore: break; +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + case Opt_acl: + c->mount_opts.acl = 2; + c->vfs_sb->s_flags |= SB_POSIXACL; + break; + case Opt_noacl: + c->mount_opts.acl = 1; + c->vfs_sb->s_flags &= ~SB_POSIXACL; + break; +#else + case Opt_acl: + ubifs_err(c, "acl options not supported"); + return -EINVAL; + case Opt_noacl: + ubifs_err(c, "noacl options not supported"); + return -EINVAL; +#endif default: { unsigned long flag; @@ -2011,12 +2041,17 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) sync_filesystem(sb); dbg_gen("old flags %#lx, new flags %#x", sb->s_flags, *flags); + c->mount_opts.acl = 0; err = ubifs_parse_options(c, data, 1); if (err) { ubifs_err(c, "invalid or unknown remount parameter"); return err; } +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + if (!c->mount_opts.acl) + c->vfs_sb->s_flags |= SB_POSIXACL; +#endif if (c->ro_mount && !(*flags & SB_RDONLY)) { if (c->ro_error) { ubifs_msg(c, "cannot re-mount R/W due to prior errors"); @@ -2197,6 +2232,11 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) if (err) goto out_close; +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + if (!c->mount_opts.acl) + c->vfs_sb->s_flags |= SB_POSIXACL; +#endif + /* * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For * UBIFS, I/O is not deferred, it is done immediately in read_folio, diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index b0d3b076290d..4a6078cbb2f5 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -956,6 +956,7 @@ struct ubifs_orphan { * specified in @compr_type) * @compr_type: compressor type to override the superblock compressor with * (%UBIFS_COMPR_NONE, etc) + * @acl: enable/disable posix acl (%0 default, %1 disable, %2 enable) */ struct ubifs_mount_opts { unsigned int unmount_mode:2; @@ -963,6 +964,7 @@ struct ubifs_mount_opts { unsigned int chk_data_crc:2; unsigned int override_compr:1; unsigned int compr_type:2; + unsigned int acl:2; }; /** -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Li Zetao <lizetao1@huawei.com> To: <richard@nod.at>, <chengzhihao1@huawei.com> Cc: <lizetao1@huawei.com>, <linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org> Subject: [RFC PATCH 4/5] ubifs: Introduce ACLs mount options Date: Wed, 20 Mar 2024 00:16:45 +0800 [thread overview] Message-ID: <20240319161646.2153867-5-lizetao1@huawei.com> (raw) In-Reply-To: <20240319161646.2153867-1-lizetao1@huawei.com> Implement the ability to enable or disable the ACLs feature through mount options. "-o acl" option means enable and "-o noacl" means disable and it is enable by default. Signed-off-by: Li Zetao <lizetao1@huawei.com> --- fs/ubifs/super.c | 40 ++++++++++++++++++++++++++++++++++++++++ fs/ubifs/ubifs.h | 2 ++ 2 files changed, 42 insertions(+) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 7f4031a15f4d..ed03bf11e51d 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -457,6 +457,13 @@ static int ubifs_show_options(struct seq_file *s, struct dentry *root) seq_printf(s, ",assert=%s", ubifs_assert_action_name(c)); seq_printf(s, ",ubi=%d,vol=%d", c->vi.ubi_num, c->vi.vol_id); +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + if (c->mount_opts.acl == 2) + seq_puts(s, ",acl"); + else if (c->mount_opts.acl == 1) + seq_puts(s, ",noacl"); +#endif + return 0; } @@ -967,6 +974,8 @@ static int check_volume_empty(struct ubifs_info *c) * Opt_assert: set ubifs_assert() action * Opt_auth_key: The key name used for authentication * Opt_auth_hash_name: The hash type used for authentication + * Opt_acl: enable posix acl + * Opt_noacl: disable posix acl * Opt_err: just end of array marker */ enum { @@ -981,6 +990,8 @@ enum { Opt_auth_key, Opt_auth_hash_name, Opt_ignore, + Opt_acl, + Opt_noacl, Opt_err, }; @@ -997,6 +1008,8 @@ static const match_table_t tokens = { {Opt_ignore, "ubi=%s"}, {Opt_ignore, "vol=%s"}, {Opt_assert, "assert=%s"}, + {Opt_acl, "acl"}, + {Opt_noacl, "noacl"}, {Opt_err, NULL}, }; @@ -1137,6 +1150,23 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, break; case Opt_ignore: break; +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + case Opt_acl: + c->mount_opts.acl = 2; + c->vfs_sb->s_flags |= SB_POSIXACL; + break; + case Opt_noacl: + c->mount_opts.acl = 1; + c->vfs_sb->s_flags &= ~SB_POSIXACL; + break; +#else + case Opt_acl: + ubifs_err(c, "acl options not supported"); + return -EINVAL; + case Opt_noacl: + ubifs_err(c, "noacl options not supported"); + return -EINVAL; +#endif default: { unsigned long flag; @@ -2011,12 +2041,17 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) sync_filesystem(sb); dbg_gen("old flags %#lx, new flags %#x", sb->s_flags, *flags); + c->mount_opts.acl = 0; err = ubifs_parse_options(c, data, 1); if (err) { ubifs_err(c, "invalid or unknown remount parameter"); return err; } +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + if (!c->mount_opts.acl) + c->vfs_sb->s_flags |= SB_POSIXACL; +#endif if (c->ro_mount && !(*flags & SB_RDONLY)) { if (c->ro_error) { ubifs_msg(c, "cannot re-mount R/W due to prior errors"); @@ -2197,6 +2232,11 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) if (err) goto out_close; +#ifdef CONFIG_UBIFS_FS_POSIX_ACL + if (!c->mount_opts.acl) + c->vfs_sb->s_flags |= SB_POSIXACL; +#endif + /* * UBIFS provides 'backing_dev_info' in order to disable read-ahead. For * UBIFS, I/O is not deferred, it is done immediately in read_folio, diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index b0d3b076290d..4a6078cbb2f5 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -956,6 +956,7 @@ struct ubifs_orphan { * specified in @compr_type) * @compr_type: compressor type to override the superblock compressor with * (%UBIFS_COMPR_NONE, etc) + * @acl: enable/disable posix acl (%0 default, %1 disable, %2 enable) */ struct ubifs_mount_opts { unsigned int unmount_mode:2; @@ -963,6 +964,7 @@ struct ubifs_mount_opts { unsigned int chk_data_crc:2; unsigned int override_compr:1; unsigned int compr_type:2; + unsigned int acl:2; }; /** -- 2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-03-19 16:16 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-19 16:16 [RFC PATCH 0/5] ubifs: Support POSIX Access Control Lists (ACLs) Li Zetao 2024-03-19 16:16 ` Li Zetao 2024-03-19 16:16 ` [RFC PATCH 1/5] ubifs: Implement " Li Zetao 2024-03-19 16:16 ` Li Zetao 2024-03-21 2:55 ` Zhihao Cheng 2024-03-21 2:55 ` Zhihao Cheng 2024-03-22 11:36 ` Li Zetao 2024-03-22 11:36 ` Li Zetao 2024-03-19 16:16 ` [RFC PATCH 2/5] ubifs: Initialize or update ACLs for inode Li Zetao 2024-03-19 16:16 ` Li Zetao 2024-03-21 3:47 ` Zhihao Cheng 2024-03-21 3:47 ` Zhihao Cheng 2024-03-22 11:57 ` Li Zetao 2024-03-22 11:57 ` Li Zetao 2024-03-22 12:07 ` Zhihao Cheng 2024-03-22 12:07 ` Zhihao Cheng 2024-03-19 16:16 ` [RFC PATCH 3/5] ubifs: Support accessing ACLs through inode_operations Li Zetao 2024-03-19 16:16 ` Li Zetao 2024-03-19 16:16 ` Li Zetao [this message] 2024-03-19 16:16 ` [RFC PATCH 4/5] ubifs: Introduce ACLs mount options Li Zetao 2024-03-21 6:49 ` Zhihao Cheng 2024-03-21 6:49 ` Zhihao Cheng 2024-03-22 12:05 ` Li Zetao 2024-03-22 12:05 ` Li Zetao 2024-03-22 12:10 ` Zhihao Cheng 2024-03-22 12:10 ` Zhihao Cheng 2024-03-19 16:16 ` [RFC PATCH 5/5] ubifs: Add ACLs config option Li Zetao 2024-03-19 16:16 ` Li Zetao
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240319161646.2153867-5-lizetao1@huawei.com \ --to=lizetao1@huawei.com \ --cc=chengzhihao1@huawei.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=richard@nod.at \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.