]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/fsck.c
Update bcachefs sources to 0010403265 bcachefs: Fix spurious alloc errors on forced...
[bcachefs-tools-debian] / libbcachefs / fsck.c
index 09ce6c29b88cf91e85a57d6c9abce4b7bf56fa5d..39f872de0c186d5ec388867d2bc848c8640af080 100644 (file)
@@ -230,7 +230,6 @@ static int hash_check_duplicates(struct btree_trans *trans,
                return 0;
 
        iter = bch2_trans_copy_iter(trans, h->chain);
-       BUG_ON(IS_ERR(iter));
 
        for_each_btree_key_continue(iter, 0, k2, ret) {
                if (bkey_cmp(k2.k->p, k.k->p) >= 0)
@@ -265,10 +264,8 @@ static void hash_set_chain_start(struct btree_trans *trans,
                hash_stop_chain(trans, h);
 
        if (!hole) {
-               if (!h->chain) {
+               if (!h->chain)
                        h->chain = bch2_trans_copy_iter(trans, k_iter);
-                       BUG_ON(IS_ERR(h->chain));
-               }
 
                h->chain_end = k.k->p.offset;
        }
@@ -440,9 +437,6 @@ static int bch2_fix_overlapping_extent(struct btree_trans *trans,
        bch2_cut_front(cut_at, u);
 
        u_iter = bch2_trans_copy_iter(trans, iter);
-       ret = PTR_ERR_OR_ZERO(u_iter);
-       if (ret)
-               return ret;
 
        /*
         * We don't want to go through the
@@ -485,7 +479,11 @@ static int check_extents(struct bch_fs *c)
                                   BTREE_ITER_INTENT);
 retry:
        for_each_btree_key_continue(iter, 0, k, ret) {
-               if (bkey_cmp(prev.k->k.p, bkey_start_pos(k.k)) > 0) {
+               /*
+                * due to retry errors we might see the same extent twice:
+                */
+               if (bkey_cmp(prev.k->k.p, k.k->p) &&
+                   bkey_cmp(prev.k->k.p, bkey_start_pos(k.k)) > 0) {
                        char buf1[200];
                        char buf2[200];