If xfs_repair detects a dir/attr btree that cycles back to the root, the
tree should be cleared and/or rebuilt instead of simply aborting the
repair program.
[sandeen: move check outside main loop]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
struct xfs_attr3_icleaf_hdr leafhdr;
da_bno = da_cursor->level[0].bno;
+ /*
+ * 0 is the root block and no block
+ * pointer can point to the root block of the btree
+ */
+ if (da_bno == 0) {
+ do_warn(
+ _("btree cycle detected in attribute fork for inode %" PRIu64 "\n"),
+ ino);
+ goto error_out;
+ }
+
ino = da_cursor->ino;
prev_bno = 0;
do {
repair = 0;
dev_bno = blkmap_get(da_cursor->blkmap, da_bno);
- /*
- * 0 is the root block and no block
- * pointer can point to the root block of the btree
- */
- ASSERT(da_bno != 0);
-
if (dev_bno == NULLFSBLOCK) {
do_warn(
_("can't map block %u for attribute fork for inode %" PRIu64 "\n"),