]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: fix leaf node directory data check
authorDave Chinner <dchinner@redhat.com>
Wed, 13 Nov 2013 06:41:00 +0000 (06:41 +0000)
committerRich Johnston <rjohnston@sgi.com>
Thu, 14 Nov 2013 15:00:39 +0000 (09:00 -0600)
When walking the leaf node format blocks (LEAFN) in the hash index
of a large directory, we could trip over btree node blocks (DA_NODE)
in the address space if there are enough entries in the directory.
These cause a verifier failure, and hence the directory is
considered corrupt and is trashed and rebuilt unnecessarily. Fix this
by using the correct verifier that can handle both types of blocks
without triggering failures.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
repair/phase6.c

index 5307acf61a479fdb67f4068b679830864fccd483..d2d4a445ceef292683bff2d02126bc7d8a5a0917 100644 (file)
@@ -1937,8 +1937,16 @@ longform_dir2_check_node(
                next_da_bno = da_bno + mp->m_dirblkfsbs - 1;
                if (bmap_next_offset(NULL, ip, &next_da_bno, XFS_DATA_FORK))
                        break;
+
+               /*
+                * we need to use the da3 node verifier here as it handles the
+                * fact that reading the leaf hash tree blocks can return either
+                * leaf or node blocks and calls the correct verifier. If we get
+                * a node block, then we'll skip it below based on a magic
+                * number check.
+                */
                if (libxfs_da_read_buf(NULL, ip, da_bno, -1, &bp,
-                               XFS_DATA_FORK, &xfs_dir3_leafn_buf_ops)) {
+                               XFS_DATA_FORK, &xfs_da3_node_buf_ops)) {
                        do_warn(
        _("can't read leaf block %u for directory inode %" PRIu64 "\n"),
                                da_bno, ip->i_ino);