scrub.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Oracle. All Rights Reserved.
  4. * Author: Darrick J. Wong <[email protected]>
  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_log_format.h"
  13. #include "xfs_trans.h"
  14. #include "xfs_inode.h"
  15. #include "xfs_quota.h"
  16. #include "xfs_qm.h"
  17. #include "xfs_errortag.h"
  18. #include "xfs_error.h"
  19. #include "xfs_scrub.h"
  20. #include "scrub/scrub.h"
  21. #include "scrub/common.h"
  22. #include "scrub/trace.h"
  23. #include "scrub/repair.h"
  24. #include "scrub/health.h"
  25. /*
  26. * Online Scrub and Repair
  27. *
  28. * Traditionally, XFS (the kernel driver) did not know how to check or
  29. * repair on-disk data structures. That task was left to the xfs_check
  30. * and xfs_repair tools, both of which require taking the filesystem
  31. * offline for a thorough but time consuming examination. Online
  32. * scrub & repair, on the other hand, enables us to check the metadata
  33. * for obvious errors while carefully stepping around the filesystem's
  34. * ongoing operations, locking rules, etc.
  35. *
  36. * Given that most XFS metadata consist of records stored in a btree,
  37. * most of the checking functions iterate the btree blocks themselves
  38. * looking for irregularities. When a record block is encountered, each
  39. * record can be checked for obviously bad values. Record values can
  40. * also be cross-referenced against other btrees to look for potential
  41. * misunderstandings between pieces of metadata.
  42. *
  43. * It is expected that the checkers responsible for per-AG metadata
  44. * structures will lock the AG headers (AGI, AGF, AGFL), iterate the
  45. * metadata structure, and perform any relevant cross-referencing before
  46. * unlocking the AG and returning the results to userspace. These
  47. * scrubbers must not keep an AG locked for too long to avoid tying up
  48. * the block and inode allocators.
  49. *
  50. * Block maps and b-trees rooted in an inode present a special challenge
  51. * because they can involve extents from any AG. The general scrubber
  52. * structure of lock -> check -> xref -> unlock still holds, but AG
  53. * locking order rules /must/ be obeyed to avoid deadlocks. The
  54. * ordering rule, of course, is that we must lock in increasing AG
  55. * order. Helper functions are provided to track which AG headers we've
  56. * already locked. If we detect an imminent locking order violation, we
  57. * can signal a potential deadlock, in which case the scrubber can jump
  58. * out to the top level, lock all the AGs in order, and retry the scrub.
  59. *
  60. * For file data (directories, extended attributes, symlinks) scrub, we
  61. * can simply lock the inode and walk the data. For btree data
  62. * (directories and attributes) we follow the same btree-scrubbing
  63. * strategy outlined previously to check the records.
  64. *
  65. * We use a bit of trickery with transactions to avoid buffer deadlocks
  66. * if there is a cycle in the metadata. The basic problem is that
  67. * travelling down a btree involves locking the current buffer at each
  68. * tree level. If a pointer should somehow point back to a buffer that
  69. * we've already examined, we will deadlock due to the second buffer
  70. * locking attempt. Note however that grabbing a buffer in transaction
  71. * context links the locked buffer to the transaction. If we try to
  72. * re-grab the buffer in the context of the same transaction, we avoid
  73. * the second lock attempt and continue. Between the verifier and the
  74. * scrubber, something will notice that something is amiss and report
  75. * the corruption. Therefore, each scrubber will allocate an empty
  76. * transaction, attach buffers to it, and cancel the transaction at the
  77. * end of the scrub run. Cancelling a non-dirty transaction simply
  78. * unlocks the buffers.
  79. *
  80. * There are four pieces of data that scrub can communicate to
  81. * userspace. The first is the error code (errno), which can be used to
  82. * communicate operational errors in performing the scrub. There are
  83. * also three flags that can be set in the scrub context. If the data
  84. * structure itself is corrupt, the CORRUPT flag will be set. If
  85. * the metadata is correct but otherwise suboptimal, the PREEN flag
  86. * will be set.
  87. *
  88. * We perform secondary validation of filesystem metadata by
  89. * cross-referencing every record with all other available metadata.
  90. * For example, for block mapping extents, we verify that there are no
  91. * records in the free space and inode btrees corresponding to that
  92. * space extent and that there is a corresponding entry in the reverse
  93. * mapping btree. Inconsistent metadata is noted by setting the
  94. * XCORRUPT flag; btree query function errors are noted by setting the
  95. * XFAIL flag and deleting the cursor to prevent further attempts to
  96. * cross-reference with a defective btree.
  97. *
  98. * If a piece of metadata proves corrupt or suboptimal, the userspace
  99. * program can ask the kernel to apply some tender loving care (TLC) to
  100. * the metadata object by setting the REPAIR flag and re-calling the
  101. * scrub ioctl. "Corruption" is defined by metadata violating the
  102. * on-disk specification; operations cannot continue if the violation is
  103. * left untreated. It is possible for XFS to continue if an object is
  104. * "suboptimal", however performance may be degraded. Repairs are
  105. * usually performed by rebuilding the metadata entirely out of
  106. * redundant metadata. Optimizing, on the other hand, can sometimes be
  107. * done without rebuilding entire structures.
  108. *
  109. * Generally speaking, the repair code has the following code structure:
  110. * Lock -> scrub -> repair -> commit -> re-lock -> re-scrub -> unlock.
  111. * The first check helps us figure out if we need to rebuild or simply
  112. * optimize the structure so that the rebuild knows what to do. The
  113. * second check evaluates the completeness of the repair; that is what
  114. * is reported to userspace.
  115. *
  116. * A quick note on symbol prefixes:
  117. * - "xfs_" are general XFS symbols.
  118. * - "xchk_" are symbols related to metadata checking.
  119. * - "xrep_" are symbols related to metadata repair.
  120. * - "xfs_scrub_" are symbols that tie online fsck to the rest of XFS.
  121. */
  122. /*
  123. * Scrub probe -- userspace uses this to probe if we're willing to scrub
  124. * or repair a given mountpoint. This will be used by xfs_scrub to
  125. * probe the kernel's abilities to scrub (and repair) the metadata. We
  126. * do this by validating the ioctl inputs from userspace, preparing the
  127. * filesystem for a scrub (or a repair) operation, and immediately
  128. * returning to userspace. Userspace can use the returned errno and
  129. * structure state to decide (in broad terms) if scrub/repair are
  130. * supported by the running kernel.
  131. */
  132. static int
  133. xchk_probe(
  134. struct xfs_scrub *sc)
  135. {
  136. int error = 0;
  137. if (xchk_should_terminate(sc, &error))
  138. return error;
  139. return 0;
  140. }
  141. /* Scrub setup and teardown */
  142. /* Free all the resources and finish the transactions. */
  143. STATIC int
  144. xchk_teardown(
  145. struct xfs_scrub *sc,
  146. int error)
  147. {
  148. struct xfs_inode *ip_in = XFS_I(file_inode(sc->file));
  149. xchk_ag_free(sc, &sc->sa);
  150. if (sc->tp) {
  151. if (error == 0 && (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR))
  152. error = xfs_trans_commit(sc->tp);
  153. else
  154. xfs_trans_cancel(sc->tp);
  155. sc->tp = NULL;
  156. }
  157. if (sc->ip) {
  158. if (sc->ilock_flags)
  159. xfs_iunlock(sc->ip, sc->ilock_flags);
  160. if (sc->ip != ip_in &&
  161. !xfs_internal_inum(sc->mp, sc->ip->i_ino))
  162. xfs_irele(sc->ip);
  163. sc->ip = NULL;
  164. }
  165. if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR)
  166. mnt_drop_write_file(sc->file);
  167. if (sc->buf) {
  168. kmem_free(sc->buf);
  169. sc->buf = NULL;
  170. }
  171. return error;
  172. }
  173. /* Scrubbing dispatch. */
  174. static const struct xchk_meta_ops meta_scrub_ops[] = {
  175. [XFS_SCRUB_TYPE_PROBE] = { /* ioctl presence test */
  176. .type = ST_NONE,
  177. .setup = xchk_setup_fs,
  178. .scrub = xchk_probe,
  179. .repair = xrep_probe,
  180. },
  181. [XFS_SCRUB_TYPE_SB] = { /* superblock */
  182. .type = ST_PERAG,
  183. .setup = xchk_setup_fs,
  184. .scrub = xchk_superblock,
  185. .repair = xrep_superblock,
  186. },
  187. [XFS_SCRUB_TYPE_AGF] = { /* agf */
  188. .type = ST_PERAG,
  189. .setup = xchk_setup_fs,
  190. .scrub = xchk_agf,
  191. .repair = xrep_agf,
  192. },
  193. [XFS_SCRUB_TYPE_AGFL]= { /* agfl */
  194. .type = ST_PERAG,
  195. .setup = xchk_setup_fs,
  196. .scrub = xchk_agfl,
  197. .repair = xrep_agfl,
  198. },
  199. [XFS_SCRUB_TYPE_AGI] = { /* agi */
  200. .type = ST_PERAG,
  201. .setup = xchk_setup_fs,
  202. .scrub = xchk_agi,
  203. .repair = xrep_agi,
  204. },
  205. [XFS_SCRUB_TYPE_BNOBT] = { /* bnobt */
  206. .type = ST_PERAG,
  207. .setup = xchk_setup_ag_allocbt,
  208. .scrub = xchk_bnobt,
  209. .repair = xrep_notsupported,
  210. },
  211. [XFS_SCRUB_TYPE_CNTBT] = { /* cntbt */
  212. .type = ST_PERAG,
  213. .setup = xchk_setup_ag_allocbt,
  214. .scrub = xchk_cntbt,
  215. .repair = xrep_notsupported,
  216. },
  217. [XFS_SCRUB_TYPE_INOBT] = { /* inobt */
  218. .type = ST_PERAG,
  219. .setup = xchk_setup_ag_iallocbt,
  220. .scrub = xchk_inobt,
  221. .repair = xrep_notsupported,
  222. },
  223. [XFS_SCRUB_TYPE_FINOBT] = { /* finobt */
  224. .type = ST_PERAG,
  225. .setup = xchk_setup_ag_iallocbt,
  226. .scrub = xchk_finobt,
  227. .has = xfs_has_finobt,
  228. .repair = xrep_notsupported,
  229. },
  230. [XFS_SCRUB_TYPE_RMAPBT] = { /* rmapbt */
  231. .type = ST_PERAG,
  232. .setup = xchk_setup_ag_rmapbt,
  233. .scrub = xchk_rmapbt,
  234. .has = xfs_has_rmapbt,
  235. .repair = xrep_notsupported,
  236. },
  237. [XFS_SCRUB_TYPE_REFCNTBT] = { /* refcountbt */
  238. .type = ST_PERAG,
  239. .setup = xchk_setup_ag_refcountbt,
  240. .scrub = xchk_refcountbt,
  241. .has = xfs_has_reflink,
  242. .repair = xrep_notsupported,
  243. },
  244. [XFS_SCRUB_TYPE_INODE] = { /* inode record */
  245. .type = ST_INODE,
  246. .setup = xchk_setup_inode,
  247. .scrub = xchk_inode,
  248. .repair = xrep_notsupported,
  249. },
  250. [XFS_SCRUB_TYPE_BMBTD] = { /* inode data fork */
  251. .type = ST_INODE,
  252. .setup = xchk_setup_inode_bmap,
  253. .scrub = xchk_bmap_data,
  254. .repair = xrep_notsupported,
  255. },
  256. [XFS_SCRUB_TYPE_BMBTA] = { /* inode attr fork */
  257. .type = ST_INODE,
  258. .setup = xchk_setup_inode_bmap,
  259. .scrub = xchk_bmap_attr,
  260. .repair = xrep_notsupported,
  261. },
  262. [XFS_SCRUB_TYPE_BMBTC] = { /* inode CoW fork */
  263. .type = ST_INODE,
  264. .setup = xchk_setup_inode_bmap,
  265. .scrub = xchk_bmap_cow,
  266. .repair = xrep_notsupported,
  267. },
  268. [XFS_SCRUB_TYPE_DIR] = { /* directory */
  269. .type = ST_INODE,
  270. .setup = xchk_setup_directory,
  271. .scrub = xchk_directory,
  272. .repair = xrep_notsupported,
  273. },
  274. [XFS_SCRUB_TYPE_XATTR] = { /* extended attributes */
  275. .type = ST_INODE,
  276. .setup = xchk_setup_xattr,
  277. .scrub = xchk_xattr,
  278. .repair = xrep_notsupported,
  279. },
  280. [XFS_SCRUB_TYPE_SYMLINK] = { /* symbolic link */
  281. .type = ST_INODE,
  282. .setup = xchk_setup_symlink,
  283. .scrub = xchk_symlink,
  284. .repair = xrep_notsupported,
  285. },
  286. [XFS_SCRUB_TYPE_PARENT] = { /* parent pointers */
  287. .type = ST_INODE,
  288. .setup = xchk_setup_parent,
  289. .scrub = xchk_parent,
  290. .repair = xrep_notsupported,
  291. },
  292. [XFS_SCRUB_TYPE_RTBITMAP] = { /* realtime bitmap */
  293. .type = ST_FS,
  294. .setup = xchk_setup_rt,
  295. .scrub = xchk_rtbitmap,
  296. .has = xfs_has_realtime,
  297. .repair = xrep_notsupported,
  298. },
  299. [XFS_SCRUB_TYPE_RTSUM] = { /* realtime summary */
  300. .type = ST_FS,
  301. .setup = xchk_setup_rt,
  302. .scrub = xchk_rtsummary,
  303. .has = xfs_has_realtime,
  304. .repair = xrep_notsupported,
  305. },
  306. [XFS_SCRUB_TYPE_UQUOTA] = { /* user quota */
  307. .type = ST_FS,
  308. .setup = xchk_setup_quota,
  309. .scrub = xchk_quota,
  310. .repair = xrep_notsupported,
  311. },
  312. [XFS_SCRUB_TYPE_GQUOTA] = { /* group quota */
  313. .type = ST_FS,
  314. .setup = xchk_setup_quota,
  315. .scrub = xchk_quota,
  316. .repair = xrep_notsupported,
  317. },
  318. [XFS_SCRUB_TYPE_PQUOTA] = { /* project quota */
  319. .type = ST_FS,
  320. .setup = xchk_setup_quota,
  321. .scrub = xchk_quota,
  322. .repair = xrep_notsupported,
  323. },
  324. [XFS_SCRUB_TYPE_FSCOUNTERS] = { /* fs summary counters */
  325. .type = ST_FS,
  326. .setup = xchk_setup_fscounters,
  327. .scrub = xchk_fscounters,
  328. .repair = xrep_notsupported,
  329. },
  330. };
  331. static int
  332. xchk_validate_inputs(
  333. struct xfs_mount *mp,
  334. struct xfs_scrub_metadata *sm)
  335. {
  336. int error;
  337. const struct xchk_meta_ops *ops;
  338. error = -EINVAL;
  339. /* Check our inputs. */
  340. sm->sm_flags &= ~XFS_SCRUB_FLAGS_OUT;
  341. if (sm->sm_flags & ~XFS_SCRUB_FLAGS_IN)
  342. goto out;
  343. /* sm_reserved[] must be zero */
  344. if (memchr_inv(sm->sm_reserved, 0, sizeof(sm->sm_reserved)))
  345. goto out;
  346. error = -ENOENT;
  347. /* Do we know about this type of metadata? */
  348. if (sm->sm_type >= XFS_SCRUB_TYPE_NR)
  349. goto out;
  350. ops = &meta_scrub_ops[sm->sm_type];
  351. if (ops->setup == NULL || ops->scrub == NULL)
  352. goto out;
  353. /* Does this fs even support this type of metadata? */
  354. if (ops->has && !ops->has(mp))
  355. goto out;
  356. error = -EINVAL;
  357. /* restricting fields must be appropriate for type */
  358. switch (ops->type) {
  359. case ST_NONE:
  360. case ST_FS:
  361. if (sm->sm_ino || sm->sm_gen || sm->sm_agno)
  362. goto out;
  363. break;
  364. case ST_PERAG:
  365. if (sm->sm_ino || sm->sm_gen ||
  366. sm->sm_agno >= mp->m_sb.sb_agcount)
  367. goto out;
  368. break;
  369. case ST_INODE:
  370. if (sm->sm_agno || (sm->sm_gen && !sm->sm_ino))
  371. goto out;
  372. break;
  373. default:
  374. goto out;
  375. }
  376. /*
  377. * We only want to repair read-write v5+ filesystems. Defer the check
  378. * for ops->repair until after our scrub confirms that we need to
  379. * perform repairs so that we avoid failing due to not supporting
  380. * repairing an object that doesn't need repairs.
  381. */
  382. if (sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) {
  383. error = -EOPNOTSUPP;
  384. if (!xfs_has_crc(mp))
  385. goto out;
  386. error = -EROFS;
  387. if (xfs_is_readonly(mp))
  388. goto out;
  389. }
  390. error = 0;
  391. out:
  392. return error;
  393. }
  394. #ifdef CONFIG_XFS_ONLINE_REPAIR
  395. static inline void xchk_postmortem(struct xfs_scrub *sc)
  396. {
  397. /*
  398. * Userspace asked us to repair something, we repaired it, rescanned
  399. * it, and the rescan says it's still broken. Scream about this in
  400. * the system logs.
  401. */
  402. if ((sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) &&
  403. (sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
  404. XFS_SCRUB_OFLAG_XCORRUPT)))
  405. xrep_failure(sc->mp);
  406. }
  407. #else
  408. static inline void xchk_postmortem(struct xfs_scrub *sc)
  409. {
  410. /*
  411. * Userspace asked us to scrub something, it's broken, and we have no
  412. * way of fixing it. Scream in the logs.
  413. */
  414. if (sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
  415. XFS_SCRUB_OFLAG_XCORRUPT))
  416. xfs_alert_ratelimited(sc->mp,
  417. "Corruption detected during scrub.");
  418. }
  419. #endif /* CONFIG_XFS_ONLINE_REPAIR */
  420. /* Dispatch metadata scrubbing. */
  421. int
  422. xfs_scrub_metadata(
  423. struct file *file,
  424. struct xfs_scrub_metadata *sm)
  425. {
  426. struct xfs_scrub *sc;
  427. struct xfs_mount *mp = XFS_I(file_inode(file))->i_mount;
  428. int error = 0;
  429. BUILD_BUG_ON(sizeof(meta_scrub_ops) !=
  430. (sizeof(struct xchk_meta_ops) * XFS_SCRUB_TYPE_NR));
  431. trace_xchk_start(XFS_I(file_inode(file)), sm, error);
  432. /* Forbidden if we are shut down or mounted norecovery. */
  433. error = -ESHUTDOWN;
  434. if (xfs_is_shutdown(mp))
  435. goto out;
  436. error = -ENOTRECOVERABLE;
  437. if (xfs_has_norecovery(mp))
  438. goto out;
  439. error = xchk_validate_inputs(mp, sm);
  440. if (error)
  441. goto out;
  442. xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SCRUB,
  443. "EXPERIMENTAL online scrub feature in use. Use at your own risk!");
  444. sc = kmem_zalloc(sizeof(struct xfs_scrub), KM_NOFS | KM_MAYFAIL);
  445. if (!sc) {
  446. error = -ENOMEM;
  447. goto out;
  448. }
  449. sc->mp = mp;
  450. sc->file = file;
  451. sc->sm = sm;
  452. sc->ops = &meta_scrub_ops[sm->sm_type];
  453. sc->sick_mask = xchk_health_mask_for_scrub_type(sm->sm_type);
  454. retry_op:
  455. /*
  456. * When repairs are allowed, prevent freezing or readonly remount while
  457. * scrub is running with a real transaction.
  458. */
  459. if (sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) {
  460. error = mnt_want_write_file(sc->file);
  461. if (error)
  462. goto out_sc;
  463. }
  464. /* Set up for the operation. */
  465. error = sc->ops->setup(sc);
  466. if (error)
  467. goto out_teardown;
  468. /* Scrub for errors. */
  469. error = sc->ops->scrub(sc);
  470. if (!(sc->flags & XCHK_TRY_HARDER) && error == -EDEADLOCK) {
  471. /*
  472. * Scrubbers return -EDEADLOCK to mean 'try harder'.
  473. * Tear down everything we hold, then set up again with
  474. * preparation for worst-case scenarios.
  475. */
  476. error = xchk_teardown(sc, 0);
  477. if (error)
  478. goto out_sc;
  479. sc->flags |= XCHK_TRY_HARDER;
  480. goto retry_op;
  481. } else if (error || (sm->sm_flags & XFS_SCRUB_OFLAG_INCOMPLETE))
  482. goto out_teardown;
  483. xchk_update_health(sc);
  484. if ((sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) &&
  485. !(sc->flags & XREP_ALREADY_FIXED)) {
  486. bool needs_fix;
  487. /* Let debug users force us into the repair routines. */
  488. if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_FORCE_SCRUB_REPAIR))
  489. sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
  490. needs_fix = (sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
  491. XFS_SCRUB_OFLAG_XCORRUPT |
  492. XFS_SCRUB_OFLAG_PREEN));
  493. /*
  494. * If userspace asked for a repair but it wasn't necessary,
  495. * report that back to userspace.
  496. */
  497. if (!needs_fix) {
  498. sc->sm->sm_flags |= XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED;
  499. goto out_nofix;
  500. }
  501. /*
  502. * If it's broken, userspace wants us to fix it, and we haven't
  503. * already tried to fix it, then attempt a repair.
  504. */
  505. error = xrep_attempt(sc);
  506. if (error == -EAGAIN) {
  507. /*
  508. * Either the repair function succeeded or it couldn't
  509. * get all the resources it needs; either way, we go
  510. * back to the beginning and call the scrub function.
  511. */
  512. error = xchk_teardown(sc, 0);
  513. if (error) {
  514. xrep_failure(mp);
  515. goto out_sc;
  516. }
  517. goto retry_op;
  518. }
  519. }
  520. out_nofix:
  521. xchk_postmortem(sc);
  522. out_teardown:
  523. error = xchk_teardown(sc, error);
  524. out_sc:
  525. kmem_free(sc);
  526. out:
  527. trace_xchk_done(XFS_I(file_inode(file)), sm, error);
  528. if (error == -EFSCORRUPTED || error == -EFSBADCRC) {
  529. sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
  530. error = 0;
  531. }
  532. return error;
  533. }