linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: linux-nilfs@vger.kernel.org
Subject: Re: [PATCH V2] nilfs2: convert to use the new mount API
Date: Tue, 9 Apr 2024 14:54:27 -0500	[thread overview]
Message-ID: <55663cac-42e0-4be6-9f3a-e3f9f3d1ab50@redhat.com> (raw)
In-Reply-To: <CAKFNMonx-qZPUn6-qCFGbiFd06K-3bjsHyaw+rw_uq3YU_m=9w@mail.gmail.com>

On 4/9/24 2:13 PM, Ryusuke Konishi wrote:
> Thank you for waiting.  I've finished the full review.
> 
> I'll comment below, inline.
> First let me say that this patch is great and I don't see any points
> that need major rewrites.

Thanks!

> Regarding style warnings, I will reply to that email later.
> 
> On Fri, Apr 5, 2024 at 12:00 PM Eric Sandeen wrote:
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---

...

>> -static int parse_options(char *options, struct super_block *sb, int is_remount)
>> -{
>> -       struct the_nilfs *nilfs = sb->s_fs_info;
>> -       char *p;
>> -       substring_t args[MAX_OPT_ARGS];
>> -
>> -       if (!options)
>> -               return 1;
>> -
>> -       while ((p = strsep(&options, ",")) != NULL) {
>> -               int token;
>> +const struct fs_parameter_spec nilfs_param_spec[] = {
>> +       fsparam_enum    ("errors", Opt_err, nilfs_param_err),
>> +       fsparam_flag_no ("barrier", Opt_barrier),
> 
>> +       fsparam_u32     ("cp", Opt_snapshot),
> 
> Checkpoint numbers require a 64-bit unsigned integer parser
> (originally parsed by kstrtoull()), so I think you should use
> fsparam_u64 here.
> Since nilfs_parse_param() was written assuming fsparam_u64, I guess
> this is a simple mistake.

Yep, I think I mechanically changed anything like

{Opt_snapshot, "cp=%u"}

to _u32, and missed how the actual parsing works.
 
> Also, "nilfs_param_spec" is not declared with the "static" class
> specifier, so could you please add it ?

Sure thing

...

>> +               if (is_remount) {
>> +                       struct super_block *sb = fc->root->d_sb;
>> +                       nilfs_err(sb,
>> +                                 "\"%s\" option is invalid for remount",
>> +                                 param->key);
>> +                       return -EINVAL;
>>                 }
> 
>> +               if (result.uint_64 == 0)
>> +                       return -EINVAL;
> 
> For the case where the "cp=0" invalid option is specified, could you
> please output the following error message with nilfs_err() as before ?
> 
>    "invalid option \"cp=0\": invalid checkpoint number 0"
> 
> Other similar messages seem to overlap with the message output by
> fs_parser routines, so I think just adding this one is sufficient.

*nod* good catch

...

> 
>>         sb->s_flags = (sb->s_flags & ~SB_POSIXACL);
> 
> This "s_flags" adjustment overlaps with the flag adjustment just
> before returning with normal status.
> I think there is no problem with deleting this.

Ah, I think you are right. Will make sure nothing depends on the sb
flags before then, though.

...

>> @@ -1180,130 +1163,57 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
>>                 root = NILFS_I(d_inode(sb->s_root))->i_root;
> 
>>                 err = nilfs_attach_log_writer(sb, root);
>>                 if (err)
>> -                       goto restore_opts;
>> +                       goto ignore_opts;
> 
> Here, if nilfs_attach_log_writer() fails, it will return via
> "ignore_opts" without restoring the SB_RDONLY flag in sb->s_flags.
> I think it is necessary to repair the flag only for this error path,
> what do you think?

Again, I think you are right, although maybe if the above flags copy is
moved to the end, it won't be a problem? I'll look more closely.
 
...

> 
>> +       if (ctx->cno && !(fc->sb_flags & SB_RDONLY)) {
>> +               nilfs_err(s, "invalid option \"cn=%llu\", "
>> +                       "read-only option is not specified",
>> +                       ctx->cno);
>> +               return -EINVAL;
>> +       }
> 
> This error check conversion (to check after the read-only flag is
> determined) is ok.
> But, the option name in the error message has changed, so please correct it.
> The original message looks like
> 
>   "invalid option \"cp=%llu\": read-only option is not specified"

Whoops, I think that's just a typo.
 
> The checkpoint number expression cannot be reproduced to be exactly
> the same as the input (as in the case where the radix is specified
> like "cp=0x123") but I think it's acceptable.

Yup - that's a difference w/ the new mount API, I think - all of the mount
options need to be parsed independently, and we can only look for invalid
combinations after that's all done and by then we onlly have the value, not
the original format or string.

If you would like to keep the original format of the option, we could store
it in the fs_context as a string (I think) and emit that in the error message.
Worth it?

Thanks,

-Eric

> 
> That's all for the non-style issue comments.
> 
> Thanks,
> Ryusuke Konishi
	


  reply	other threads:[~2024-04-09 19:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 22:12 [PATCH] nilfs2: convert to use the new mount API Eric Sandeen
2024-04-04 20:11 ` Ryusuke Konishi
2024-04-04 20:35   ` Eric Sandeen
2024-04-04 22:33     ` Ryusuke Konishi
2024-04-05  1:21       ` Eric Sandeen
2024-04-05  1:46         ` Eric Sandeen
2024-04-05  3:00           ` [PATCH V2] " Eric Sandeen
2024-04-05 10:33             ` Ryusuke Konishi
2024-04-05 15:03               ` Eric Sandeen
2024-04-09 20:17                 ` Ryusuke Konishi
2024-04-09 19:13             ` Ryusuke Konishi
2024-04-09 19:54               ` Eric Sandeen [this message]
2024-04-09 20:36                 ` Ryusuke Konishi
2024-04-10 12:47                 ` Ryusuke Konishi

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=55663cac-42e0-4be6-9f3a-e3f9f3d1ab50@redhat.com \
    --to=sandeen@redhat.com \
    --cc=konishi.ryusuke@gmail.com \
    --cc=linux-nilfs@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).