1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2017-2023 Oracle. All Rights Reserved.
8 #include "xfs_shared.h"
9 #include "xfs_format.h"
10 #include "xfs_trans_resv.h"
11 #include "xfs_mount.h"
12 #include "xfs_log_format.h"
13 #include "xfs_trans.h"
14 #include "xfs_inode.h"
15 #include "xfs_icache.h"
17 #include "xfs_dir2_priv.h"
18 #include "scrub/scrub.h"
19 #include "scrub/common.h"
20 #include "scrub/dabtree.h"
21 #include "scrub/readdir.h"
23 /* Set us up to scrub directories. */
28 return xchk_setup_inode_contents(sc, 0);
33 /* Scrub a directory entry. */
35 /* Check that an inode's mode matches a given XFS_DIR3_FT_* type. */
43 struct xfs_mount *mp = sc->mp;
45 if (!xfs_has_ftype(mp)) {
46 if (ftype != XFS_DIR3_FT_UNKNOWN && ftype != XFS_DIR3_FT_DIR)
47 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
51 if (xfs_mode_to_ftype(VFS_I(ip)->i_mode) != ftype)
52 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
56 * Scrub a single directory entry.
58 * Check the inode number to make sure it's sane, then we check that we can
59 * look up this filename. Finally, we check the ftype.
65 xfs_dir2_dataptr_t dapos,
66 const struct xfs_name *name,
70 struct xfs_mount *mp = dp->i_mount;
76 offset = xfs_dir2_db_to_da(mp->m_dir_geo,
77 xfs_dir2_dataptr_to_db(mp->m_dir_geo, dapos));
79 if (xchk_should_terminate(sc, &error))
82 /* Does this inode number make sense? */
83 if (!xfs_verify_dir_ino(mp, ino)) {
84 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
88 /* Does this name make sense? */
89 if (!xfs_dir2_namecheck(name->name, name->len)) {
90 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
94 if (!strncmp(".", name->name, name->len)) {
95 /* If this is "." then check that the inum matches the dir. */
97 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
98 } else if (!strncmp("..", name->name, name->len)) {
100 * If this is ".." in the root inode, check that the inum
103 if (dp->i_ino == mp->m_sb.sb_rootino && ino != dp->i_ino)
104 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
107 /* Verify that we can look up this name by hash. */
108 error = xchk_dir_lookup(sc, dp, name, &lookup_ino);
109 /* ENOENT means the hash lookup failed and the dir is corrupt */
110 if (error == -ENOENT)
111 error = -EFSCORRUPTED;
112 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, offset, &error))
114 if (lookup_ino != ino) {
115 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, offset);
120 * Grab the inode pointed to by the dirent. We release the inode
121 * before we cancel the scrub transaction.
123 * If _iget returns -EINVAL or -ENOENT then the child inode number is
124 * garbage and the directory is corrupt. If the _iget returns
125 * -EFSCORRUPTED or -EFSBADCRC then the child is corrupt which is a
126 * cross referencing error. Any other error is an operational error.
128 error = xchk_iget(sc, ino, &ip);
129 if (error == -EINVAL || error == -ENOENT) {
130 error = -EFSCORRUPTED;
131 xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, &error);
134 if (!xchk_fblock_xref_process_error(sc, XFS_DATA_FORK, offset, &error))
137 xchk_dir_check_ftype(sc, offset, ip, name->type);
140 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
145 /* Scrub a directory btree record. */
148 struct xchk_da_btree *ds,
151 struct xfs_name dname = { };
152 struct xfs_da_state_blk *blk = &ds->state->path.blk[level];
153 struct xfs_mount *mp = ds->state->mp;
154 struct xfs_inode *dp = ds->dargs.dp;
155 struct xfs_da_geometry *geo = mp->m_dir_geo;
156 struct xfs_dir2_data_entry *dent;
158 struct xfs_dir2_leaf_entry *ent;
160 unsigned int iter_off;
164 xfs_dir2_data_aoff_t off;
165 xfs_dir2_dataptr_t ptr;
166 xfs_dahash_t calc_hash;
168 struct xfs_dir3_icleaf_hdr hdr;
172 ASSERT(blk->magic == XFS_DIR2_LEAF1_MAGIC ||
173 blk->magic == XFS_DIR2_LEAFN_MAGIC);
175 xfs_dir2_leaf_hdr_from_disk(mp, &hdr, blk->bp->b_addr);
176 ent = hdr.ents + blk->index;
178 /* Check the hash of the entry. */
179 error = xchk_da_btree_hash(ds, level, &ent->hashval);
183 /* Valid hash pointer? */
184 ptr = be32_to_cpu(ent->address);
188 /* Find the directory entry's location. */
189 db = xfs_dir2_dataptr_to_db(geo, ptr);
190 off = xfs_dir2_dataptr_to_off(geo, ptr);
191 rec_bno = xfs_dir2_db_to_da(geo, db);
193 if (rec_bno >= geo->leafblk) {
194 xchk_da_set_corrupt(ds, level);
197 error = xfs_dir3_data_read(ds->dargs.trans, dp, rec_bno,
198 XFS_DABUF_MAP_HOLE_OK, &bp);
199 if (!xchk_fblock_process_error(ds->sc, XFS_DATA_FORK, rec_bno,
203 xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
206 xchk_buffer_recheck(ds->sc, bp);
208 if (ds->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
211 dent = bp->b_addr + off;
213 /* Make sure we got a real directory entry. */
214 iter_off = geo->data_entry_offset;
215 end = xfs_dir3_data_end_offset(geo, bp->b_addr);
217 xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
221 struct xfs_dir2_data_entry *dep = bp->b_addr + iter_off;
222 struct xfs_dir2_data_unused *dup = bp->b_addr + iter_off;
224 if (iter_off >= end) {
225 xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
229 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
230 iter_off += be16_to_cpu(dup->length);
235 iter_off += xfs_dir2_data_entsize(mp, dep->namelen);
238 /* Retrieve the entry, sanity check it, and compare hashes. */
239 ino = be64_to_cpu(dent->inumber);
240 hash = be32_to_cpu(ent->hashval);
241 tag = be16_to_cpup(xfs_dir2_data_entry_tag_p(mp, dent));
242 if (!xfs_verify_dir_ino(mp, ino) || tag != off)
243 xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
244 if (dent->namelen == 0) {
245 xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
249 /* Does the directory hash match? */
250 dname.name = dent->name;
251 dname.len = dent->namelen;
252 calc_hash = xfs_dir2_hashname(mp, &dname);
253 if (calc_hash != hash)
254 xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
257 xfs_trans_brelse(ds->dargs.trans, bp);
263 * Is this unused entry either in the bestfree or smaller than all of
264 * them? We've already checked that the bestfrees are sorted longest to
265 * shortest, and that there aren't any bogus entries.
268 xchk_directory_check_free_entry(
269 struct xfs_scrub *sc,
271 struct xfs_dir2_data_free *bf,
272 struct xfs_dir2_data_unused *dup)
274 struct xfs_dir2_data_free *dfp;
275 unsigned int dup_length;
277 dup_length = be16_to_cpu(dup->length);
279 /* Unused entry is shorter than any of the bestfrees */
280 if (dup_length < be16_to_cpu(bf[XFS_DIR2_DATA_FD_COUNT - 1].length))
283 for (dfp = &bf[XFS_DIR2_DATA_FD_COUNT - 1]; dfp >= bf; dfp--)
284 if (dup_length == be16_to_cpu(dfp->length))
287 /* Unused entry should be in the bestfrees but wasn't found. */
288 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
291 /* Check free space info in a directory data block. */
293 xchk_directory_data_bestfree(
294 struct xfs_scrub *sc,
298 struct xfs_dir2_data_unused *dup;
299 struct xfs_dir2_data_free *dfp;
301 struct xfs_dir2_data_free *bf;
302 struct xfs_mount *mp = sc->mp;
304 unsigned int nr_bestfrees = 0;
305 unsigned int nr_frees = 0;
306 unsigned int smallest_bestfree;
313 /* dir block format */
314 if (lblk != XFS_B_TO_FSBT(mp, XFS_DIR2_DATA_OFFSET))
315 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
316 error = xfs_dir3_block_read(sc->tp, sc->ip, &bp);
318 /* dir data format */
319 error = xfs_dir3_data_read(sc->tp, sc->ip, lblk, 0, &bp);
321 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error))
323 xchk_buffer_recheck(sc, bp);
325 /* XXX: Check xfs_dir3_data_hdr.pad is zero once we start setting it. */
327 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
330 /* Do the bestfrees correspond to actual free space? */
331 bf = xfs_dir2_data_bestfree_p(mp, bp->b_addr);
332 smallest_bestfree = UINT_MAX;
333 for (dfp = &bf[0]; dfp < &bf[XFS_DIR2_DATA_FD_COUNT]; dfp++) {
334 offset = be16_to_cpu(dfp->offset);
337 if (offset >= mp->m_dir_geo->blksize) {
338 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
341 dup = bp->b_addr + offset;
342 tag = be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup));
344 /* bestfree doesn't match the entry it points at? */
345 if (dup->freetag != cpu_to_be16(XFS_DIR2_DATA_FREE_TAG) ||
346 be16_to_cpu(dup->length) != be16_to_cpu(dfp->length) ||
348 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
352 /* bestfree records should be ordered largest to smallest */
353 if (smallest_bestfree < be16_to_cpu(dfp->length)) {
354 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
358 smallest_bestfree = be16_to_cpu(dfp->length);
362 /* Make sure the bestfrees are actually the best free spaces. */
363 offset = mp->m_dir_geo->data_entry_offset;
364 end = xfs_dir3_data_end_offset(mp->m_dir_geo, bp->b_addr);
366 /* Iterate the entries, stopping when we hit or go past the end. */
367 while (offset < end) {
368 dup = bp->b_addr + offset;
370 /* Skip real entries */
371 if (dup->freetag != cpu_to_be16(XFS_DIR2_DATA_FREE_TAG)) {
372 struct xfs_dir2_data_entry *dep = bp->b_addr + offset;
374 newlen = xfs_dir2_data_entsize(mp, dep->namelen);
376 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK,
384 /* Spot check this free entry */
385 tag = be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup));
387 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
392 * Either this entry is a bestfree or it's smaller than
393 * any of the bestfrees.
395 xchk_directory_check_free_entry(sc, lblk, bf, dup);
396 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
400 newlen = be16_to_cpu(dup->length);
402 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
410 /* We're required to fill all the space. */
412 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
414 /* Did we see at least as many free slots as there are bestfrees? */
415 if (nr_frees < nr_bestfrees)
416 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
418 xfs_trans_brelse(sc->tp, bp);
424 * Does the free space length in the free space index block ($len) match
425 * the longest length in the directory data block's bestfree array?
426 * Assume that we've already checked that the data block's bestfree
430 xchk_directory_check_freesp(
431 struct xfs_scrub *sc,
436 struct xfs_dir2_data_free *dfp;
438 dfp = xfs_dir2_data_bestfree_p(sc->mp, dbp->b_addr);
440 if (len != be16_to_cpu(dfp->length))
441 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
443 if (len > 0 && be16_to_cpu(dfp->offset) == 0)
444 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
447 /* Check free space info in a directory leaf1 block. */
449 xchk_directory_leaf1_bestfree(
450 struct xfs_scrub *sc,
451 struct xfs_da_args *args,
452 xfs_dir2_db_t last_data_db,
455 struct xfs_dir3_icleaf_hdr leafhdr;
456 struct xfs_dir2_leaf_tail *ltp;
457 struct xfs_dir2_leaf *leaf;
460 struct xfs_da_geometry *geo = sc->mp->m_dir_geo;
466 unsigned int stale = 0;
470 /* Read the free space block. */
471 error = xfs_dir3_leaf_read(sc->tp, sc->ip, lblk, &bp);
472 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error))
474 xchk_buffer_recheck(sc, bp);
477 xfs_dir2_leaf_hdr_from_disk(sc->ip->i_mount, &leafhdr, leaf);
478 ltp = xfs_dir2_leaf_tail_p(geo, leaf);
479 bestcount = be32_to_cpu(ltp->bestcount);
480 bestp = xfs_dir2_leaf_bests_p(ltp);
482 if (xfs_has_crc(sc->mp)) {
483 struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr;
485 if (hdr3->pad != cpu_to_be32(0))
486 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
490 * There must be enough bestfree slots to cover all the directory data
491 * blocks that we scanned. It is possible for there to be a hole
492 * between the last data block and i_disk_size. This seems like an
493 * oversight to the scrub author, but as we have been writing out
494 * directories like this (and xfs_repair doesn't mind them) for years,
495 * that's what we have to check.
497 if (bestcount != last_data_db + 1) {
498 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
502 /* Is the leaf count even remotely sane? */
503 if (leafhdr.count > geo->leaf_max_ents) {
504 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
508 /* Leaves and bests don't overlap in leaf format. */
509 if ((char *)&leafhdr.ents[leafhdr.count] > (char *)bestp) {
510 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
514 /* Check hash value order, count stale entries. */
515 for (i = 0; i < leafhdr.count; i++) {
516 hash = be32_to_cpu(leafhdr.ents[i].hashval);
517 if (i > 0 && lasthash > hash)
518 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
520 if (leafhdr.ents[i].address ==
521 cpu_to_be32(XFS_DIR2_NULL_DATAPTR))
524 if (leafhdr.stale != stale)
525 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
526 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
529 /* Check all the bestfree entries. */
530 for (i = 0; i < bestcount; i++, bestp++) {
531 best = be16_to_cpu(*bestp);
532 error = xfs_dir3_data_read(sc->tp, sc->ip,
533 xfs_dir2_db_to_da(args->geo, i),
534 XFS_DABUF_MAP_HOLE_OK,
536 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk,
541 if (best != NULLDATAOFF) {
542 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK,
549 if (best == NULLDATAOFF)
550 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
552 xchk_directory_check_freesp(sc, lblk, dbp, best);
553 xfs_trans_brelse(sc->tp, dbp);
554 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
558 xfs_trans_brelse(sc->tp, bp);
562 /* Check free space info in a directory freespace block. */
564 xchk_directory_free_bestfree(
565 struct xfs_scrub *sc,
566 struct xfs_da_args *args,
569 struct xfs_dir3_icfree_hdr freehdr;
573 unsigned int stale = 0;
577 /* Read the free space block */
578 error = xfs_dir2_free_read(sc->tp, sc->ip, lblk, &bp);
579 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error))
581 xchk_buffer_recheck(sc, bp);
583 if (xfs_has_crc(sc->mp)) {
584 struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
586 if (hdr3->pad != cpu_to_be32(0))
587 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
590 /* Check all the entries. */
591 xfs_dir2_free_hdr_from_disk(sc->ip->i_mount, &freehdr, bp->b_addr);
592 for (i = 0; i < freehdr.nvalid; i++) {
593 best = be16_to_cpu(freehdr.bests[i]);
594 if (best == NULLDATAOFF) {
598 error = xfs_dir3_data_read(sc->tp, sc->ip,
599 (freehdr.firstdb + i) * args->geo->fsbcount,
601 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk,
604 xchk_directory_check_freesp(sc, lblk, dbp, best);
605 xfs_trans_brelse(sc->tp, dbp);
608 if (freehdr.nused + stale != freehdr.nvalid)
609 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
611 xfs_trans_brelse(sc->tp, bp);
615 /* Check free space information in directories. */
617 xchk_directory_blocks(
618 struct xfs_scrub *sc)
620 struct xfs_bmbt_irec got;
621 struct xfs_da_args args = {
623 .whichfork = XFS_DATA_FORK,
624 .geo = sc->mp->m_dir_geo,
627 struct xfs_ifork *ifp = xfs_ifork_ptr(sc->ip, XFS_DATA_FORK);
628 struct xfs_mount *mp = sc->mp;
629 xfs_fileoff_t leaf_lblk;
630 xfs_fileoff_t free_lblk;
632 struct xfs_iext_cursor icur;
634 xfs_dir2_db_t last_data_db = 0;
636 bool is_block = false;
639 /* Ignore local format directories. */
640 if (ifp->if_format != XFS_DINODE_FMT_EXTENTS &&
641 ifp->if_format != XFS_DINODE_FMT_BTREE)
644 lblk = XFS_B_TO_FSB(mp, XFS_DIR2_DATA_OFFSET);
645 leaf_lblk = XFS_B_TO_FSB(mp, XFS_DIR2_LEAF_OFFSET);
646 free_lblk = XFS_B_TO_FSB(mp, XFS_DIR2_FREE_OFFSET);
648 /* Is this a block dir? */
649 error = xfs_dir2_isblock(&args, &is_block);
650 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error))
653 /* Iterate all the data extents in the directory... */
654 found = xfs_iext_lookup_extent(sc->ip, ifp, lblk, &icur, &got);
655 while (found && !(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) {
656 /* No more data blocks... */
657 if (got.br_startoff >= leaf_lblk)
661 * Check each data block's bestfree data.
663 * Iterate all the fsbcount-aligned block offsets in
664 * this directory. The directory block reading code is
665 * smart enough to do its own bmap lookups to handle
666 * discontiguous directory blocks. When we're done
667 * with the extent record, re-query the bmap at the
668 * next fsbcount-aligned offset to avoid redundant
671 for (lblk = roundup((xfs_dablk_t)got.br_startoff,
673 lblk < got.br_startoff + got.br_blockcount;
674 lblk += args.geo->fsbcount) {
675 last_data_db = xfs_dir2_da_to_db(args.geo, lblk);
676 error = xchk_directory_data_bestfree(sc, lblk,
681 dabno = got.br_startoff + got.br_blockcount;
682 lblk = roundup(dabno, args.geo->fsbcount);
683 found = xfs_iext_lookup_extent(sc->ip, ifp, lblk, &icur, &got);
686 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
689 /* Look for a leaf1 block, which has free info. */
690 if (xfs_iext_lookup_extent(sc->ip, ifp, leaf_lblk, &icur, &got) &&
691 got.br_startoff == leaf_lblk &&
692 got.br_blockcount == args.geo->fsbcount &&
693 !xfs_iext_next_extent(ifp, &icur, &got)) {
695 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
698 error = xchk_directory_leaf1_bestfree(sc, &args, last_data_db,
704 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
707 /* Scan for free blocks */
709 found = xfs_iext_lookup_extent(sc->ip, ifp, lblk, &icur, &got);
710 while (found && !(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) {
712 * Dirs can't have blocks mapped above 2^32.
713 * Single-block dirs shouldn't even be here.
715 lblk = got.br_startoff;
716 if (lblk & ~0xFFFFFFFFULL) {
717 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
721 xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
726 * Check each dir free block's bestfree data.
728 * Iterate all the fsbcount-aligned block offsets in
729 * this directory. The directory block reading code is
730 * smart enough to do its own bmap lookups to handle
731 * discontiguous directory blocks. When we're done
732 * with the extent record, re-query the bmap at the
733 * next fsbcount-aligned offset to avoid redundant
736 for (lblk = roundup((xfs_dablk_t)got.br_startoff,
738 lblk < got.br_startoff + got.br_blockcount;
739 lblk += args.geo->fsbcount) {
740 error = xchk_directory_free_bestfree(sc, &args,
745 dabno = got.br_startoff + got.br_blockcount;
746 lblk = roundup(dabno, args.geo->fsbcount);
747 found = xfs_iext_lookup_extent(sc->ip, ifp, lblk, &icur, &got);
753 /* Scrub a whole directory. */
756 struct xfs_scrub *sc)
760 if (!S_ISDIR(VFS_I(sc->ip)->i_mode))
763 /* Plausible size? */
764 if (sc->ip->i_disk_size < xfs_dir2_sf_hdr_size(0)) {
765 xchk_ino_set_corrupt(sc, sc->ip->i_ino);
769 /* Check directory tree structure */
770 error = xchk_da_btree(sc, XFS_DATA_FORK, xchk_dir_rec, NULL);
774 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
777 /* Check the freespace. */
778 error = xchk_directory_blocks(sc);
782 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
785 /* Look up every name in this directory by hash. */
786 error = xchk_dir_walk(sc, sc->ip, xchk_dir_actor, NULL);
787 if (error == -ECANCELED)