All of lore.kernel.org
 help / color / mirror / Atom feed
* [koverstreet-bcachefs:master 47/272] fs/bcachefs/fsck.c:2202:25: sparse: sparse: incorrect type in initializer (different base types)
@ 2025-05-23 16:14 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-05-23 16:14 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: oe-kbuild-all

tree:   https://github.com/koverstreet/bcachefs master
head:   0ce02abdcc71ff27c3be49a4dc78d56c66c3a209
commit: 010c89468134d1991b87122379f86feae23d512f [47/272] bcachefs: Check for casefolded dirents in non casefolded dirs
config: sparc-randconfig-r112-20250523 (https://download.01.org/0day-ci/archive/20250524/202505240043.i8Z86QBJ-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 10.3.0
reproduce: (https://download.01.org/0day-ci/archive/20250524/202505240043.i8Z86QBJ-lkp@intel.com/reproduce)

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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505240043.i8Z86QBJ-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   fs/bcachefs/fsck.c: note: in included file:
   fs/bcachefs/bcachefs.h:1009:9: sparse: sparse: array of flexible structures
>> fs/bcachefs/fsck.c:2202:25: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned int [usertype] subvol @@     got restricted __le32 @@
   fs/bcachefs/fsck.c:2202:25: sparse:     expected unsigned int [usertype] subvol
   fs/bcachefs/fsck.c:2202:25: sparse:     got restricted __le32
>> fs/bcachefs/fsck.c:2205:30: sparse: sparse: restricted __le32 degrades to integer
>> fs/bcachefs/fsck.c:2206:30: sparse: sparse: restricted __le64 degrades to integer

vim +2202 fs/bcachefs/fsck.c

  2131	
  2132	static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
  2133				struct bkey_s_c k,
  2134				struct bch_hash_info *hash_info,
  2135				struct inode_walker *dir,
  2136				struct inode_walker *target,
  2137				struct snapshots_seen *s)
  2138	{
  2139		struct bch_fs *c = trans->c;
  2140		struct inode_walker_entry *i;
  2141		struct printbuf buf = PRINTBUF;
  2142		int ret = 0;
  2143	
  2144		ret = bch2_check_key_has_snapshot(trans, iter, k);
  2145		if (ret) {
  2146			ret = ret < 0 ? ret : 0;
  2147			goto out;
  2148		}
  2149	
  2150		ret = snapshots_seen_update(c, s, iter->btree_id, k.k->p);
  2151		if (ret)
  2152			goto err;
  2153	
  2154		if (k.k->type == KEY_TYPE_whiteout)
  2155			goto out;
  2156	
  2157		if (dir->last_pos.inode != k.k->p.inode && dir->have_inodes) {
  2158			ret = check_subdir_dirents_count(trans, dir);
  2159			if (ret)
  2160				goto err;
  2161		}
  2162	
  2163		i = walk_inode(trans, dir, k);
  2164		ret = PTR_ERR_OR_ZERO(i);
  2165		if (ret < 0)
  2166			goto err;
  2167	
  2168		ret = check_key_has_inode(trans, iter, dir, i, k);
  2169		if (ret)
  2170			goto err;
  2171	
  2172		if (!i)
  2173			goto out;
  2174	
  2175		if (dir->first_this_inode)
  2176			*hash_info = bch2_hash_info_init(c, &i->inode);
  2177		dir->first_this_inode = false;
  2178	
  2179		ret = bch2_str_hash_check_key(trans, s, &bch2_dirent_hash_desc, hash_info, iter, k);
  2180		if (ret < 0)
  2181			goto err;
  2182		if (ret) {
  2183			/* dirent has been deleted */
  2184			ret = 0;
  2185			goto out;
  2186		}
  2187	
  2188		if (k.k->type != KEY_TYPE_dirent)
  2189			goto out;
  2190	
  2191		struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k);
  2192	
  2193		/* check casefold */
  2194		if (fsck_err_on(d.v->d_casefold != !!hash_info->cf_encoding,
  2195				trans, dirent_casefold_mismatch,
  2196				"dirent casefold does not match dir casefold\n%s",
  2197				(printbuf_reset(&buf),
  2198				 bch2_bkey_val_to_text(&buf, c, k),
  2199				 buf.buf))) {
  2200			struct qstr name = bch2_dirent_get_name(d);
  2201			u32 subvol = d.v->d_type == DT_SUBVOL
> 2202				? d.v->d_parent_subvol
  2203				: 0;
  2204			u64 target = d.v->d_type == DT_SUBVOL
> 2205				? d.v->d_child_subvol
> 2206				: d.v->d_inum;
  2207			u64 dir_offset;
  2208	
  2209			ret =   bch2_hash_delete_at(trans,
  2210						    bch2_dirent_hash_desc, hash_info, iter,
  2211						    BTREE_UPDATE_internal_snapshot_node) ?:
  2212				bch2_dirent_create_snapshot(trans, subvol,
  2213							    d.k->p.inode, d.k->p.snapshot,
  2214							    hash_info,
  2215							    d.v->d_type,
  2216							    &name,
  2217							    target,
  2218							    &dir_offset,
  2219							    BTREE_ITER_with_updates|
  2220							    BTREE_UPDATE_internal_snapshot_node|
  2221							    STR_HASH_must_create) ?:
  2222				bch2_trans_commit(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc);
  2223	
  2224			/* might need another check_dirents pass */
  2225			goto out;
  2226		}
  2227	
  2228		if (d.v->d_type == DT_SUBVOL) {
  2229			ret = check_dirent_to_subvol(trans, iter, d);
  2230			if (ret)
  2231				goto err;
  2232		} else {
  2233			ret = get_visible_inodes(trans, target, s, le64_to_cpu(d.v->d_inum));
  2234			if (ret)
  2235				goto err;
  2236	
  2237			if (fsck_err_on(!target->inodes.nr,
  2238					trans, dirent_to_missing_inode,
  2239					"dirent points to missing inode:\n%s",
  2240					(printbuf_reset(&buf),
  2241					 bch2_bkey_val_to_text(&buf, c, k),
  2242					 buf.buf))) {
  2243				ret = bch2_fsck_remove_dirent(trans, d.k->p);
  2244				if (ret)
  2245					goto err;
  2246			}
  2247	
  2248			darray_for_each(target->inodes, i) {
  2249				ret = bch2_check_dirent_target(trans, iter, d, &i->inode, true);
  2250				if (ret)
  2251					goto err;
  2252			}
  2253	
  2254			darray_for_each(target->deletes, i)
  2255				if (fsck_err_on(!snapshot_list_has_id(&s->ids, *i),
  2256						trans, dirent_to_overwritten_inode,
  2257						"dirent points to inode overwritten in snapshot %u:\n%s",
  2258						*i,
  2259						(printbuf_reset(&buf),
  2260						 bch2_bkey_val_to_text(&buf, c, k),
  2261						 buf.buf))) {
  2262					struct btree_iter delete_iter;
  2263					bch2_trans_iter_init(trans, &delete_iter,
  2264							     BTREE_ID_dirents,
  2265							     SPOS(k.k->p.inode, k.k->p.offset, *i),
  2266							     BTREE_ITER_intent);
  2267					ret =   bch2_btree_iter_traverse(trans, &delete_iter) ?:
  2268						bch2_hash_delete_at(trans, bch2_dirent_hash_desc,
  2269								  hash_info,
  2270								  &delete_iter,
  2271								  BTREE_UPDATE_internal_snapshot_node);
  2272					bch2_trans_iter_exit(trans, &delete_iter);
  2273					if (ret)
  2274						goto err;
  2275	
  2276				}
  2277		}
  2278	
  2279		ret = bch2_trans_commit(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc);
  2280		if (ret)
  2281			goto err;
  2282	
  2283		for_each_visible_inode(c, s, dir, d.k->p.snapshot, i) {
  2284			if (d.v->d_type == DT_DIR)
  2285				i->count++;
  2286			i->i_size += bkey_bytes(d.k);
  2287		}
  2288	out:
  2289	err:
  2290	fsck_err:
  2291		printbuf_exit(&buf);
  2292		bch_err_fn(c, ret);
  2293		return ret;
  2294	}
  2295	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-23 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 16:14 [koverstreet-bcachefs:master 47/272] fs/bcachefs/fsck.c:2202:25: sparse: sparse: incorrect type in initializer (different base types) kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.