tree: https://github.com/koverstreet/bcachefs master head: b4166f528f4d7f062e945398859a7cedf331986e commit: 2531309943a2b7ff572264c6fa657ad1735218fc [346/348] bcachefs: Hook up d_casefold_enable() config: i386-buildonly-randconfig-2002-20250604 compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202506181334.UCo2bbV7-lkp@intel.com/ All warnings (new ones prefixed by >>): >> fs/bcachefs/fs.c:964:8: warning: variable 'trans' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 964 | if (ret) | ^~~ fs/bcachefs/fs.c:1055:17: note: uninitialized use occurs here 1055 | bch2_trans_put(trans); | ^~~~~ fs/bcachefs/fs.c:964:4: note: remove the 'if' if its condition is always false 964 | if (ret) | ^~~~~~~~ 965 | goto err; | ~~~~~~~~ fs/bcachefs/fs.c:957:8: warning: variable 'trans' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] 957 | if (ret) | ^~~ fs/bcachefs/fs.c:1055:17: note: uninitialized use occurs here 1055 | bch2_trans_put(trans); | ^~~~~ fs/bcachefs/fs.c:957:4: note: remove the 'if' if its condition is always false 957 | if (ret) | ^~~~~~~~ 958 | goto err; | ~~~~~~~~ fs/bcachefs/fs.c:930:27: note: initialize the variable 'trans' to silence this warning 930 | struct btree_trans *trans; | ^ | = NULL 2 warnings generated. vim +964 fs/bcachefs/fs.c 915 916 static int bch2_rename2(struct mnt_idmap *idmap, 917 struct inode *src_vdir, struct dentry *src_dentry, 918 struct inode *dst_vdir, struct dentry *dst_dentry, 919 unsigned flags) 920 { 921 struct bch_fs *c = src_vdir->i_sb->s_fs_info; 922 struct bch_inode_info *src_dir = to_bch_ei(src_vdir); 923 struct bch_inode_info *dst_dir = to_bch_ei(dst_vdir); 924 struct bch_inode_info *src_inode = to_bch_ei(src_dentry->d_inode); 925 struct bch_inode_info *dst_inode = to_bch_ei(dst_dentry->d_inode); 926 struct bch_inode_unpacked dst_dir_u, src_dir_u; 927 struct bch_inode_unpacked src_inode_u, dst_inode_u, *whiteout_inode_u; 928 struct d_casefold_enable casefold_enable_src = {}; 929 struct d_casefold_enable casefold_enable_dst = {}; 930 struct btree_trans *trans; 931 enum bch_rename_mode mode = flags & RENAME_EXCHANGE 932 ? BCH_RENAME_EXCHANGE 933 : dst_dentry->d_inode 934 ? BCH_RENAME_OVERWRITE : BCH_RENAME; 935 bool whiteout = !!(flags & RENAME_WHITEOUT); 936 int ret; 937 938 if (flags & ~(RENAME_NOREPLACE|RENAME_EXCHANGE|RENAME_WHITEOUT)) 939 return -EINVAL; 940 941 if (mode == BCH_RENAME_OVERWRITE) { 942 ret = filemap_write_and_wait_range(src_inode->v.i_mapping, 943 0, LLONG_MAX); 944 if (ret) 945 return ret; 946 } 947 948 bch2_lock_inodes(INODE_UPDATE_LOCK, 949 src_dir, 950 dst_dir, 951 src_inode, 952 dst_inode); 953 954 if (src_dir != dst_dir) { 955 if (bch2_inode_casefold(c, &src_inode->ei_inode)) { 956 ret = d_casefold_enable(dst_dentry, &casefold_enable_dst, true); 957 if (ret) 958 goto err; 959 } 960 961 if (mode == BCH_RENAME_EXCHANGE && 962 bch2_inode_casefold(c, &dst_inode->ei_inode)) { 963 ret = d_casefold_enable(src_dentry, &casefold_enable_src, true); > 964 if (ret) 965 goto err; 966 } 967 } 968 969 trans = bch2_trans_get(c); 970 971 ret = bch2_subvol_is_ro_trans(trans, src_dir->ei_inum.subvol) ?: 972 bch2_subvol_is_ro_trans(trans, dst_dir->ei_inum.subvol); 973 if (ret) 974 goto err_tx_restart; 975 976 if (inode_attr_changing(dst_dir, src_inode, Inode_opt_project)) { 977 ret = bch2_fs_quota_transfer(c, src_inode, 978 dst_dir->ei_qid, 979 1 << QTYP_PRJ, 980 KEY_TYPE_QUOTA_PREALLOC); 981 if (ret) 982 goto err; 983 } 984 985 if (mode == BCH_RENAME_EXCHANGE && 986 inode_attr_changing(src_dir, dst_inode, Inode_opt_project)) { 987 ret = bch2_fs_quota_transfer(c, dst_inode, 988 src_dir->ei_qid, 989 1 << QTYP_PRJ, 990 KEY_TYPE_QUOTA_PREALLOC); 991 if (ret) 992 goto err; 993 } 994 retry: 995 bch2_trans_begin(trans); 996 997 ret = bch2_rename_trans(trans, 998 inode_inum(src_dir), &src_dir_u, 999 inode_inum(dst_dir), &dst_dir_u, 1000 &src_inode_u, 1001 &dst_inode_u, 1002 &src_dentry->d_name, 1003 &dst_dentry->d_name, 1004 mode); 1005 if (unlikely(ret)) 1006 goto err_tx_restart; 1007 1008 if (whiteout) { 1009 whiteout_inode_u = bch2_trans_kmalloc_nomemzero(trans, sizeof(*whiteout_inode_u)); 1010 ret = PTR_ERR_OR_ZERO(whiteout_inode_u); 1011 if (unlikely(ret)) 1012 goto err_tx_restart; 1013 bch2_inode_init_early(c, whiteout_inode_u); 1014 1015 ret = bch2_create_trans(trans, 1016 inode_inum(src_dir), &src_dir_u, 1017 whiteout_inode_u, 1018 &src_dentry->d_name, 1019 from_kuid(i_user_ns(&src_dir->v), current_fsuid()), 1020 from_kgid(i_user_ns(&src_dir->v), current_fsgid()), 1021 S_IFCHR|WHITEOUT_MODE, 0, 1022 NULL, NULL, (subvol_inum) { 0 }, 0) ?: 1023 bch2_quota_acct(c, bch_qid(whiteout_inode_u), Q_INO, 1, 1024 KEY_TYPE_QUOTA_PREALLOC); 1025 if (unlikely(ret)) 1026 goto err_tx_restart; 1027 } 1028 1029 ret = bch2_trans_commit(trans, NULL, NULL, 0); 1030 if (unlikely(ret)) { 1031 err_tx_restart: 1032 if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) 1033 goto retry; 1034 goto err; 1035 } 1036 1037 BUG_ON(src_inode->v.i_ino != src_inode_u.bi_inum); 1038 BUG_ON(dst_inode && 1039 dst_inode->v.i_ino != dst_inode_u.bi_inum); 1040 1041 bch2_inode_update_after_write(trans, src_dir, &src_dir_u, 1042 ATTR_MTIME|ATTR_CTIME|ATTR_SIZE); 1043 1044 if (src_dir != dst_dir) 1045 bch2_inode_update_after_write(trans, dst_dir, &dst_dir_u, 1046 ATTR_MTIME|ATTR_CTIME|ATTR_SIZE); 1047 1048 bch2_inode_update_after_write(trans, src_inode, &src_inode_u, 1049 ATTR_CTIME); 1050 1051 if (dst_inode) 1052 bch2_inode_update_after_write(trans, dst_inode, &dst_inode_u, 1053 ATTR_CTIME); 1054 err: 1055 bch2_trans_put(trans); 1056 1057 bch2_fs_quota_transfer(c, src_inode, 1058 bch_qid(&src_inode->ei_inode), 1059 1 << QTYP_PRJ, 1060 KEY_TYPE_QUOTA_NOCHECK); 1061 if (dst_inode) 1062 bch2_fs_quota_transfer(c, dst_inode, 1063 bch_qid(&dst_inode->ei_inode), 1064 1 << QTYP_PRJ, 1065 KEY_TYPE_QUOTA_NOCHECK); 1066 1067 bch2_unlock_inodes(INODE_UPDATE_LOCK, 1068 src_dir, 1069 dst_dir, 1070 src_inode, 1071 dst_inode); 1072 1073 d_casefold_enable_commit(&casefold_enable_dst, ret); 1074 d_casefold_enable_commit(&casefold_enable_src, ret); 1075 1076 return bch2_err_class(ret); 1077 } 1078 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki