This source file includes following definitions.
- xrep_attempt
- xrep_failure
- xrep_probe
- xrep_roll_ag_trans
- xrep_ag_has_space
- xrep_calc_ag_resblks
- xrep_alloc_ag_block
- xrep_init_btblock
- xrep_invalidate_blocks
- xrep_fix_freelist
- xrep_put_freelist
- xrep_reap_block
- xrep_reap_extents
- xrep_findroot_agfl_walk
- xrep_findroot_block
- xrep_findroot_rmap
- xrep_find_ag_btree_roots
- xrep_force_quotacheck
- xrep_ino_dqattach
1
2
3
4
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_btree.h"
13 #include "xfs_log_format.h"
14 #include "xfs_trans.h"
15 #include "xfs_sb.h"
16 #include "xfs_inode.h"
17 #include "xfs_alloc.h"
18 #include "xfs_alloc_btree.h"
19 #include "xfs_ialloc.h"
20 #include "xfs_ialloc_btree.h"
21 #include "xfs_rmap.h"
22 #include "xfs_rmap_btree.h"
23 #include "xfs_refcount_btree.h"
24 #include "xfs_extent_busy.h"
25 #include "xfs_ag_resv.h"
26 #include "xfs_quota.h"
27 #include "scrub/scrub.h"
28 #include "scrub/common.h"
29 #include "scrub/trace.h"
30 #include "scrub/repair.h"
31 #include "scrub/bitmap.h"
32
33
34
35
36
37
38 int
39 xrep_attempt(
40 struct xfs_inode *ip,
41 struct xfs_scrub *sc)
42 {
43 int error = 0;
44
45 trace_xrep_attempt(ip, sc->sm, error);
46
47 xchk_ag_btcur_free(&sc->sa);
48
49
50 ASSERT(sc->ops->repair);
51 error = sc->ops->repair(sc);
52 trace_xrep_done(ip, sc->sm, error);
53 switch (error) {
54 case 0:
55
56
57
58
59 sc->sm->sm_flags &= ~XFS_SCRUB_FLAGS_OUT;
60 sc->flags |= XREP_ALREADY_FIXED;
61 return -EAGAIN;
62 case -EDEADLOCK:
63 case -EAGAIN:
64
65 if (!(sc->flags & XCHK_TRY_HARDER)) {
66 sc->flags |= XCHK_TRY_HARDER;
67 return -EAGAIN;
68 }
69
70
71
72
73
74 return -EFSCORRUPTED;
75 default:
76 return error;
77 }
78 }
79
80
81
82
83
84
85
86
87
88
89 void
90 xrep_failure(
91 struct xfs_mount *mp)
92 {
93 xfs_alert_ratelimited(mp,
94 "Corruption not fixed during online repair. Unmount and run xfs_repair.");
95 }
96
97
98
99
100
101 int
102 xrep_probe(
103 struct xfs_scrub *sc)
104 {
105 int error = 0;
106
107 if (xchk_should_terminate(sc, &error))
108 return error;
109
110 return 0;
111 }
112
113
114
115
116
117 int
118 xrep_roll_ag_trans(
119 struct xfs_scrub *sc)
120 {
121 int error;
122
123
124 if (sc->sa.agi_bp)
125 xfs_trans_bhold(sc->tp, sc->sa.agi_bp);
126 if (sc->sa.agf_bp)
127 xfs_trans_bhold(sc->tp, sc->sa.agf_bp);
128 if (sc->sa.agfl_bp)
129 xfs_trans_bhold(sc->tp, sc->sa.agfl_bp);
130
131
132
133
134
135
136
137
138 error = xfs_trans_roll(&sc->tp);
139 if (error)
140 return error;
141
142
143 if (sc->sa.agi_bp)
144 xfs_trans_bjoin(sc->tp, sc->sa.agi_bp);
145 if (sc->sa.agf_bp)
146 xfs_trans_bjoin(sc->tp, sc->sa.agf_bp);
147 if (sc->sa.agfl_bp)
148 xfs_trans_bjoin(sc->tp, sc->sa.agfl_bp);
149
150 return 0;
151 }
152
153
154
155
156
157
158 bool
159 xrep_ag_has_space(
160 struct xfs_perag *pag,
161 xfs_extlen_t nr_blocks,
162 enum xfs_ag_resv_type type)
163 {
164 return !xfs_ag_resv_critical(pag, XFS_AG_RESV_RMAPBT) &&
165 !xfs_ag_resv_critical(pag, XFS_AG_RESV_METADATA) &&
166 pag->pagf_freeblks > xfs_ag_resv_needed(pag, type) + nr_blocks;
167 }
168
169
170
171
172
173
174 xfs_extlen_t
175 xrep_calc_ag_resblks(
176 struct xfs_scrub *sc)
177 {
178 struct xfs_mount *mp = sc->mp;
179 struct xfs_scrub_metadata *sm = sc->sm;
180 struct xfs_perag *pag;
181 struct xfs_buf *bp;
182 xfs_agino_t icount = NULLAGINO;
183 xfs_extlen_t aglen = NULLAGBLOCK;
184 xfs_extlen_t usedlen;
185 xfs_extlen_t freelen;
186 xfs_extlen_t bnobt_sz;
187 xfs_extlen_t inobt_sz;
188 xfs_extlen_t rmapbt_sz;
189 xfs_extlen_t refcbt_sz;
190 int error;
191
192 if (!(sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR))
193 return 0;
194
195 pag = xfs_perag_get(mp, sm->sm_agno);
196 if (pag->pagi_init) {
197
198 icount = pag->pagi_count;
199 } else {
200
201 error = xfs_ialloc_read_agi(mp, NULL, sm->sm_agno, &bp);
202 if (!error) {
203 icount = pag->pagi_count;
204 xfs_buf_relse(bp);
205 }
206 }
207
208
209 error = xfs_alloc_read_agf(mp, NULL, sm->sm_agno, 0, &bp);
210 if (!error) {
211 aglen = be32_to_cpu(XFS_BUF_TO_AGF(bp)->agf_length);
212 freelen = be32_to_cpu(XFS_BUF_TO_AGF(bp)->agf_freeblks);
213 usedlen = aglen - freelen;
214 xfs_buf_relse(bp);
215 }
216 xfs_perag_put(pag);
217
218
219 if (icount == NULLAGINO ||
220 !xfs_verify_agino(mp, sm->sm_agno, icount)) {
221 xfs_agino_t first, last;
222
223 xfs_agino_range(mp, sm->sm_agno, &first, &last);
224 icount = last - first + 1;
225 }
226
227
228 if (aglen == NULLAGBLOCK ||
229 aglen != xfs_ag_block_count(mp, sm->sm_agno) ||
230 freelen >= aglen) {
231 aglen = xfs_ag_block_count(mp, sm->sm_agno);
232 freelen = aglen;
233 usedlen = aglen;
234 }
235
236 trace_xrep_calc_ag_resblks(mp, sm->sm_agno, icount, aglen,
237 freelen, usedlen);
238
239
240
241
242
243
244 bnobt_sz = 2 * xfs_allocbt_calc_size(mp, freelen);
245 if (xfs_sb_version_hassparseinodes(&mp->m_sb))
246 inobt_sz = xfs_iallocbt_calc_size(mp, icount /
247 XFS_INODES_PER_HOLEMASK_BIT);
248 else
249 inobt_sz = xfs_iallocbt_calc_size(mp, icount /
250 XFS_INODES_PER_CHUNK);
251 if (xfs_sb_version_hasfinobt(&mp->m_sb))
252 inobt_sz *= 2;
253 if (xfs_sb_version_hasreflink(&mp->m_sb))
254 refcbt_sz = xfs_refcountbt_calc_size(mp, usedlen);
255 else
256 refcbt_sz = 0;
257 if (xfs_sb_version_hasrmapbt(&mp->m_sb)) {
258
259
260
261
262
263
264
265
266 if (xfs_sb_version_hasreflink(&mp->m_sb))
267 rmapbt_sz = xfs_rmapbt_calc_size(mp,
268 (unsigned long long)aglen * 2);
269 else
270 rmapbt_sz = xfs_rmapbt_calc_size(mp, usedlen);
271 } else {
272 rmapbt_sz = 0;
273 }
274
275 trace_xrep_calc_ag_resblks_btsize(mp, sm->sm_agno, bnobt_sz,
276 inobt_sz, rmapbt_sz, refcbt_sz);
277
278 return max(max(bnobt_sz, inobt_sz), max(rmapbt_sz, refcbt_sz));
279 }
280
281
282 int
283 xrep_alloc_ag_block(
284 struct xfs_scrub *sc,
285 const struct xfs_owner_info *oinfo,
286 xfs_fsblock_t *fsbno,
287 enum xfs_ag_resv_type resv)
288 {
289 struct xfs_alloc_arg args = {0};
290 xfs_agblock_t bno;
291 int error;
292
293 switch (resv) {
294 case XFS_AG_RESV_AGFL:
295 case XFS_AG_RESV_RMAPBT:
296 error = xfs_alloc_get_freelist(sc->tp, sc->sa.agf_bp, &bno, 1);
297 if (error)
298 return error;
299 if (bno == NULLAGBLOCK)
300 return -ENOSPC;
301 xfs_extent_busy_reuse(sc->mp, sc->sa.agno, bno,
302 1, false);
303 *fsbno = XFS_AGB_TO_FSB(sc->mp, sc->sa.agno, bno);
304 if (resv == XFS_AG_RESV_RMAPBT)
305 xfs_ag_resv_rmapbt_alloc(sc->mp, sc->sa.agno);
306 return 0;
307 default:
308 break;
309 }
310
311 args.tp = sc->tp;
312 args.mp = sc->mp;
313 args.oinfo = *oinfo;
314 args.fsbno = XFS_AGB_TO_FSB(args.mp, sc->sa.agno, 0);
315 args.minlen = 1;
316 args.maxlen = 1;
317 args.prod = 1;
318 args.type = XFS_ALLOCTYPE_THIS_AG;
319 args.resv = resv;
320
321 error = xfs_alloc_vextent(&args);
322 if (error)
323 return error;
324 if (args.fsbno == NULLFSBLOCK)
325 return -ENOSPC;
326 ASSERT(args.len == 1);
327 *fsbno = args.fsbno;
328
329 return 0;
330 }
331
332
333 int
334 xrep_init_btblock(
335 struct xfs_scrub *sc,
336 xfs_fsblock_t fsb,
337 struct xfs_buf **bpp,
338 xfs_btnum_t btnum,
339 const struct xfs_buf_ops *ops)
340 {
341 struct xfs_trans *tp = sc->tp;
342 struct xfs_mount *mp = sc->mp;
343 struct xfs_buf *bp;
344
345 trace_xrep_init_btblock(mp, XFS_FSB_TO_AGNO(mp, fsb),
346 XFS_FSB_TO_AGBNO(mp, fsb), btnum);
347
348 ASSERT(XFS_FSB_TO_AGNO(mp, fsb) == sc->sa.agno);
349 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, XFS_FSB_TO_DADDR(mp, fsb),
350 XFS_FSB_TO_BB(mp, 1), 0);
351 xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
352 xfs_btree_init_block(mp, bp, btnum, 0, 0, sc->sa.agno);
353 xfs_trans_buf_set_type(tp, bp, XFS_BLFT_BTREE_BUF);
354 xfs_trans_log_buf(tp, bp, 0, BBTOB(bp->b_length) - 1);
355 bp->b_ops = ops;
356 *bpp = bp;
357
358 return 0;
359 }
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430 int
431 xrep_invalidate_blocks(
432 struct xfs_scrub *sc,
433 struct xfs_bitmap *bitmap)
434 {
435 struct xfs_bitmap_range *bmr;
436 struct xfs_bitmap_range *n;
437 struct xfs_buf *bp;
438 xfs_fsblock_t fsbno;
439
440
441
442
443
444
445
446
447
448 for_each_xfs_bitmap_block(fsbno, bmr, n, bitmap) {
449
450 if (!xfs_verify_fsbno(sc->mp, fsbno))
451 continue;
452 bp = xfs_buf_incore(sc->mp->m_ddev_targp,
453 XFS_FSB_TO_DADDR(sc->mp, fsbno),
454 XFS_FSB_TO_BB(sc->mp, 1), XBF_TRYLOCK);
455 if (bp) {
456 xfs_trans_bjoin(sc->tp, bp);
457 xfs_trans_binval(sc->tp, bp);
458 }
459 }
460
461 return 0;
462 }
463
464
465 int
466 xrep_fix_freelist(
467 struct xfs_scrub *sc,
468 bool can_shrink)
469 {
470 struct xfs_alloc_arg args = {0};
471
472 args.mp = sc->mp;
473 args.tp = sc->tp;
474 args.agno = sc->sa.agno;
475 args.alignment = 1;
476 args.pag = sc->sa.pag;
477
478 return xfs_alloc_fix_freelist(&args,
479 can_shrink ? 0 : XFS_ALLOC_FLAG_NOSHRINK);
480 }
481
482
483
484
485 STATIC int
486 xrep_put_freelist(
487 struct xfs_scrub *sc,
488 xfs_agblock_t agbno)
489 {
490 int error;
491
492
493 error = xrep_fix_freelist(sc, true);
494 if (error)
495 return error;
496
497
498
499
500
501
502 error = xfs_rmap_alloc(sc->tp, sc->sa.agf_bp, sc->sa.agno, agbno, 1,
503 &XFS_RMAP_OINFO_AG);
504 if (error)
505 return error;
506
507
508 error = xfs_alloc_put_freelist(sc->tp, sc->sa.agf_bp, sc->sa.agfl_bp,
509 agbno, 0);
510 if (error)
511 return error;
512 xfs_extent_busy_insert(sc->tp, sc->sa.agno, agbno, 1,
513 XFS_EXTENT_BUSY_SKIP_DISCARD);
514
515 return 0;
516 }
517
518
519 STATIC int
520 xrep_reap_block(
521 struct xfs_scrub *sc,
522 xfs_fsblock_t fsbno,
523 const struct xfs_owner_info *oinfo,
524 enum xfs_ag_resv_type resv)
525 {
526 struct xfs_btree_cur *cur;
527 struct xfs_buf *agf_bp = NULL;
528 xfs_agnumber_t agno;
529 xfs_agblock_t agbno;
530 bool has_other_rmap;
531 int error;
532
533 agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
534 agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
535
536
537
538
539
540
541 if (sc->ip) {
542 error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf_bp);
543 if (error)
544 return error;
545 if (!agf_bp)
546 return -ENOMEM;
547 } else {
548 agf_bp = sc->sa.agf_bp;
549 }
550 cur = xfs_rmapbt_init_cursor(sc->mp, sc->tp, agf_bp, agno);
551
552
553 error = xfs_rmap_has_other_keys(cur, agbno, 1, oinfo, &has_other_rmap);
554 xfs_btree_del_cursor(cur, error);
555 if (error)
556 goto out_free;
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571 if (has_other_rmap)
572 error = xfs_rmap_free(sc->tp, agf_bp, agno, agbno, 1, oinfo);
573 else if (resv == XFS_AG_RESV_AGFL)
574 error = xrep_put_freelist(sc, agbno);
575 else
576 error = xfs_free_extent(sc->tp, fsbno, 1, oinfo, resv);
577 if (agf_bp != sc->sa.agf_bp)
578 xfs_trans_brelse(sc->tp, agf_bp);
579 if (error)
580 return error;
581
582 if (sc->ip)
583 return xfs_trans_roll_inode(&sc->tp, sc->ip);
584 return xrep_roll_ag_trans(sc);
585
586 out_free:
587 if (agf_bp != sc->sa.agf_bp)
588 xfs_trans_brelse(sc->tp, agf_bp);
589 return error;
590 }
591
592
593 int
594 xrep_reap_extents(
595 struct xfs_scrub *sc,
596 struct xfs_bitmap *bitmap,
597 const struct xfs_owner_info *oinfo,
598 enum xfs_ag_resv_type type)
599 {
600 struct xfs_bitmap_range *bmr;
601 struct xfs_bitmap_range *n;
602 xfs_fsblock_t fsbno;
603 int error = 0;
604
605 ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb));
606
607 for_each_xfs_bitmap_block(fsbno, bmr, n, bitmap) {
608 ASSERT(sc->ip != NULL ||
609 XFS_FSB_TO_AGNO(sc->mp, fsbno) == sc->sa.agno);
610 trace_xrep_dispose_btree_extent(sc->mp,
611 XFS_FSB_TO_AGNO(sc->mp, fsbno),
612 XFS_FSB_TO_AGBNO(sc->mp, fsbno), 1);
613
614 error = xrep_reap_block(sc, fsbno, oinfo, type);
615 if (error)
616 goto out;
617 }
618
619 out:
620 xfs_bitmap_destroy(bitmap);
621 return error;
622 }
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651 struct xrep_findroot {
652 struct xfs_scrub *sc;
653 struct xfs_buf *agfl_bp;
654 struct xfs_agf *agf;
655 struct xrep_find_ag_btree *btree_info;
656 };
657
658
659 STATIC int
660 xrep_findroot_agfl_walk(
661 struct xfs_mount *mp,
662 xfs_agblock_t bno,
663 void *priv)
664 {
665 xfs_agblock_t *agbno = priv;
666
667 return (*agbno == bno) ? -ECANCELED : 0;
668 }
669
670
671 STATIC int
672 xrep_findroot_block(
673 struct xrep_findroot *ri,
674 struct xrep_find_ag_btree *fab,
675 uint64_t owner,
676 xfs_agblock_t agbno,
677 bool *done_with_block)
678 {
679 struct xfs_mount *mp = ri->sc->mp;
680 struct xfs_buf *bp;
681 struct xfs_btree_block *btblock;
682 xfs_daddr_t daddr;
683 int block_level;
684 int error = 0;
685
686 daddr = XFS_AGB_TO_DADDR(mp, ri->sc->sa.agno, agbno);
687
688
689
690
691
692
693
694 if (owner == XFS_RMAP_OWN_AG) {
695 error = xfs_agfl_walk(mp, ri->agf, ri->agfl_bp,
696 xrep_findroot_agfl_walk, &agbno);
697 if (error == -ECANCELED)
698 return 0;
699 if (error)
700 return error;
701 }
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721 error = xfs_trans_read_buf(mp, ri->sc->tp, mp->m_ddev_targp, daddr,
722 mp->m_bsize, 0, &bp, NULL);
723 if (error)
724 return error;
725
726
727 btblock = XFS_BUF_TO_BLOCK(bp);
728 ASSERT(fab->buf_ops->magic[1] != 0);
729 if (btblock->bb_magic != fab->buf_ops->magic[1])
730 goto out;
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746 if (bp->b_ops) {
747 if (bp->b_ops != fab->buf_ops)
748 goto out;
749 } else {
750 ASSERT(!xfs_trans_buf_is_dirty(bp));
751 if (!uuid_equal(&btblock->bb_u.s.bb_uuid,
752 &mp->m_sb.sb_meta_uuid))
753 goto out;
754
755
756
757
758
759 bp->b_ops = fab->buf_ops;
760 fab->buf_ops->verify_read(bp);
761 if (bp->b_error) {
762 bp->b_ops = NULL;
763 bp->b_error = 0;
764 goto out;
765 }
766
767
768
769
770
771 }
772
773
774
775
776
777 *done_with_block = true;
778
779
780
781
782
783
784
785
786
787
788
789 block_level = xfs_btree_get_level(btblock);
790 if (block_level + 1 == fab->height) {
791 fab->root = NULLAGBLOCK;
792 goto out;
793 } else if (block_level < fab->height) {
794 goto out;
795 }
796
797
798
799
800
801
802 fab->height = block_level + 1;
803
804
805
806
807
808
809 if (btblock->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK) &&
810 btblock->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK))
811 fab->root = agbno;
812 else
813 fab->root = NULLAGBLOCK;
814
815 trace_xrep_findroot_block(mp, ri->sc->sa.agno, agbno,
816 be32_to_cpu(btblock->bb_magic), fab->height - 1);
817 out:
818 xfs_trans_brelse(ri->sc->tp, bp);
819 return error;
820 }
821
822
823
824
825
826 STATIC int
827 xrep_findroot_rmap(
828 struct xfs_btree_cur *cur,
829 struct xfs_rmap_irec *rec,
830 void *priv)
831 {
832 struct xrep_findroot *ri = priv;
833 struct xrep_find_ag_btree *fab;
834 xfs_agblock_t b;
835 bool done;
836 int error = 0;
837
838
839 if (!XFS_RMAP_NON_INODE_OWNER(rec->rm_owner))
840 return 0;
841
842
843 for (b = 0; b < rec->rm_blockcount; b++) {
844 done = false;
845 for (fab = ri->btree_info; fab->buf_ops; fab++) {
846 if (rec->rm_owner != fab->rmap_owner)
847 continue;
848 error = xrep_findroot_block(ri, fab,
849 rec->rm_owner, rec->rm_startblock + b,
850 &done);
851 if (error)
852 return error;
853 if (done)
854 break;
855 }
856 }
857
858 return 0;
859 }
860
861
862 int
863 xrep_find_ag_btree_roots(
864 struct xfs_scrub *sc,
865 struct xfs_buf *agf_bp,
866 struct xrep_find_ag_btree *btree_info,
867 struct xfs_buf *agfl_bp)
868 {
869 struct xfs_mount *mp = sc->mp;
870 struct xrep_findroot ri;
871 struct xrep_find_ag_btree *fab;
872 struct xfs_btree_cur *cur;
873 int error;
874
875 ASSERT(xfs_buf_islocked(agf_bp));
876 ASSERT(agfl_bp == NULL || xfs_buf_islocked(agfl_bp));
877
878 ri.sc = sc;
879 ri.btree_info = btree_info;
880 ri.agf = XFS_BUF_TO_AGF(agf_bp);
881 ri.agfl_bp = agfl_bp;
882 for (fab = btree_info; fab->buf_ops; fab++) {
883 ASSERT(agfl_bp || fab->rmap_owner != XFS_RMAP_OWN_AG);
884 ASSERT(XFS_RMAP_NON_INODE_OWNER(fab->rmap_owner));
885 fab->root = NULLAGBLOCK;
886 fab->height = 0;
887 }
888
889 cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.agno);
890 error = xfs_rmap_query_all(cur, xrep_findroot_rmap, &ri);
891 xfs_btree_del_cursor(cur, error);
892
893 return error;
894 }
895
896
897 void
898 xrep_force_quotacheck(
899 struct xfs_scrub *sc,
900 uint dqtype)
901 {
902 uint flag;
903
904 flag = xfs_quota_chkd_flag(dqtype);
905 if (!(flag & sc->mp->m_qflags))
906 return;
907
908 sc->mp->m_qflags &= ~flag;
909 spin_lock(&sc->mp->m_sb_lock);
910 sc->mp->m_sb.sb_qflags &= ~flag;
911 spin_unlock(&sc->mp->m_sb_lock);
912 xfs_log_sb(sc->tp);
913 }
914
915
916
917
918
919
920
921
922
923
924
925 int
926 xrep_ino_dqattach(
927 struct xfs_scrub *sc)
928 {
929 int error;
930
931 error = xfs_qm_dqattach_locked(sc->ip, false);
932 switch (error) {
933 case -EFSBADCRC:
934 case -EFSCORRUPTED:
935 case -ENOENT:
936 xfs_err_ratelimited(sc->mp,
937 "inode %llu repair encountered quota error %d, quotacheck forced.",
938 (unsigned long long)sc->ip->i_ino, error);
939 if (XFS_IS_UQUOTA_ON(sc->mp) && !sc->ip->i_udquot)
940 xrep_force_quotacheck(sc, XFS_DQ_USER);
941 if (XFS_IS_GQUOTA_ON(sc->mp) && !sc->ip->i_gdquot)
942 xrep_force_quotacheck(sc, XFS_DQ_GROUP);
943 if (XFS_IS_PQUOTA_ON(sc->mp) && !sc->ip->i_pdquot)
944 xrep_force_quotacheck(sc, XFS_DQ_PROJ);
945
946 case -ESRCH:
947 error = 0;
948 break;
949 default:
950 break;
951 }
952
953 return error;
954 }