-ee560a3929f32350ed7e04550ad009c58ab73d5e
+4b5917839c4b279b303133b87cd94cc1a352a0e6
static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c,
enum bch_recovery_pass pass)
{
- BUG_ON(c->curr_recovery_pass < pass);
-
c->recovery_passes_explicit |= BIT_ULL(pass);
- c->curr_recovery_pass = pass;
- return -BCH_ERR_restart_recovery;
+
+ if (c->curr_recovery_pass >= pass) {
+ c->curr_recovery_pass = pass;
+ return -BCH_ERR_restart_recovery;
+ } else {
+ return 0;
+ }
}
#define BKEY_PADDED_ONSTACK(key, pad) \
case BTREE_ERR_BAD_NODE:
bch2_print_string_as_lines(KERN_ERR, out.buf);
bch2_topology_error(c);
- ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_check_topology);
+ ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_check_topology) ?: -EIO;
break;
case BTREE_ERR_INCOMPATIBLE:
bch2_print_string_as_lines(KERN_ERR, out.buf);
if (ret < 0)
goto err;
- if (dir->first_this_inode)
+ if (dir->first_this_inode && dir->inodes.nr)
*hash_info = bch2_hash_info_init(c, &dir->inodes.data[0].inode);
dir->first_this_inode = false;
if (ret)
return ret;
- if (inode->first_this_inode)
+ if (inode->first_this_inode && inode->inodes.nr)
*hash_info = bch2_hash_info_init(c, &inode->inodes.data[0].inode);
inode->first_this_inode = false;