Commit ff875d4b authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Ensure we print output of run_recovery_pass if it errors



Also, don't error out in bucket_ref_update_err(): we don't want to
return -BCH_ERR_cannot_rewind_recovery if it's not an insert, if it's an
overwrite we continue.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 97e69f12
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -406,7 +406,15 @@ static int bucket_ref_update_err(struct btree_trans *trans, struct printbuf *buf
	if (insert) {
		bch2_trans_updates_to_text(buf, trans);
		__bch2_inconsistent_error(c, buf);
		/*
		 * If we're in recovery, run_explicit_recovery_pass might give
		 * us an error code for rewinding recovery
		 */
		if (!ret)
			ret = -BCH_ERR_bucket_ref_update;
	} else {
		/* Always ignore overwrite errors, so that deletion works */
		ret = 0;
	}

	if (print || insert)
@@ -971,14 +979,15 @@ static int __bch2_trans_mark_metadata_bucket(struct btree_trans *trans,
			   bch2_data_type_str(type),
			   bch2_data_type_str(type));

		bool print = bch2_count_fsck_err(c, bucket_metadata_type_mismatch, &buf);
		bch2_count_fsck_err(c, bucket_metadata_type_mismatch, &buf);

		bch2_run_explicit_recovery_pass(c, &buf,
		ret = bch2_run_explicit_recovery_pass(c, &buf,
					BCH_RECOVERY_PASS_check_allocations, 0);

		if (print)
		/* Always print, this is always fatal */
		bch2_print_str(c, KERN_ERR, buf.buf);
		printbuf_exit(&buf);
		if (!ret)
			ret = -BCH_ERR_metadata_bucket_inconsistency;
		goto err;
	}