]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/subvolume.c
Update bcachefs sources to e990c131de fixup! bcachefs: BTREE_ID_snapshot_tree
[bcachefs-tools-debian] / libbcachefs / subvolume.c
index 68121df2db669ddef47c34ce2aac0196ac7fdda3..320e1a008764b38a44bdc47790c5994fca5d5dd0 100644 (file)
@@ -358,12 +358,18 @@ static int check_snapshot_tree(struct btree_trans *trans,
        if (ret && !bch2_err_matches(ret, ENOENT))
                goto err;
 
-       if (fsck_err_on(ret ||
-                       !bch2_snapshot_is_ancestor(c,
+       if (fsck_err_on(ret, c,
+                       "snapshot tree points to missing subvolume:\n  %s",
+                       (printbuf_reset(&buf),
+                        bch2_bkey_val_to_text(&buf, c, st.s_c), buf.buf)) ||
+           fsck_err_on(!bch2_snapshot_is_ancestor(c,
                                                   le32_to_cpu(subvol.snapshot),
-                                                  root_id) ||
-                       !BCH_SUBVOLUME_SNAP(&subvol), c,
-                       "snapshot tree points to missing/incorrect subvolume:\n  %s",
+                                                  root_id), c,
+                       "snapshot tree points to subvolume that does not point to snapshot in this tree:\n  %s",
+                       (printbuf_reset(&buf),
+                        bch2_bkey_val_to_text(&buf, c, st.s_c), buf.buf)) ||
+           fsck_err_on(BCH_SUBVOLUME_SNAP(&subvol), c,
+                       "snapshot tree points to snapshot subvolume:\n  %s",
                        (printbuf_reset(&buf),
                         bch2_bkey_val_to_text(&buf, c, st.s_c), buf.buf))) {
                struct bkey_i_snapshot_tree *u;
@@ -586,6 +592,7 @@ static int check_snapshot(struct btree_trans *trans,
                if (ret)
                        goto err;
        }
+       ret = 0;
 
        if (BCH_SNAPSHOT_DELETED(s.v))
                set_bit(BCH_FS_HAVE_DELETED_SNAPSHOTS, &c->flags);