2023-08-14 21:44:05

by Eric Biggers

[permalink] [raw]
Subject: [PATCH 0/3] Simplify rejection of unexpected casefold inode flag

This series makes unexpected casefold flags on inodes be consistently
rejected early on so that additional validation isn't needed later on
during random filesystem operations. For additional context, refer to
the discussion on patch 1 of
https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u

Applies to v6.5-rc6

Eric Biggers (3):
ext4: reject casefold inode flag without casefold feature
ext4: remove redundant checks of s_encoding
libfs: remove redundant checks of s_encoding

fs/ext4/hash.c | 2 +-
fs/ext4/inode.c | 5 ++++-
fs/ext4/namei.c | 6 +++---
fs/libfs.c | 14 ++------------
4 files changed, 10 insertions(+), 17 deletions(-)


base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
--
2.41.0



2023-08-14 23:25:57

by Eric Biggers

[permalink] [raw]
Subject: [PATCH 3/3] libfs: remove redundant checks of s_encoding

From: Eric Biggers <[email protected]>

Now that neither ext4 nor f2fs allows inodes with the casefold flag to
be instantiated when unsupported, it's unnecessary to repeatedly check
for support later on during random filesystem operations.

Signed-off-by: Eric Biggers <[email protected]>
---
fs/libfs.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/fs/libfs.c b/fs/libfs.c
index 5b851315eeed..5197ea8c66d3 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1381,16 +1381,6 @@ bool is_empty_dir_inode(struct inode *inode)
}

#if IS_ENABLED(CONFIG_UNICODE)
-/*
- * Determine if the name of a dentry should be casefolded.
- *
- * Return: if names will need casefolding
- */
-static bool needs_casefold(const struct inode *dir)
-{
- return IS_CASEFOLDED(dir) && dir->i_sb->s_encoding;
-}
-
/**
* generic_ci_d_compare - generic d_compare implementation for casefolding filesystems
* @dentry: dentry whose name we are checking against
@@ -1411,7 +1401,7 @@ static int generic_ci_d_compare(const struct dentry *dentry, unsigned int len,
char strbuf[DNAME_INLINE_LEN];
int ret;

- if (!dir || !needs_casefold(dir))
+ if (!dir || !IS_CASEFOLDED(dir))
goto fallback;
/*
* If the dentry name is stored in-line, then it may be concurrently
@@ -1453,7 +1443,7 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
const struct unicode_map *um = sb->s_encoding;
int ret = 0;

- if (!dir || !needs_casefold(dir))
+ if (!dir || !IS_CASEFOLDED(dir))
return 0;

ret = utf8_casefold_hash(um, dentry, str);
--
2.41.0


2023-09-05 16:02:02

by patchwork-bot+f2fs

[permalink] [raw]
Subject: Re: [f2fs-dev] [PATCH 0/3] Simplify rejection of unexpected casefold inode flag

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Theodore Ts'o <[email protected]>:

On Mon, 14 Aug 2023 11:29:00 -0700 you wrote:
> This series makes unexpected casefold flags on inodes be consistently
> rejected early on so that additional validation isn't needed later on
> during random filesystem operations. For additional context, refer to
> the discussion on patch 1 of
> https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u
>
> Applies to v6.5-rc6
>
> [...]

Here is the summary with links:
- [f2fs-dev,1/3] ext4: reject casefold inode flag without casefold feature
https://git.kernel.org/jaegeuk/f2fs/c/8216776ccff6
- [f2fs-dev,2/3] ext4: remove redundant checks of s_encoding
https://git.kernel.org/jaegeuk/f2fs/c/b81427939590
- [f2fs-dev,3/3] libfs: remove redundant checks of s_encoding
https://git.kernel.org/jaegeuk/f2fs/c/af494af38580

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html