2020-09-21 01:12:54

by Gabriel Krisman Bertazi

[permalink] [raw]
Subject: Re: [PATCH v12 4/4] ext4: Use generic casefolding support

Daniel Rosenberg <[email protected]> writes:

> This switches ext4 over to the generic support provided in
> the previous patch.
>
> Since casefolded dentries behave the same in ext4 and f2fs, we decrease
> the maintenance burden by unifying them, and any optimizations will
> immediately apply to both.
>
> Signed-off-by: Daniel Rosenberg <[email protected]>
> Reviewed-by: Eric Biggers <[email protected]>
>
> #ifdef CONFIG_UNICODE
> - if (EXT4_SB(parent->i_sb)->s_encoding && IS_CASEFOLDED(parent)) {
> + if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) {
> if (fname->cf_name.name) {
> struct qstr cf = {.name = fname->cf_name.name,
> .len = fname->cf_name.len};
> @@ -2171,9 +2171,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
> struct buffer_head *bh = NULL;
> struct ext4_dir_entry_2 *de;
> struct super_block *sb;
> -#ifdef CONFIG_UNICODE
> - struct ext4_sb_info *sbi;
> -#endif
> struct ext4_filename fname;
> int retval;
> int dx_fallback=0;
> @@ -2190,9 +2187,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
> return -EINVAL;
>
> #ifdef CONFIG_UNICODE
> - sbi = EXT4_SB(sb);
> - if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) &&
> - sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))
> + if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
> + sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
> return -EINVAL;

hm, just noticed the sb->s_encoding check here is superfluous, since the
has_strict_mode() cannot be true if !s_encoding. Not related to this
patch though.

Daniel, are you still working on getting this upstream? The fscrypt
support would be very useful for us. :)

In the hope this will get upstream, as its been flying for a while and
looks correct.

Reviewed-by: Gabriel Krisman Bertazi <[email protected]>

--
Gabriel Krisman Bertazi


2020-09-21 18:30:32

by Eric Biggers

[permalink] [raw]
Subject: Re: [PATCH v12 4/4] ext4: Use generic casefolding support

On Sun, Sep 20, 2020 at 09:10:57PM -0400, Gabriel Krisman Bertazi wrote:
> Daniel Rosenberg <[email protected]> writes:
>
> > This switches ext4 over to the generic support provided in
> > the previous patch.
> >
> > Since casefolded dentries behave the same in ext4 and f2fs, we decrease
> > the maintenance burden by unifying them, and any optimizations will
> > immediately apply to both.
> >
> > Signed-off-by: Daniel Rosenberg <[email protected]>
> > Reviewed-by: Eric Biggers <[email protected]>
> >
> > #ifdef CONFIG_UNICODE
> > - if (EXT4_SB(parent->i_sb)->s_encoding && IS_CASEFOLDED(parent)) {
> > + if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) {
> > if (fname->cf_name.name) {
> > struct qstr cf = {.name = fname->cf_name.name,
> > .len = fname->cf_name.len};
> > @@ -2171,9 +2171,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
> > struct buffer_head *bh = NULL;
> > struct ext4_dir_entry_2 *de;
> > struct super_block *sb;
> > -#ifdef CONFIG_UNICODE
> > - struct ext4_sb_info *sbi;
> > -#endif
> > struct ext4_filename fname;
> > int retval;
> > int dx_fallback=0;
> > @@ -2190,9 +2187,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
> > return -EINVAL;
> >
> > #ifdef CONFIG_UNICODE
> > - sbi = EXT4_SB(sb);
> > - if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) &&
> > - sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))
> > + if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
> > + sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
> > return -EINVAL;
>
> hm, just noticed the sb->s_encoding check here is superfluous, since the
> has_strict_mode() cannot be true if !s_encoding. Not related to this
> patch though.
>
> Daniel, are you still working on getting this upstream? The fscrypt
> support would be very useful for us. :)
>
> In the hope this will get upstream, as its been flying for a while and
> looks correct.
>
> Reviewed-by: Gabriel Krisman Bertazi <[email protected]>

We couldn't get a response from Ted, so instead Jaegeuk has applied patches 1-3
to f2fs/dev for 5.10. Hopefully Ted will take the ext4 patch for 5.11.

I believe that Daniel is planning to resend the actual encryption+casefolding
support soon, but initially only for f2fs since that will be ready first.

- Eric

2020-09-22 06:27:21

by Daniel Rosenberg

[permalink] [raw]
Subject: Re: [PATCH v12 4/4] ext4: Use generic casefolding support

On Mon, Sep 21, 2020 at 11:29 AM Eric Biggers <[email protected]> wrote:
>
> On Sun, Sep 20, 2020 at 09:10:57PM -0400, Gabriel Krisman Bertazi wrote:
> > Daniel Rosenberg <[email protected]> writes:
> >
> > > This switches ext4 over to the generic support provided in
> > > the previous patch.
> > >
> > > Since casefolded dentries behave the same in ext4 and f2fs, we decrease
> > > the maintenance burden by unifying them, and any optimizations will
> > > immediately apply to both.
> > >
> > > Signed-off-by: Daniel Rosenberg <[email protected]>
> > > Reviewed-by: Eric Biggers <[email protected]>
> > >
> > > #ifdef CONFIG_UNICODE
> > > - if (EXT4_SB(parent->i_sb)->s_encoding && IS_CASEFOLDED(parent)) {
> > > + if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) {
> > > if (fname->cf_name.name) {
> > > struct qstr cf = {.name = fname->cf_name.name,
> > > .len = fname->cf_name.len};
> > > @@ -2171,9 +2171,6 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
> > > struct buffer_head *bh = NULL;
> > > struct ext4_dir_entry_2 *de;
> > > struct super_block *sb;
> > > -#ifdef CONFIG_UNICODE
> > > - struct ext4_sb_info *sbi;
> > > -#endif
> > > struct ext4_filename fname;
> > > int retval;
> > > int dx_fallback=0;
> > > @@ -2190,9 +2187,8 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
> > > return -EINVAL;
> > >
> > > #ifdef CONFIG_UNICODE
> > > - sbi = EXT4_SB(sb);
> > > - if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) &&
> > > - sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))
> > > + if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
> > > + sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
> > > return -EINVAL;
> >
> > hm, just noticed the sb->s_encoding check here is superfluous, since the
> > has_strict_mode() cannot be true if !s_encoding. Not related to this
> > patch though.
> >
> > Daniel, are you still working on getting this upstream? The fscrypt
> > support would be very useful for us. :)
> >
> > In the hope this will get upstream, as its been flying for a while and
> > looks correct.
> >
> > Reviewed-by: Gabriel Krisman Bertazi <[email protected]>
>
> We couldn't get a response from Ted, so instead Jaegeuk has applied patches 1-3
> to f2fs/dev for 5.10. Hopefully Ted will take the ext4 patch for 5.11.
>
> I believe that Daniel is planning to resend the actual encryption+casefolding
> support soon, but initially only for f2fs since that will be ready first.
>
> - Eric

Yes, planning to send them shortly. Just checking that I've not missed
anything. For the sb_has_strict_encoding, I don't think that's
actually checking s_encoding, though it does check s_encoding_flags.
I'm planning to resend this one with that set, since it's not queued
in the f2fs tree.

-Daniel