]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
set_default_d_op(): calculate the matching value for ->d_flags
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 24 Feb 2025 00:53:00 +0000 (19:53 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jun 2025 17:30:55 +0000 (13:30 -0400)
... and store it in ->s_d_flags, to be used by __d_alloc()

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c
include/linux/fs.h

index 27e6d2f36973fd3dc1069198378bafbbf1521747..7519c5f66f791b6ebb466f41f2fd840f6e4b954f 100644 (file)
@@ -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);
 
index 7cd8eaab4d4e2e713ecb087e5118c76f6f255321..65548e70e596bd0addb0bec0962ce2e9ba16e2c6 100644 (file)
@@ -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