Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bcachefs: Fix bch2_indirect_extent_missing_error()

We had some error handling confusion here;
-BCH_ERR_missing_indirect_extent is thrown by
trans_trigger_reflink_p_segment(); at this point we haven't decide
whether we're generating an error.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+8 -10
+8 -10
fs/bcachefs/reflink.c
··· 172 172 bool should_commit) 173 173 { 174 174 if (REFLINK_P_ERROR(p.v)) 175 - return -BCH_ERR_missing_indirect_extent; 175 + return 0; 176 176 177 177 struct bch_fs *c = trans->c; 178 178 u64 live_start = REFLINK_P_IDX(p.v); ··· 259 259 return k; 260 260 261 261 if (unlikely(!bkey_extent_is_reflink_data(k.k))) { 262 - bch2_trans_iter_exit(trans, iter); 263 - 264 262 unsigned size = min((u64) k.k->size, 265 263 REFLINK_P_IDX(p.v) + p.k->size + le32_to_cpu(p.v->back_pad) - 266 264 reflink_offset); ··· 266 268 267 269 int ret = bch2_indirect_extent_missing_error(trans, p, reflink_offset, 268 270 k.k->p.offset, should_commit); 269 - if (ret) 271 + if (ret) { 272 + bch2_trans_iter_exit(trans, iter); 270 273 return bkey_s_c_err(ret); 274 + } 271 275 } else if (unlikely(REFLINK_P_ERROR(p.v))) { 272 - bch2_trans_iter_exit(trans, iter); 273 - 274 276 int ret = bch2_indirect_extent_not_missing(trans, p, should_commit); 275 - if (ret) 277 + if (ret) { 278 + bch2_trans_iter_exit(trans, iter); 276 279 return bkey_s_c_err(ret); 280 + } 277 281 } 278 282 279 283 *offset_into_extent = reflink_offset - bkey_start_offset(k.k); ··· 300 300 if (ret) 301 301 return ret; 302 302 303 - if (bkey_deleted(k.k)) { 303 + if (!bkey_refcount_c(k)) { 304 304 if (!(flags & BTREE_TRIGGER_overwrite)) 305 305 ret = -BCH_ERR_missing_indirect_extent; 306 306 goto next; ··· 381 381 not_found: 382 382 if (flags & BTREE_TRIGGER_check_repair) { 383 383 ret = bch2_indirect_extent_missing_error(trans, p, *idx, next_idx, false); 384 - if (ret == -BCH_ERR_missing_indirect_extent) 385 - ret = 0; 386 384 if (ret) 387 385 goto err; 388 386 }