inode.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Oracle. All Rights Reserved.
  4. * Author: Darrick J. Wong <darrick.wong@oracle.com>
  5. */
  6. #include "xfs.h"
  7. #include "xfs_fs.h"
  8. #include "xfs_shared.h"
  9. #include "xfs_format.h"
  10. #include "xfs_trans_resv.h"
  11. #include "xfs_mount.h"
  12. #include "xfs_defer.h"
  13. #include "xfs_btree.h"
  14. #include "xfs_bit.h"
  15. #include "xfs_log_format.h"
  16. #include "xfs_trans.h"
  17. #include "xfs_sb.h"
  18. #include "xfs_inode.h"
  19. #include "xfs_icache.h"
  20. #include "xfs_inode_buf.h"
  21. #include "xfs_inode_fork.h"
  22. #include "xfs_ialloc.h"
  23. #include "xfs_da_format.h"
  24. #include "xfs_reflink.h"
  25. #include "xfs_rmap.h"
  26. #include "xfs_bmap.h"
  27. #include "xfs_bmap_util.h"
  28. #include "scrub/xfs_scrub.h"
  29. #include "scrub/scrub.h"
  30. #include "scrub/common.h"
  31. #include "scrub/btree.h"
  32. #include "scrub/trace.h"
  33. /*
  34. * Grab total control of the inode metadata. It doesn't matter here if
  35. * the file data is still changing; exclusive access to the metadata is
  36. * the goal.
  37. */
  38. int
  39. xchk_setup_inode(
  40. struct xfs_scrub *sc,
  41. struct xfs_inode *ip)
  42. {
  43. int error;
  44. /*
  45. * Try to get the inode. If the verifiers fail, we try again
  46. * in raw mode.
  47. */
  48. error = xchk_get_inode(sc, ip);
  49. switch (error) {
  50. case 0:
  51. break;
  52. case -EFSCORRUPTED:
  53. case -EFSBADCRC:
  54. return xchk_trans_alloc(sc, 0);
  55. default:
  56. return error;
  57. }
  58. /* Got the inode, lock it and we're ready to go. */
  59. sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
  60. xfs_ilock(sc->ip, sc->ilock_flags);
  61. error = xchk_trans_alloc(sc, 0);
  62. if (error)
  63. goto out;
  64. sc->ilock_flags |= XFS_ILOCK_EXCL;
  65. xfs_ilock(sc->ip, XFS_ILOCK_EXCL);
  66. out:
  67. /* scrub teardown will unlock and release the inode for us */
  68. return error;
  69. }
  70. /* Inode core */
  71. /* Validate di_extsize hint. */
  72. STATIC void
  73. xchk_inode_extsize(
  74. struct xfs_scrub *sc,
  75. struct xfs_dinode *dip,
  76. xfs_ino_t ino,
  77. uint16_t mode,
  78. uint16_t flags)
  79. {
  80. xfs_failaddr_t fa;
  81. fa = xfs_inode_validate_extsize(sc->mp, be32_to_cpu(dip->di_extsize),
  82. mode, flags);
  83. if (fa)
  84. xchk_ino_set_corrupt(sc, ino);
  85. }
  86. /*
  87. * Validate di_cowextsize hint.
  88. *
  89. * The rules are documented at xfs_ioctl_setattr_check_cowextsize().
  90. * These functions must be kept in sync with each other.
  91. */
  92. STATIC void
  93. xchk_inode_cowextsize(
  94. struct xfs_scrub *sc,
  95. struct xfs_dinode *dip,
  96. xfs_ino_t ino,
  97. uint16_t mode,
  98. uint16_t flags,
  99. uint64_t flags2)
  100. {
  101. xfs_failaddr_t fa;
  102. fa = xfs_inode_validate_cowextsize(sc->mp,
  103. be32_to_cpu(dip->di_cowextsize), mode, flags,
  104. flags2);
  105. if (fa)
  106. xchk_ino_set_corrupt(sc, ino);
  107. }
  108. /* Make sure the di_flags make sense for the inode. */
  109. STATIC void
  110. xchk_inode_flags(
  111. struct xfs_scrub *sc,
  112. struct xfs_dinode *dip,
  113. xfs_ino_t ino,
  114. uint16_t mode,
  115. uint16_t flags)
  116. {
  117. struct xfs_mount *mp = sc->mp;
  118. /* di_flags are all taken, last bit cannot be used */
  119. if (flags & ~XFS_DIFLAG_ANY)
  120. goto bad;
  121. /* rt flags require rt device */
  122. if ((flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp)
  123. goto bad;
  124. /* new rt bitmap flag only valid for rbmino */
  125. if ((flags & XFS_DIFLAG_NEWRTBM) && ino != mp->m_sb.sb_rbmino)
  126. goto bad;
  127. /* directory-only flags */
  128. if ((flags & (XFS_DIFLAG_RTINHERIT |
  129. XFS_DIFLAG_EXTSZINHERIT |
  130. XFS_DIFLAG_PROJINHERIT |
  131. XFS_DIFLAG_NOSYMLINKS)) &&
  132. !S_ISDIR(mode))
  133. goto bad;
  134. /* file-only flags */
  135. if ((flags & (XFS_DIFLAG_REALTIME | FS_XFLAG_EXTSIZE)) &&
  136. !S_ISREG(mode))
  137. goto bad;
  138. /* filestreams and rt make no sense */
  139. if ((flags & XFS_DIFLAG_FILESTREAM) && (flags & XFS_DIFLAG_REALTIME))
  140. goto bad;
  141. return;
  142. bad:
  143. xchk_ino_set_corrupt(sc, ino);
  144. }
  145. /* Make sure the di_flags2 make sense for the inode. */
  146. STATIC void
  147. xchk_inode_flags2(
  148. struct xfs_scrub *sc,
  149. struct xfs_dinode *dip,
  150. xfs_ino_t ino,
  151. uint16_t mode,
  152. uint16_t flags,
  153. uint64_t flags2)
  154. {
  155. struct xfs_mount *mp = sc->mp;
  156. /* Unknown di_flags2 could be from a future kernel */
  157. if (flags2 & ~XFS_DIFLAG2_ANY)
  158. xchk_ino_set_warning(sc, ino);
  159. /* reflink flag requires reflink feature */
  160. if ((flags2 & XFS_DIFLAG2_REFLINK) &&
  161. !xfs_sb_version_hasreflink(&mp->m_sb))
  162. goto bad;
  163. /* cowextsize flag is checked w.r.t. mode separately */
  164. /* file/dir-only flags */
  165. if ((flags2 & XFS_DIFLAG2_DAX) && !(S_ISREG(mode) || S_ISDIR(mode)))
  166. goto bad;
  167. /* file-only flags */
  168. if ((flags2 & XFS_DIFLAG2_REFLINK) && !S_ISREG(mode))
  169. goto bad;
  170. /* realtime and reflink make no sense, currently */
  171. if ((flags & XFS_DIFLAG_REALTIME) && (flags2 & XFS_DIFLAG2_REFLINK))
  172. goto bad;
  173. /* dax and reflink make no sense, currently */
  174. if ((flags2 & XFS_DIFLAG2_DAX) && (flags2 & XFS_DIFLAG2_REFLINK))
  175. goto bad;
  176. return;
  177. bad:
  178. xchk_ino_set_corrupt(sc, ino);
  179. }
  180. /* Scrub all the ondisk inode fields. */
  181. STATIC void
  182. xchk_dinode(
  183. struct xfs_scrub *sc,
  184. struct xfs_dinode *dip,
  185. xfs_ino_t ino)
  186. {
  187. struct xfs_mount *mp = sc->mp;
  188. size_t fork_recs;
  189. unsigned long long isize;
  190. uint64_t flags2;
  191. uint32_t nextents;
  192. uint16_t flags;
  193. uint16_t mode;
  194. flags = be16_to_cpu(dip->di_flags);
  195. if (dip->di_version >= 3)
  196. flags2 = be64_to_cpu(dip->di_flags2);
  197. else
  198. flags2 = 0;
  199. /* di_mode */
  200. mode = be16_to_cpu(dip->di_mode);
  201. switch (mode & S_IFMT) {
  202. case S_IFLNK:
  203. case S_IFREG:
  204. case S_IFDIR:
  205. case S_IFCHR:
  206. case S_IFBLK:
  207. case S_IFIFO:
  208. case S_IFSOCK:
  209. /* mode is recognized */
  210. break;
  211. default:
  212. xchk_ino_set_corrupt(sc, ino);
  213. break;
  214. }
  215. /* v1/v2 fields */
  216. switch (dip->di_version) {
  217. case 1:
  218. /*
  219. * We autoconvert v1 inodes into v2 inodes on writeout,
  220. * so just mark this inode for preening.
  221. */
  222. xchk_ino_set_preen(sc, ino);
  223. break;
  224. case 2:
  225. case 3:
  226. if (dip->di_onlink != 0)
  227. xchk_ino_set_corrupt(sc, ino);
  228. if (dip->di_mode == 0 && sc->ip)
  229. xchk_ino_set_corrupt(sc, ino);
  230. if (dip->di_projid_hi != 0 &&
  231. !xfs_sb_version_hasprojid32bit(&mp->m_sb))
  232. xchk_ino_set_corrupt(sc, ino);
  233. break;
  234. default:
  235. xchk_ino_set_corrupt(sc, ino);
  236. return;
  237. }
  238. /*
  239. * di_uid/di_gid -- -1 isn't invalid, but there's no way that
  240. * userspace could have created that.
  241. */
  242. if (dip->di_uid == cpu_to_be32(-1U) ||
  243. dip->di_gid == cpu_to_be32(-1U))
  244. xchk_ino_set_warning(sc, ino);
  245. /* di_format */
  246. switch (dip->di_format) {
  247. case XFS_DINODE_FMT_DEV:
  248. if (!S_ISCHR(mode) && !S_ISBLK(mode) &&
  249. !S_ISFIFO(mode) && !S_ISSOCK(mode))
  250. xchk_ino_set_corrupt(sc, ino);
  251. break;
  252. case XFS_DINODE_FMT_LOCAL:
  253. if (!S_ISDIR(mode) && !S_ISLNK(mode))
  254. xchk_ino_set_corrupt(sc, ino);
  255. break;
  256. case XFS_DINODE_FMT_EXTENTS:
  257. if (!S_ISREG(mode) && !S_ISDIR(mode) && !S_ISLNK(mode))
  258. xchk_ino_set_corrupt(sc, ino);
  259. break;
  260. case XFS_DINODE_FMT_BTREE:
  261. if (!S_ISREG(mode) && !S_ISDIR(mode))
  262. xchk_ino_set_corrupt(sc, ino);
  263. break;
  264. case XFS_DINODE_FMT_UUID:
  265. default:
  266. xchk_ino_set_corrupt(sc, ino);
  267. break;
  268. }
  269. /* di_[amc]time.nsec */
  270. if (be32_to_cpu(dip->di_atime.t_nsec) >= NSEC_PER_SEC)
  271. xchk_ino_set_corrupt(sc, ino);
  272. if (be32_to_cpu(dip->di_mtime.t_nsec) >= NSEC_PER_SEC)
  273. xchk_ino_set_corrupt(sc, ino);
  274. if (be32_to_cpu(dip->di_ctime.t_nsec) >= NSEC_PER_SEC)
  275. xchk_ino_set_corrupt(sc, ino);
  276. /*
  277. * di_size. xfs_dinode_verify checks for things that screw up
  278. * the VFS such as the upper bit being set and zero-length
  279. * symlinks/directories, but we can do more here.
  280. */
  281. isize = be64_to_cpu(dip->di_size);
  282. if (isize & (1ULL << 63))
  283. xchk_ino_set_corrupt(sc, ino);
  284. /* Devices, fifos, and sockets must have zero size */
  285. if (!S_ISDIR(mode) && !S_ISREG(mode) && !S_ISLNK(mode) && isize != 0)
  286. xchk_ino_set_corrupt(sc, ino);
  287. /* Directories can't be larger than the data section size (32G) */
  288. if (S_ISDIR(mode) && (isize == 0 || isize >= XFS_DIR2_SPACE_SIZE))
  289. xchk_ino_set_corrupt(sc, ino);
  290. /* Symlinks can't be larger than SYMLINK_MAXLEN */
  291. if (S_ISLNK(mode) && (isize == 0 || isize >= XFS_SYMLINK_MAXLEN))
  292. xchk_ino_set_corrupt(sc, ino);
  293. /*
  294. * Warn if the running kernel can't handle the kinds of offsets
  295. * needed to deal with the file size. In other words, if the
  296. * pagecache can't cache all the blocks in this file due to
  297. * overly large offsets, flag the inode for admin review.
  298. */
  299. if (isize >= mp->m_super->s_maxbytes)
  300. xchk_ino_set_warning(sc, ino);
  301. /* di_nblocks */
  302. if (flags2 & XFS_DIFLAG2_REFLINK) {
  303. ; /* nblocks can exceed dblocks */
  304. } else if (flags & XFS_DIFLAG_REALTIME) {
  305. /*
  306. * nblocks is the sum of data extents (in the rtdev),
  307. * attr extents (in the datadev), and both forks' bmbt
  308. * blocks (in the datadev). This clumsy check is the
  309. * best we can do without cross-referencing with the
  310. * inode forks.
  311. */
  312. if (be64_to_cpu(dip->di_nblocks) >=
  313. mp->m_sb.sb_dblocks + mp->m_sb.sb_rblocks)
  314. xchk_ino_set_corrupt(sc, ino);
  315. } else {
  316. if (be64_to_cpu(dip->di_nblocks) >= mp->m_sb.sb_dblocks)
  317. xchk_ino_set_corrupt(sc, ino);
  318. }
  319. xchk_inode_flags(sc, dip, ino, mode, flags);
  320. xchk_inode_extsize(sc, dip, ino, mode, flags);
  321. /* di_nextents */
  322. nextents = be32_to_cpu(dip->di_nextents);
  323. fork_recs = XFS_DFORK_DSIZE(dip, mp) / sizeof(struct xfs_bmbt_rec);
  324. switch (dip->di_format) {
  325. case XFS_DINODE_FMT_EXTENTS:
  326. if (nextents > fork_recs)
  327. xchk_ino_set_corrupt(sc, ino);
  328. break;
  329. case XFS_DINODE_FMT_BTREE:
  330. if (nextents <= fork_recs)
  331. xchk_ino_set_corrupt(sc, ino);
  332. break;
  333. default:
  334. if (nextents != 0)
  335. xchk_ino_set_corrupt(sc, ino);
  336. break;
  337. }
  338. /* di_forkoff */
  339. if (XFS_DFORK_APTR(dip) >= (char *)dip + mp->m_sb.sb_inodesize)
  340. xchk_ino_set_corrupt(sc, ino);
  341. if (dip->di_anextents != 0 && dip->di_forkoff == 0)
  342. xchk_ino_set_corrupt(sc, ino);
  343. if (dip->di_forkoff == 0 && dip->di_aformat != XFS_DINODE_FMT_EXTENTS)
  344. xchk_ino_set_corrupt(sc, ino);
  345. /* di_aformat */
  346. if (dip->di_aformat != XFS_DINODE_FMT_LOCAL &&
  347. dip->di_aformat != XFS_DINODE_FMT_EXTENTS &&
  348. dip->di_aformat != XFS_DINODE_FMT_BTREE)
  349. xchk_ino_set_corrupt(sc, ino);
  350. /* di_anextents */
  351. nextents = be16_to_cpu(dip->di_anextents);
  352. fork_recs = XFS_DFORK_ASIZE(dip, mp) / sizeof(struct xfs_bmbt_rec);
  353. switch (dip->di_aformat) {
  354. case XFS_DINODE_FMT_EXTENTS:
  355. if (nextents > fork_recs)
  356. xchk_ino_set_corrupt(sc, ino);
  357. break;
  358. case XFS_DINODE_FMT_BTREE:
  359. if (nextents <= fork_recs)
  360. xchk_ino_set_corrupt(sc, ino);
  361. break;
  362. default:
  363. if (nextents != 0)
  364. xchk_ino_set_corrupt(sc, ino);
  365. }
  366. if (dip->di_version >= 3) {
  367. if (be32_to_cpu(dip->di_crtime.t_nsec) >= NSEC_PER_SEC)
  368. xchk_ino_set_corrupt(sc, ino);
  369. xchk_inode_flags2(sc, dip, ino, mode, flags, flags2);
  370. xchk_inode_cowextsize(sc, dip, ino, mode, flags,
  371. flags2);
  372. }
  373. }
  374. /*
  375. * Make sure the finobt doesn't think this inode is free.
  376. * We don't have to check the inobt ourselves because we got the inode via
  377. * IGET_UNTRUSTED, which checks the inobt for us.
  378. */
  379. static void
  380. xchk_inode_xref_finobt(
  381. struct xfs_scrub *sc,
  382. xfs_ino_t ino)
  383. {
  384. struct xfs_inobt_rec_incore rec;
  385. xfs_agino_t agino;
  386. int has_record;
  387. int error;
  388. if (!sc->sa.fino_cur || xchk_skip_xref(sc->sm))
  389. return;
  390. agino = XFS_INO_TO_AGINO(sc->mp, ino);
  391. /*
  392. * Try to get the finobt record. If we can't get it, then we're
  393. * in good shape.
  394. */
  395. error = xfs_inobt_lookup(sc->sa.fino_cur, agino, XFS_LOOKUP_LE,
  396. &has_record);
  397. if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur) ||
  398. !has_record)
  399. return;
  400. error = xfs_inobt_get_rec(sc->sa.fino_cur, &rec, &has_record);
  401. if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur) ||
  402. !has_record)
  403. return;
  404. /*
  405. * Otherwise, make sure this record either doesn't cover this inode,
  406. * or that it does but it's marked present.
  407. */
  408. if (rec.ir_startino > agino ||
  409. rec.ir_startino + XFS_INODES_PER_CHUNK <= agino)
  410. return;
  411. if (rec.ir_free & XFS_INOBT_MASK(agino - rec.ir_startino))
  412. xchk_btree_xref_set_corrupt(sc, sc->sa.fino_cur, 0);
  413. }
  414. /* Cross reference the inode fields with the forks. */
  415. STATIC void
  416. xchk_inode_xref_bmap(
  417. struct xfs_scrub *sc,
  418. struct xfs_dinode *dip)
  419. {
  420. xfs_extnum_t nextents;
  421. xfs_filblks_t count;
  422. xfs_filblks_t acount;
  423. int error;
  424. if (xchk_skip_xref(sc->sm))
  425. return;
  426. /* Walk all the extents to check nextents/naextents/nblocks. */
  427. error = xfs_bmap_count_blocks(sc->tp, sc->ip, XFS_DATA_FORK,
  428. &nextents, &count);
  429. if (!xchk_should_check_xref(sc, &error, NULL))
  430. return;
  431. if (nextents < be32_to_cpu(dip->di_nextents))
  432. xchk_ino_xref_set_corrupt(sc, sc->ip->i_ino);
  433. error = xfs_bmap_count_blocks(sc->tp, sc->ip, XFS_ATTR_FORK,
  434. &nextents, &acount);
  435. if (!xchk_should_check_xref(sc, &error, NULL))
  436. return;
  437. if (nextents != be16_to_cpu(dip->di_anextents))
  438. xchk_ino_xref_set_corrupt(sc, sc->ip->i_ino);
  439. /* Check nblocks against the inode. */
  440. if (count + acount != be64_to_cpu(dip->di_nblocks))
  441. xchk_ino_xref_set_corrupt(sc, sc->ip->i_ino);
  442. }
  443. /* Cross-reference with the other btrees. */
  444. STATIC void
  445. xchk_inode_xref(
  446. struct xfs_scrub *sc,
  447. xfs_ino_t ino,
  448. struct xfs_dinode *dip)
  449. {
  450. struct xfs_owner_info oinfo;
  451. xfs_agnumber_t agno;
  452. xfs_agblock_t agbno;
  453. int error;
  454. if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
  455. return;
  456. agno = XFS_INO_TO_AGNO(sc->mp, ino);
  457. agbno = XFS_INO_TO_AGBNO(sc->mp, ino);
  458. error = xchk_ag_init(sc, agno, &sc->sa);
  459. if (!xchk_xref_process_error(sc, agno, agbno, &error))
  460. return;
  461. xchk_xref_is_used_space(sc, agbno, 1);
  462. xchk_inode_xref_finobt(sc, ino);
  463. xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_INODES);
  464. xchk_xref_is_owned_by(sc, agbno, 1, &oinfo);
  465. xchk_xref_is_not_shared(sc, agbno, 1);
  466. xchk_inode_xref_bmap(sc, dip);
  467. xchk_ag_free(sc, &sc->sa);
  468. }
  469. /*
  470. * If the reflink iflag disagrees with a scan for shared data fork extents,
  471. * either flag an error (shared extents w/ no flag) or a preen (flag set w/o
  472. * any shared extents). We already checked for reflink iflag set on a non
  473. * reflink filesystem.
  474. */
  475. static void
  476. xchk_inode_check_reflink_iflag(
  477. struct xfs_scrub *sc,
  478. xfs_ino_t ino)
  479. {
  480. struct xfs_mount *mp = sc->mp;
  481. bool has_shared;
  482. int error;
  483. if (!xfs_sb_version_hasreflink(&mp->m_sb))
  484. return;
  485. error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip,
  486. &has_shared);
  487. if (!xchk_xref_process_error(sc, XFS_INO_TO_AGNO(mp, ino),
  488. XFS_INO_TO_AGBNO(mp, ino), &error))
  489. return;
  490. if (xfs_is_reflink_inode(sc->ip) && !has_shared)
  491. xchk_ino_set_preen(sc, ino);
  492. else if (!xfs_is_reflink_inode(sc->ip) && has_shared)
  493. xchk_ino_set_corrupt(sc, ino);
  494. }
  495. /* Scrub an inode. */
  496. int
  497. xchk_inode(
  498. struct xfs_scrub *sc)
  499. {
  500. struct xfs_dinode di;
  501. int error = 0;
  502. /*
  503. * If sc->ip is NULL, that means that the setup function called
  504. * xfs_iget to look up the inode. xfs_iget returned a EFSCORRUPTED
  505. * and a NULL inode, so flag the corruption error and return.
  506. */
  507. if (!sc->ip) {
  508. xchk_ino_set_corrupt(sc, sc->sm->sm_ino);
  509. return 0;
  510. }
  511. /* Scrub the inode core. */
  512. xfs_inode_to_disk(sc->ip, &di, 0);
  513. xchk_dinode(sc, &di, sc->ip->i_ino);
  514. if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
  515. goto out;
  516. /*
  517. * Look for discrepancies between file's data blocks and the reflink
  518. * iflag. We already checked the iflag against the file mode when
  519. * we scrubbed the dinode.
  520. */
  521. if (S_ISREG(VFS_I(sc->ip)->i_mode))
  522. xchk_inode_check_reflink_iflag(sc, sc->ip->i_ino);
  523. xchk_inode_xref(sc, sc->ip->i_ino, &di);
  524. out:
  525. return error;
  526. }