From: Eric Sandeen <sandeen@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Bill O'Donnell <billodo@redhat.com>,
David Howells <dhowells@redhat.com>
Subject: Re: [PATCH] udf: convert to new mount API
Date: Mon, 12 Feb 2024 14:31:10 -0600 [thread overview]
Message-ID: <1adcfcc9-5ac8-4a53-a6a5-e8b9b41a9a83@redhat.com> (raw)
In-Reply-To: <739fe39a-0401-4f5d-aef7-759ef82b36bd@redhat.com>
On 2/9/24 1:43 PM, Eric Sandeen wrote:
> Convert the UDF filesystem to the new mount API.
>
> UDF is slightly unique in that it always preserves prior mount
> options across a remount, so that's handled by udf_init_options().
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> Tested by running through xfstests, as well as some targeted testing of
> remount behavior.
>
> NB: I did not convert i.e any udf_err() to errorf(fc, ) because the former
> does some nice formatting, not sure how or if you'd like to handle that, Jan?
>
> fs/udf/super.c | 495 +++++++++++++++++++++++++------------------------
> 1 file changed, 255 insertions(+), 240 deletions(-)
>
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 928a04d9d9e0..03fa98fe4e1c 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
...
> + case Opt_gid:
> + if (0 == kstrtoint(param->string, 10, &uv)) {
> uopt->gid = make_kgid(current_user_ns(), uv);
> if (!gid_valid(uopt->gid))
> - return 0;
> + return -EINVAL;
> uopt->flags |= (1 << );
> - break;
> - case Opt_uid:
> - if (match_uint(args, &uv))
> - return 0;
> + } else if (!strcmp(param->string, "forget")) {
> + uopt->flags |= (1 << UDF_FLAG_GID_FORGET);
> + } else if (!strcmp(param->string, "ignore")) {
> + /* this option is superseded by gid=<number> */
> + ;
> + } else {
> + return -EINVAL;
> + }
> + break;
I wonder if I need to redo this and not directly set the make_kgid option
into uopt->gid. We do test that uopt->gid is valid, and return an error, and
skip setting UDF_FLAG_GID_SET, but ...
...
> -static int udf_fill_super(struct super_block *sb, void *options, int silent)
> +static int udf_fill_super(struct super_block *sb, struct fs_context *fc)
> {
> int ret = -EINVAL;
> struct inode *inode = NULL;
> - struct udf_options uopt;
> + struct udf_options *uopt = fc->fs_private;
> struct kernel_lb_addr rootdir, fileset;
> struct udf_sb_info *sbi;
> bool lvid_open = false;
> -
> - uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
> - /* By default we'll use overflow[ug]id when UDF inode [ug]id == -1 */
> - uopt.uid = make_kuid(current_user_ns(), overflowuid);
> - uopt.gid = make_kgid(current_user_ns(), overflowgid);
this initialization (now moved to udf_init_options) gets overwritten
even if the [gu]id was invalid during parsing ...
> + sbi->s_flags = uopt->flags;
> + sbi->s_uid = uopt->uid;
> + sbi->s_gid = uopt->gid;
... and gets set into sbi here.
In the past (I think) the whole mount would fail with an invalid UID/GID but w/
fsconfig, we could just fail that one config and continue with the rest.
It looks like sbi->s_[gu]id is not accessed unless UDF_FLAG_[GU]ID_SET is
set, but maybe it's best to never set something invalid into the uopt.
-Eric
next prev parent reply other threads:[~2024-02-12 20:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 19:43 [PATCH] udf: convert to new mount API Eric Sandeen
2024-02-12 20:31 ` Eric Sandeen [this message]
2024-02-13 12:51 ` Jan Kara
2024-02-13 12:49 ` Jan Kara
2024-02-13 23:01 ` Eric Sandeen
2024-02-13 23:11 ` Eric Sandeen
2024-02-14 11:27 ` Jan Kara
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=1adcfcc9-5ac8-4a53-a6a5-e8b9b41a9a83@redhat.com \
--to=sandeen@redhat.com \
--cc=billodo@redhat.com \
--cc=dhowells@redhat.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).