]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: Use generic_set_sb_d_ops for standard casefolding d_ops
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 26 Apr 2025 15:38:58 +0000 (11:38 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 28 Apr 2025 20:46:12 +0000 (16:46 -0400)
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs.c
fs/bcachefs/namei.c

index 72b722d80813a0038b167fd14b857925ad23daed..113db85b6ef9d00347b9e2746acf013be727c43a 100644 (file)
@@ -66,6 +66,8 @@ static inline void bch2_inode_flags_to_vfs(struct bch_fs *c, struct bch_inode_in
 
        if (bch2_inode_casefold(c, &inode->ei_inode))
                inode->v.i_flags |= S_CASEFOLD;
+       else
+               inode->v.i_flags &= ~S_CASEFOLD;
 }
 
 void bch2_inode_update_after_write(struct btree_trans *trans,
@@ -848,10 +850,8 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry,
                set_nlink(&inode->v, 0);
        }
 
-       if (IS_CASEFOLDED(vdir)) {
+       if (IS_CASEFOLDED(vdir))
                d_invalidate(dentry);
-               d_prune_aliases(&inode->v);
-       }
 err:
        bch2_trans_put(trans);
        bch2_unlock_inodes(INODE_UPDATE_LOCK, dir, inode);
@@ -2571,6 +2571,11 @@ got_sb:
        if (ret)
                goto err_put_super;
 
+#ifdef CONFIG_UNICODE
+       sb->s_encoding = c->cf_encoding;
+#endif
+       generic_set_sb_d_ops(sb);
+
        vinode = bch2_vfs_inode_get(c, BCACHEFS_ROOT_SUBVOL_INUM);
        ret = PTR_ERR_OR_ZERO(vinode);
        bch_err_msg(c, ret, "mounting: error getting root inode");
index 46f3c8b100a9529a89cc26b7689bc0328092a0a5..52c58c6d53d243e838934d1ef9f7c7c25884d64c 100644 (file)
@@ -343,6 +343,9 @@ bool bch2_reinherit_attrs(struct bch_inode_unpacked *dst_u,
        bool ret = false;
 
        for (id = 0; id < Inode_opt_nr; id++) {
+               if (!S_ISDIR(dst_u->bi_mode) && id == Inode_opt_casefold)
+                       continue;
+
                /* Skip attributes that were explicitly set on this inode */
                if (dst_u->bi_fields_set & (1 << id))
                        continue;