diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-01-25 20:02:43 -0600 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2017-01-25 20:02:43 -0600 |
commit | ce746a2928d43face98cdb6684dea343b8e9b481 (patch) | |
tree | c419e968e44a9b1df7df6373c8985ea804779e94 | |
parent | fa2a8c17da431c4940cc4a50ce20134e1fa5c678 (diff) | |
download | xfsprogs-dev-ce746a2928d43face98cdb6684dea343b8e9b481.tar.gz |
xfs_repair: trash dirattr btrees that cycle to the root
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>
-rw-r--r-- | repair/attr_repair.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/repair/attr_repair.c b/repair/attr_repair.c index b855a10186..158e31a141 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -753,18 +753,23 @@ process_leaf_attr_level(xfs_mount_t *mp, 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"), |