[PATCH 0/3] fs_parser: handle parameters that can be empty and don't have a value

Luis Henriques posted 3 patches 1 year, 11 months ago
There is a newer version of this series
fs/ext4/super.c       | 4 ++--
fs/fs_parser.c        | 3 ++-
fs/overlayfs/params.c | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
[PATCH 0/3] fs_parser: handle parameters that can be empty and don't have a value
Posted by Luis Henriques 1 year, 11 months ago
While investigating an ext4/053 fstest failure, I realised that when the
flag 'fs_param_can_be_empty' is set in a parameter and it's value is NULL
that parameter isn't being handled as a 'flag' type.  Even if it's type is
set to 'fs_value_is_flag'.  The first patch in this series changes this
behaviour.

Unfortunately, the two filesystems that use this flag (ext4 and overlayfs)
aren't prepared to have the parameter value set to NULL.  Patches #2 and #3
fix this.

Luis Henriques (3):
  fs_parser: handle parameters that can be empty and don't have a value
  ext4: fix mount parameters check for empty values
  overlay: fix mount parameters check for empty values

 fs/ext4/super.c       | 4 ++--
 fs/fs_parser.c        | 3 ++-
 fs/overlayfs/params.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)
Re: [PATCH 0/3] fs_parser: handle parameters that can be empty and don't have a value
Posted by Christian Brauner 1 year, 11 months ago
> Unfortunately, the two filesystems that use this flag (ext4 and overlayfs)
> aren't prepared to have the parameter value set to NULL.  Patches #2 and #3
> fix this.

Both ext4 and overlayfs define

#define fsparam_string_empty(NAME, OPT) \
        __fsparam(fs_param_is_string, NAME, OPT, fs_param_can_be_empty, NULL)

Please add that to include/linux/fs_parser.h so that it can be used by both.
Re: [PATCH 0/3] fs_parser: handle parameters that can be empty and don't have a value
Posted by Eric Sandeen 1 year, 11 months ago
On 3/1/24 7:12 AM, Christian Brauner wrote:
>> Unfortunately, the two filesystems that use this flag (ext4 and overlayfs)
>> aren't prepared to have the parameter value set to NULL.  Patches #2 and #3
>> fix this.
> 
> Both ext4 and overlayfs define
> 
> #define fsparam_string_empty(NAME, OPT) \
>         __fsparam(fs_param_is_string, NAME, OPT, fs_param_can_be_empty, NULL)
> 
> Please add that to include/linux/fs_parser.h so that it can be used by both.

The f2fs conversion will also need this, so yes, it'd be nice to hoist it out
of ext4 and overlayfs.

-Eric