2 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include "xfs_shared.h"
23 #include "xfs_format.h"
24 #include "xfs_trans_resv.h"
25 #include "xfs_mount.h"
26 #include "xfs_defer.h"
27 #include "xfs_btree.h"
29 #include "xfs_log_format.h"
30 #include "xfs_trans.h"
32 #include "xfs_inode.h"
33 #include "xfs_icache.h"
34 #include "xfs_inode_buf.h"
35 #include "xfs_inode_fork.h"
36 #include "xfs_ialloc.h"
37 #include "xfs_da_format.h"
38 #include "xfs_reflink.h"
41 #include "xfs_bmap_util.h"
42 #include "scrub/xfs_scrub.h"
43 #include "scrub/scrub.h"
44 #include "scrub/common.h"
45 #include "scrub/btree.h"
46 #include "scrub/trace.h"
49 * Grab total control of the inode metadata. It doesn't matter here if
50 * the file data is still changing; exclusive access to the metadata is
54 xfs_scrub_setup_inode(
55 struct xfs_scrub_context
*sc
,
58 struct xfs_mount
*mp
= sc
->mp
;
62 * Try to get the inode. If the verifiers fail, we try again
65 error
= xfs_scrub_get_inode(sc
, ip
);
71 return xfs_scrub_trans_alloc(sc
->sm
, mp
, &sc
->tp
);
76 /* Got the inode, lock it and we're ready to go. */
77 sc
->ilock_flags
= XFS_IOLOCK_EXCL
| XFS_MMAPLOCK_EXCL
;
78 xfs_ilock(sc
->ip
, sc
->ilock_flags
);
79 error
= xfs_scrub_trans_alloc(sc
->sm
, mp
, &sc
->tp
);
82 sc
->ilock_flags
|= XFS_ILOCK_EXCL
;
83 xfs_ilock(sc
->ip
, XFS_ILOCK_EXCL
);
86 /* scrub teardown will unlock and release the inode for us */
93 * Validate di_extsize hint.
95 * The rules are documented at xfs_ioctl_setattr_check_extsize().
96 * These functions must be kept in sync with each other.
99 xfs_scrub_inode_extsize(
100 struct xfs_scrub_context
*sc
,
102 struct xfs_dinode
*dip
,
107 struct xfs_mount
*mp
= sc
->mp
;
112 uint32_t extsize_bytes
;
113 uint32_t blocksize_bytes
;
115 rt_flag
= (flags
& XFS_DIFLAG_REALTIME
);
116 hint_flag
= (flags
& XFS_DIFLAG_EXTSIZE
);
117 inherit_flag
= (flags
& XFS_DIFLAG_EXTSZINHERIT
);
118 extsize
= be32_to_cpu(dip
->di_extsize
);
119 extsize_bytes
= XFS_FSB_TO_B(sc
->mp
, extsize
);
122 blocksize_bytes
= mp
->m_sb
.sb_rextsize
<< mp
->m_sb
.sb_blocklog
;
124 blocksize_bytes
= mp
->m_sb
.sb_blocksize
;
126 if ((hint_flag
|| inherit_flag
) && !(S_ISDIR(mode
) || S_ISREG(mode
)))
129 if (hint_flag
&& !S_ISREG(mode
))
132 if (inherit_flag
&& !S_ISDIR(mode
))
135 if ((hint_flag
|| inherit_flag
) && extsize
== 0)
138 if (!(hint_flag
|| inherit_flag
) && extsize
!= 0)
141 if (extsize_bytes
% blocksize_bytes
)
144 if (extsize
> MAXEXTLEN
)
147 if (!rt_flag
&& extsize
> mp
->m_sb
.sb_agblocks
/ 2)
152 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
156 * Validate di_cowextsize hint.
158 * The rules are documented at xfs_ioctl_setattr_check_cowextsize().
159 * These functions must be kept in sync with each other.
162 xfs_scrub_inode_cowextsize(
163 struct xfs_scrub_context
*sc
,
165 struct xfs_dinode
*dip
,
171 struct xfs_mount
*mp
= sc
->mp
;
175 uint32_t extsize_bytes
;
177 rt_flag
= (flags
& XFS_DIFLAG_REALTIME
);
178 hint_flag
= (flags2
& XFS_DIFLAG2_COWEXTSIZE
);
179 extsize
= be32_to_cpu(dip
->di_cowextsize
);
180 extsize_bytes
= XFS_FSB_TO_B(sc
->mp
, extsize
);
182 if (hint_flag
&& !xfs_sb_version_hasreflink(&mp
->m_sb
))
185 if (hint_flag
&& !(S_ISDIR(mode
) || S_ISREG(mode
)))
188 if (hint_flag
&& extsize
== 0)
191 if (!hint_flag
&& extsize
!= 0)
194 if (hint_flag
&& rt_flag
)
197 if (extsize_bytes
% mp
->m_sb
.sb_blocksize
)
200 if (extsize
> MAXEXTLEN
)
203 if (extsize
> mp
->m_sb
.sb_agblocks
/ 2)
208 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
211 /* Make sure the di_flags make sense for the inode. */
213 xfs_scrub_inode_flags(
214 struct xfs_scrub_context
*sc
,
216 struct xfs_dinode
*dip
,
221 struct xfs_mount
*mp
= sc
->mp
;
223 if (flags
& ~XFS_DIFLAG_ANY
)
226 /* rt flags require rt device */
227 if ((flags
& (XFS_DIFLAG_REALTIME
| XFS_DIFLAG_RTINHERIT
)) &&
231 /* new rt bitmap flag only valid for rbmino */
232 if ((flags
& XFS_DIFLAG_NEWRTBM
) && ino
!= mp
->m_sb
.sb_rbmino
)
235 /* directory-only flags */
236 if ((flags
& (XFS_DIFLAG_RTINHERIT
|
237 XFS_DIFLAG_EXTSZINHERIT
|
238 XFS_DIFLAG_PROJINHERIT
|
239 XFS_DIFLAG_NOSYMLINKS
)) &&
243 /* file-only flags */
244 if ((flags
& (XFS_DIFLAG_REALTIME
| FS_XFLAG_EXTSIZE
)) &&
248 /* filestreams and rt make no sense */
249 if ((flags
& XFS_DIFLAG_FILESTREAM
) && (flags
& XFS_DIFLAG_REALTIME
))
254 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
257 /* Make sure the di_flags2 make sense for the inode. */
259 xfs_scrub_inode_flags2(
260 struct xfs_scrub_context
*sc
,
262 struct xfs_dinode
*dip
,
268 struct xfs_mount
*mp
= sc
->mp
;
270 if (flags2
& ~XFS_DIFLAG2_ANY
)
273 /* reflink flag requires reflink feature */
274 if ((flags2
& XFS_DIFLAG2_REFLINK
) &&
275 !xfs_sb_version_hasreflink(&mp
->m_sb
))
278 /* cowextsize flag is checked w.r.t. mode separately */
280 /* file/dir-only flags */
281 if ((flags2
& XFS_DIFLAG2_DAX
) && !(S_ISREG(mode
) || S_ISDIR(mode
)))
284 /* file-only flags */
285 if ((flags2
& XFS_DIFLAG2_REFLINK
) && !S_ISREG(mode
))
288 /* realtime and reflink make no sense, currently */
289 if ((flags
& XFS_DIFLAG_REALTIME
) && (flags2
& XFS_DIFLAG2_REFLINK
))
292 /* dax and reflink make no sense, currently */
293 if ((flags2
& XFS_DIFLAG2_DAX
) && (flags2
& XFS_DIFLAG2_REFLINK
))
298 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
301 /* Scrub all the ondisk inode fields. */
304 struct xfs_scrub_context
*sc
,
306 struct xfs_dinode
*dip
,
309 struct xfs_mount
*mp
= sc
->mp
;
311 unsigned long long isize
;
317 flags
= be16_to_cpu(dip
->di_flags
);
318 if (dip
->di_version
>= 3)
319 flags2
= be64_to_cpu(dip
->di_flags2
);
324 mode
= be16_to_cpu(dip
->di_mode
);
325 switch (mode
& S_IFMT
) {
333 /* mode is recognized */
336 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
341 switch (dip
->di_version
) {
344 * We autoconvert v1 inodes into v2 inodes on writeout,
345 * so just mark this inode for preening.
347 xfs_scrub_ino_set_preen(sc
, ino
, bp
);
351 if (dip
->di_onlink
!= 0)
352 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
354 if (dip
->di_mode
== 0 && sc
->ip
)
355 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
357 if (dip
->di_projid_hi
!= 0 &&
358 !xfs_sb_version_hasprojid32bit(&mp
->m_sb
))
359 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
362 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
367 * di_uid/di_gid -- -1 isn't invalid, but there's no way that
368 * userspace could have created that.
370 if (dip
->di_uid
== cpu_to_be32(-1U) ||
371 dip
->di_gid
== cpu_to_be32(-1U))
372 xfs_scrub_ino_set_warning(sc
, ino
, bp
);
375 switch (dip
->di_format
) {
376 case XFS_DINODE_FMT_DEV
:
377 if (!S_ISCHR(mode
) && !S_ISBLK(mode
) &&
378 !S_ISFIFO(mode
) && !S_ISSOCK(mode
))
379 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
381 case XFS_DINODE_FMT_LOCAL
:
382 if (!S_ISDIR(mode
) && !S_ISLNK(mode
))
383 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
385 case XFS_DINODE_FMT_EXTENTS
:
386 if (!S_ISREG(mode
) && !S_ISDIR(mode
) && !S_ISLNK(mode
))
387 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
389 case XFS_DINODE_FMT_BTREE
:
390 if (!S_ISREG(mode
) && !S_ISDIR(mode
))
391 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
393 case XFS_DINODE_FMT_UUID
:
395 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
399 /* di_[amc]time.nsec */
400 if (be32_to_cpu(dip
->di_atime
.t_nsec
) >= NSEC_PER_SEC
)
401 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
402 if (be32_to_cpu(dip
->di_mtime
.t_nsec
) >= NSEC_PER_SEC
)
403 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
404 if (be32_to_cpu(dip
->di_ctime
.t_nsec
) >= NSEC_PER_SEC
)
405 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
408 * di_size. xfs_dinode_verify checks for things that screw up
409 * the VFS such as the upper bit being set and zero-length
410 * symlinks/directories, but we can do more here.
412 isize
= be64_to_cpu(dip
->di_size
);
413 if (isize
& (1ULL << 63))
414 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
416 /* Devices, fifos, and sockets must have zero size */
417 if (!S_ISDIR(mode
) && !S_ISREG(mode
) && !S_ISLNK(mode
) && isize
!= 0)
418 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
420 /* Directories can't be larger than the data section size (32G) */
421 if (S_ISDIR(mode
) && (isize
== 0 || isize
>= XFS_DIR2_SPACE_SIZE
))
422 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
424 /* Symlinks can't be larger than SYMLINK_MAXLEN */
425 if (S_ISLNK(mode
) && (isize
== 0 || isize
>= XFS_SYMLINK_MAXLEN
))
426 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
429 * Warn if the running kernel can't handle the kinds of offsets
430 * needed to deal with the file size. In other words, if the
431 * pagecache can't cache all the blocks in this file due to
432 * overly large offsets, flag the inode for admin review.
434 if (isize
>= mp
->m_super
->s_maxbytes
)
435 xfs_scrub_ino_set_warning(sc
, ino
, bp
);
438 if (flags2
& XFS_DIFLAG2_REFLINK
) {
439 ; /* nblocks can exceed dblocks */
440 } else if (flags
& XFS_DIFLAG_REALTIME
) {
442 * nblocks is the sum of data extents (in the rtdev),
443 * attr extents (in the datadev), and both forks' bmbt
444 * blocks (in the datadev). This clumsy check is the
445 * best we can do without cross-referencing with the
448 if (be64_to_cpu(dip
->di_nblocks
) >=
449 mp
->m_sb
.sb_dblocks
+ mp
->m_sb
.sb_rblocks
)
450 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
452 if (be64_to_cpu(dip
->di_nblocks
) >= mp
->m_sb
.sb_dblocks
)
453 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
456 xfs_scrub_inode_flags(sc
, bp
, dip
, ino
, mode
, flags
);
458 xfs_scrub_inode_extsize(sc
, bp
, dip
, ino
, mode
, flags
);
461 nextents
= be32_to_cpu(dip
->di_nextents
);
462 fork_recs
= XFS_DFORK_DSIZE(dip
, mp
) / sizeof(struct xfs_bmbt_rec
);
463 switch (dip
->di_format
) {
464 case XFS_DINODE_FMT_EXTENTS
:
465 if (nextents
> fork_recs
)
466 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
468 case XFS_DINODE_FMT_BTREE
:
469 if (nextents
<= fork_recs
)
470 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
474 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
479 if (XFS_DFORK_APTR(dip
) >= (char *)dip
+ mp
->m_sb
.sb_inodesize
)
480 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
481 if (dip
->di_anextents
!= 0 && dip
->di_forkoff
== 0)
482 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
483 if (dip
->di_forkoff
== 0 && dip
->di_aformat
!= XFS_DINODE_FMT_EXTENTS
)
484 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
487 if (dip
->di_aformat
!= XFS_DINODE_FMT_LOCAL
&&
488 dip
->di_aformat
!= XFS_DINODE_FMT_EXTENTS
&&
489 dip
->di_aformat
!= XFS_DINODE_FMT_BTREE
)
490 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
493 nextents
= be16_to_cpu(dip
->di_anextents
);
494 fork_recs
= XFS_DFORK_ASIZE(dip
, mp
) / sizeof(struct xfs_bmbt_rec
);
495 switch (dip
->di_aformat
) {
496 case XFS_DINODE_FMT_EXTENTS
:
497 if (nextents
> fork_recs
)
498 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
500 case XFS_DINODE_FMT_BTREE
:
501 if (nextents
<= fork_recs
)
502 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
506 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
509 if (dip
->di_version
>= 3) {
510 if (be32_to_cpu(dip
->di_crtime
.t_nsec
) >= NSEC_PER_SEC
)
511 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
512 xfs_scrub_inode_flags2(sc
, bp
, dip
, ino
, mode
, flags
, flags2
);
513 xfs_scrub_inode_cowextsize(sc
, bp
, dip
, ino
, mode
, flags
,
518 /* Map and read a raw inode. */
520 xfs_scrub_inode_map_raw(
521 struct xfs_scrub_context
*sc
,
523 struct xfs_buf
**bpp
,
524 struct xfs_dinode
**dipp
)
526 struct xfs_imap imap
;
527 struct xfs_mount
*mp
= sc
->mp
;
528 struct xfs_buf
*bp
= NULL
;
529 struct xfs_dinode
*dip
;
532 error
= xfs_imap(mp
, sc
->tp
, ino
, &imap
, XFS_IGET_UNTRUSTED
);
533 if (error
== -EINVAL
) {
535 * Inode could have gotten deleted out from under us;
536 * just forget about it.
541 if (!xfs_scrub_process_error(sc
, XFS_INO_TO_AGNO(mp
, ino
),
542 XFS_INO_TO_AGBNO(mp
, ino
), &error
))
545 error
= xfs_trans_read_buf(mp
, sc
->tp
, mp
->m_ddev_targp
,
546 imap
.im_blkno
, imap
.im_len
, XBF_UNMAPPED
, &bp
,
548 if (!xfs_scrub_process_error(sc
, XFS_INO_TO_AGNO(mp
, ino
),
549 XFS_INO_TO_AGBNO(mp
, ino
), &error
))
553 * Is this really an inode? We disabled verifiers in the above
554 * xfs_trans_read_buf call because the inode buffer verifier
555 * fails on /any/ inode record in the inode cluster with a bad
556 * magic or version number, not just the one that we're
557 * checking. Therefore, grab the buffer unconditionally, attach
558 * the inode verifiers by hand, and run the inode verifier only
559 * on the one inode we want.
561 bp
->b_ops
= &xfs_inode_buf_ops
;
562 dip
= xfs_buf_offset(bp
, imap
.im_boffset
);
563 if (xfs_dinode_verify(mp
, ino
, dip
) != NULL
||
564 !xfs_dinode_good_version(mp
, dip
->di_version
)) {
565 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
569 /* ...and is it the one we asked for? */
570 if (be32_to_cpu(dip
->di_gen
) != sc
->sm
->sm_gen
) {
580 xfs_trans_brelse(sc
->tp
, bp
);
585 * Make sure the finobt doesn't think this inode is free.
586 * We don't have to check the inobt ourselves because we got the inode via
587 * IGET_UNTRUSTED, which checks the inobt for us.
590 xfs_scrub_inode_xref_finobt(
591 struct xfs_scrub_context
*sc
,
594 struct xfs_inobt_rec_incore rec
;
599 if (!sc
->sa
.fino_cur
)
602 agino
= XFS_INO_TO_AGINO(sc
->mp
, ino
);
605 * Try to get the finobt record. If we can't get it, then we're
608 error
= xfs_inobt_lookup(sc
->sa
.fino_cur
, agino
, XFS_LOOKUP_LE
,
610 if (!xfs_scrub_should_check_xref(sc
, &error
, &sc
->sa
.fino_cur
) ||
614 error
= xfs_inobt_get_rec(sc
->sa
.fino_cur
, &rec
, &has_record
);
615 if (!xfs_scrub_should_check_xref(sc
, &error
, &sc
->sa
.fino_cur
) ||
620 * Otherwise, make sure this record either doesn't cover this inode,
621 * or that it does but it's marked present.
623 if (rec
.ir_startino
> agino
||
624 rec
.ir_startino
+ XFS_INODES_PER_CHUNK
<= agino
)
627 if (rec
.ir_free
& XFS_INOBT_MASK(agino
- rec
.ir_startino
))
628 xfs_scrub_btree_xref_set_corrupt(sc
, sc
->sa
.fino_cur
, 0);
631 /* Cross reference the inode fields with the forks. */
633 xfs_scrub_inode_xref_bmap(
634 struct xfs_scrub_context
*sc
,
635 struct xfs_dinode
*dip
)
637 xfs_extnum_t nextents
;
639 xfs_filblks_t acount
;
642 /* Walk all the extents to check nextents/naextents/nblocks. */
643 error
= xfs_bmap_count_blocks(sc
->tp
, sc
->ip
, XFS_DATA_FORK
,
645 if (!xfs_scrub_should_check_xref(sc
, &error
, NULL
))
647 if (nextents
< be32_to_cpu(dip
->di_nextents
))
648 xfs_scrub_ino_xref_set_corrupt(sc
, sc
->ip
->i_ino
, NULL
);
650 error
= xfs_bmap_count_blocks(sc
->tp
, sc
->ip
, XFS_ATTR_FORK
,
652 if (!xfs_scrub_should_check_xref(sc
, &error
, NULL
))
654 if (nextents
!= be16_to_cpu(dip
->di_anextents
))
655 xfs_scrub_ino_xref_set_corrupt(sc
, sc
->ip
->i_ino
, NULL
);
657 /* Check nblocks against the inode. */
658 if (count
+ acount
!= be64_to_cpu(dip
->di_nblocks
))
659 xfs_scrub_ino_xref_set_corrupt(sc
, sc
->ip
->i_ino
, NULL
);
662 /* Cross-reference with the other btrees. */
664 xfs_scrub_inode_xref(
665 struct xfs_scrub_context
*sc
,
667 struct xfs_dinode
*dip
)
669 struct xfs_owner_info oinfo
;
674 if (sc
->sm
->sm_flags
& XFS_SCRUB_OFLAG_CORRUPT
)
677 agno
= XFS_INO_TO_AGNO(sc
->mp
, ino
);
678 agbno
= XFS_INO_TO_AGBNO(sc
->mp
, ino
);
680 error
= xfs_scrub_ag_init(sc
, agno
, &sc
->sa
);
681 if (!xfs_scrub_xref_process_error(sc
, agno
, agbno
, &error
))
684 xfs_scrub_xref_is_used_space(sc
, agbno
, 1);
685 xfs_scrub_inode_xref_finobt(sc
, ino
);
686 xfs_rmap_ag_owner(&oinfo
, XFS_RMAP_OWN_INODES
);
687 xfs_scrub_xref_is_owned_by(sc
, agbno
, 1, &oinfo
);
688 xfs_scrub_xref_is_not_shared(sc
, agbno
, 1);
689 xfs_scrub_inode_xref_bmap(sc
, dip
);
691 xfs_scrub_ag_free(sc
, &sc
->sa
);
695 * If the reflink iflag disagrees with a scan for shared data fork extents,
696 * either flag an error (shared extents w/ no flag) or a preen (flag set w/o
697 * any shared extents). We already checked for reflink iflag set on a non
698 * reflink filesystem.
701 xfs_scrub_inode_check_reflink_iflag(
702 struct xfs_scrub_context
*sc
,
706 struct xfs_mount
*mp
= sc
->mp
;
710 if (!xfs_sb_version_hasreflink(&mp
->m_sb
))
713 error
= xfs_reflink_inode_has_shared_extents(sc
->tp
, sc
->ip
,
715 if (!xfs_scrub_xref_process_error(sc
, XFS_INO_TO_AGNO(mp
, ino
),
716 XFS_INO_TO_AGBNO(mp
, ino
), &error
))
718 if (xfs_is_reflink_inode(sc
->ip
) && !has_shared
)
719 xfs_scrub_ino_set_preen(sc
, ino
, bp
);
720 else if (!xfs_is_reflink_inode(sc
->ip
) && has_shared
)
721 xfs_scrub_ino_set_corrupt(sc
, ino
, bp
);
724 /* Scrub an inode. */
727 struct xfs_scrub_context
*sc
)
729 struct xfs_dinode di
;
730 struct xfs_buf
*bp
= NULL
;
731 struct xfs_dinode
*dip
;
735 /* Did we get the in-core inode, or are we doing this manually? */
738 xfs_inode_to_disk(sc
->ip
, &di
, 0);
741 /* Map & read inode. */
742 ino
= sc
->sm
->sm_ino
;
743 error
= xfs_scrub_inode_map_raw(sc
, ino
, &bp
, &dip
);
748 xfs_scrub_dinode(sc
, bp
, dip
, ino
);
749 if (sc
->sm
->sm_flags
& XFS_SCRUB_OFLAG_CORRUPT
)
752 /* Now let's do the things that require a live inode. */
757 * Look for discrepancies between file's data blocks and the reflink
758 * iflag. We already checked the iflag against the file mode when
759 * we scrubbed the dinode.
761 if (S_ISREG(VFS_I(sc
->ip
)->i_mode
))
762 xfs_scrub_inode_check_reflink_iflag(sc
, ino
, bp
);
764 xfs_scrub_inode_xref(sc
, ino
, dip
);
767 xfs_trans_brelse(sc
->tp
, bp
);