Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 207be96a authored by Daniel Rosenberg's avatar Daniel Rosenberg
Browse files

FROMLIST: fscrypt: Have filesystems handle their d_ops



This shifts the responsibility of setting up dentry operations from
fscrypt to the individual filesystems, allowing them to have their own
operations while still setting fscrypt's d_revalidate as appropriate.

Also added helper function to libfs to unify ext4 and f2fs
implementations.

Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
Test: Boots, /data/media is case insensitive
Bug: 138322712
Link: https://lore.kernel.org/linux-f2fs-devel/20200208013552.241832-1-drosen@google.com/T/#t
Change-Id: Iaf77f8c5961ecf22e22478701ab0b7fe2025225d
parent d2cb7739
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ EXPORT_SYMBOL_GPL(fscrypt_fname_siphash);
 * Validate dentries in encrypted directories to make sure we aren't potentially
 * caching stale dentries after a key has been added.
 */
static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
{
	struct dentry *dir;
	int err;
@@ -583,7 +583,4 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)

	return valid;
}

const struct dentry_operations fscrypt_d_ops = {
	.d_revalidate = fscrypt_d_revalidate,
};
EXPORT_SYMBOL(fscrypt_d_revalidate);
+0 −1
Original line number Diff line number Diff line
@@ -275,7 +275,6 @@ extern int fscrypt_fname_encrypt(const struct inode *inode,
extern bool fscrypt_fname_encrypted_size(const struct inode *inode,
					 u32 orig_len, u32 max_len,
					 u32 *encrypted_len_ret);
extern const struct dentry_operations fscrypt_d_ops;

/* hkdf.c */

+0 −1
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry,
		spin_lock(&dentry->d_lock);
		dentry->d_flags |= DCACHE_ENCRYPTED_NAME;
		spin_unlock(&dentry->d_lock);
		d_set_d_op(dentry, &fscrypt_d_ops);
	}
	return err;
}
+0 −7
Original line number Diff line number Diff line
@@ -662,10 +662,3 @@ const struct file_operations ext4_dir_operations = {
	.open		= ext4_dir_open,
	.release	= ext4_release_dir,
};

#ifdef CONFIG_UNICODE
const struct dentry_operations ext4_dentry_ops = {
	.d_hash = generic_ci_d_hash,
	.d_compare = generic_ci_d_compare,
};
#endif
+1 −0
Original line number Diff line number Diff line
@@ -1607,6 +1607,7 @@ static struct buffer_head *ext4_lookup_entry(struct inode *dir,
	struct buffer_head *bh;

	err = ext4_fname_prepare_lookup(dir, dentry, &fname);
	generic_set_encrypted_ci_d_ops(dir, dentry);
	if (err == -ENOENT)
		return NULL;
	if (err)
Loading