bcachefs: Ensure that snapshot creation propagates has_case_insensitive
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 8 Jun 2025 16:35:20 +0000 (12:35 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 12 Jun 2025 03:24:21 +0000 (23:24 -0400)
We normally can't create a new directory with the case-insensitive
option already set - except when we're creating a snapshot.

And if casefolding is enabled filesystem wide, we should still set it
even though not strictly required, for consistency.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/namei.c

index 24120037c031887d69766b3b9a1f515c3d971675..779c22eb39794cc7e4f1215d11a51aa3ee6ba186 100644 (file)
@@ -175,6 +175,16 @@ int bch2_create_trans(struct btree_trans *trans,
                new_inode->bi_dir_offset        = dir_offset;
        }
 
+       if (S_ISDIR(mode)) {
+               ret = bch2_maybe_propagate_has_case_insensitive(trans,
+                               (subvol_inum) {
+                                       new_inode->bi_subvol ?: dir.subvol,
+                                       new_inode->bi_inum },
+                               new_inode);
+               if (ret)
+                       goto err;
+       }
+
        if (S_ISDIR(mode) &&
            !new_inode->bi_subvol)
                new_inode->bi_depth = dir_u->bi_depth + 1;