From: Al Viro Date: Mon, 24 Feb 2025 00:53:00 +0000 (-0500) Subject: set_default_d_op(): calculate the matching value for ->d_flags X-Git-Tag: v6.17-rc1~233^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fa8bf42c50582c7302918474aae8c52b59e7910;p=thirdparty%2Flinux.git set_default_d_op(): calculate the matching value for ->d_flags ... and store it in ->s_d_flags, to be used by __d_alloc() Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- diff --git a/fs/dcache.c b/fs/dcache.c index 27e6d2f36973f..7519c5f66f791 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1731,14 +1731,14 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) dentry->d_inode = NULL; dentry->d_parent = dentry; dentry->d_sb = sb; - dentry->d_op = NULL; + dentry->d_op = sb->__s_d_op; + dentry->d_flags = sb->s_d_flags; dentry->d_fsdata = NULL; INIT_HLIST_BL_NODE(&dentry->d_hash); INIT_LIST_HEAD(&dentry->d_lru); INIT_HLIST_HEAD(&dentry->d_children); INIT_HLIST_NODE(&dentry->d_u.d_alias); INIT_HLIST_NODE(&dentry->d_sib); - d_set_d_op(dentry, dentry->d_sb->__s_d_op); if (dentry->d_op && dentry->d_op->d_init) { err = dentry->d_op->d_init(dentry); @@ -1877,7 +1877,9 @@ EXPORT_SYMBOL(d_set_d_op); void set_default_d_op(struct super_block *s, const struct dentry_operations *ops) { + unsigned int flags = d_op_flags(ops); s->__s_d_op = ops; + s->s_d_flags = (s->s_d_flags & ~DCACHE_OP_FLAGS) | flags; } EXPORT_SYMBOL(set_default_d_op); diff --git a/include/linux/fs.h b/include/linux/fs.h index 7cd8eaab4d4e2..65548e70e596b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1400,6 +1400,7 @@ struct super_block { char s_sysfs_name[UUID_STRING_LEN + 1]; unsigned int s_max_links; + unsigned int s_d_flags; /* default d_flags for dentries */ /* * The next field is for VFS *only*. No filesystems have any business