Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scrub-syzbot-fixes-7.0_2026-01-25' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-7.0-merge

xfs: syzbot fixes for online fsck [3/3]

Fix various syzbot complaints about scrub that Jiaming Zhang found.

With a bit of luck, this should all go splendidly.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>

+115 -181
+10 -11
fs/xfs/scrub/agheader_repair.c
··· 837 837 { 838 838 struct xrep_agi *ragi = buf; 839 839 840 - xfarray_destroy(ragi->iunlink_prev); 841 - xfarray_destroy(ragi->iunlink_next); 840 + if (ragi->iunlink_prev) 841 + xfarray_destroy(ragi->iunlink_prev); 842 + ragi->iunlink_prev = NULL; 843 + if (ragi->iunlink_next) 844 + xfarray_destroy(ragi->iunlink_next); 845 + ragi->iunlink_next = NULL; 842 846 xagino_bitmap_destroy(&ragi->iunlink_bmp); 843 847 } 844 848 ··· 1712 1708 { 1713 1709 struct xrep_agi *ragi; 1714 1710 struct xfs_mount *mp = sc->mp; 1715 - char *descr; 1716 1711 unsigned int i; 1717 1712 int error; 1718 1713 ··· 1745 1742 xagino_bitmap_init(&ragi->iunlink_bmp); 1746 1743 sc->buf_cleanup = xrep_agi_buf_cleanup; 1747 1744 1748 - descr = xchk_xfile_ag_descr(sc, "iunlinked next pointers"); 1749 - error = xfarray_create(descr, 0, sizeof(xfs_agino_t), 1750 - &ragi->iunlink_next); 1751 - kfree(descr); 1745 + error = xfarray_create("iunlinked next pointers", 0, 1746 + sizeof(xfs_agino_t), &ragi->iunlink_next); 1752 1747 if (error) 1753 1748 return error; 1754 1749 1755 - descr = xchk_xfile_ag_descr(sc, "iunlinked prev pointers"); 1756 - error = xfarray_create(descr, 0, sizeof(xfs_agino_t), 1757 - &ragi->iunlink_prev); 1758 - kfree(descr); 1750 + error = xfarray_create("iunlinked prev pointers", 0, 1751 + sizeof(xfs_agino_t), &ragi->iunlink_prev); 1759 1752 if (error) 1760 1753 return error; 1761 1754
+16 -4
fs/xfs/scrub/alloc_repair.c
··· 850 850 struct xrep_abt *ra; 851 851 struct xfs_mount *mp = sc->mp; 852 852 unsigned int busy_gen; 853 - char *descr; 854 853 int error; 855 854 856 855 /* We require the rmapbt to rebuild anything. */ ··· 875 876 } 876 877 877 878 /* Set up enough storage to handle maximally fragmented free space. */ 878 - descr = xchk_xfile_ag_descr(sc, "free space records"); 879 - error = xfarray_create(descr, mp->m_sb.sb_agblocks / 2, 879 + error = xfarray_create("free space records", mp->m_sb.sb_agblocks / 2, 880 880 sizeof(struct xfs_alloc_rec_incore), 881 881 &ra->free_records); 882 - kfree(descr); 883 882 if (error) 884 883 goto out_ra; 885 884 ··· 923 926 if (error) 924 927 goto out; 925 928 929 + /* 930 + * If the bnobt is still corrupt, we've failed to repair the filesystem 931 + * and should just bail out. 932 + * 933 + * If the bnobt fails cross-examination with the cntbt, the scan will 934 + * free the cntbt cursor, so we need to mark the repair incomplete 935 + * and avoid walking off the end of the NULL cntbt cursor. 936 + */ 937 + if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 938 + goto out; 939 + 926 940 sc->sm->sm_type = XFS_SCRUB_TYPE_CNTBT; 941 + if (!sc->sa.cnt_cur) { 942 + xchk_set_incomplete(sc); 943 + goto out; 944 + } 927 945 error = xchk_allocbt(sc); 928 946 out: 929 947 sc->sm->sm_type = old_type;
+9 -17
fs/xfs/scrub/attr_repair.c
··· 1516 1516 xfblob_destroy(rx->pptr_names); 1517 1517 if (rx->pptr_recs) 1518 1518 xfarray_destroy(rx->pptr_recs); 1519 - xfblob_destroy(rx->xattr_blobs); 1520 - xfarray_destroy(rx->xattr_records); 1519 + if (rx->xattr_blobs) 1520 + xfblob_destroy(rx->xattr_blobs); 1521 + if (rx->xattr_records) 1522 + xfarray_destroy(rx->xattr_records); 1521 1523 mutex_destroy(&rx->lock); 1522 1524 kfree(rx); 1523 1525 } ··· 1531 1529 struct xrep_xattr **rxp) 1532 1530 { 1533 1531 struct xrep_xattr *rx; 1534 - char *descr; 1535 1532 int max_len; 1536 1533 int error; 1537 1534 ··· 1556 1555 goto out_rx; 1557 1556 1558 1557 /* Set up some staging for salvaged attribute keys and values */ 1559 - descr = xchk_xfile_ino_descr(sc, "xattr keys"); 1560 - error = xfarray_create(descr, 0, sizeof(struct xrep_xattr_key), 1558 + error = xfarray_create("xattr keys", 0, sizeof(struct xrep_xattr_key), 1561 1559 &rx->xattr_records); 1562 - kfree(descr); 1563 1560 if (error) 1564 1561 goto out_rx; 1565 1562 1566 - descr = xchk_xfile_ino_descr(sc, "xattr names"); 1567 - error = xfblob_create(descr, &rx->xattr_blobs); 1568 - kfree(descr); 1563 + error = xfblob_create("xattr names", &rx->xattr_blobs); 1569 1564 if (error) 1570 1565 goto out_keys; 1571 1566 1572 1567 if (xfs_has_parent(sc->mp)) { 1573 1568 ASSERT(sc->flags & XCHK_FSGATES_DIRENTS); 1574 1569 1575 - descr = xchk_xfile_ino_descr(sc, 1576 - "xattr retained parent pointer entries"); 1577 - error = xfarray_create(descr, 0, 1570 + error = xfarray_create("xattr parent pointer entries", 0, 1578 1571 sizeof(struct xrep_xattr_pptr), 1579 1572 &rx->pptr_recs); 1580 - kfree(descr); 1581 1573 if (error) 1582 1574 goto out_values; 1583 1575 1584 - descr = xchk_xfile_ino_descr(sc, 1585 - "xattr retained parent pointer names"); 1586 - error = xfblob_create(descr, &rx->pptr_names); 1587 - kfree(descr); 1576 + error = xfblob_create("xattr parent pointer names", 1577 + &rx->pptr_names); 1588 1578 if (error) 1589 1579 goto out_pprecs; 1590 1580
+1 -5
fs/xfs/scrub/bmap_repair.c
··· 923 923 bool allow_unwritten) 924 924 { 925 925 struct xrep_bmap *rb; 926 - char *descr; 927 926 xfs_extnum_t max_bmbt_recs; 928 927 bool large_extcount; 929 928 int error = 0; ··· 944 945 /* Set up enough storage to handle the max records for this fork. */ 945 946 large_extcount = xfs_has_large_extent_counts(sc->mp); 946 947 max_bmbt_recs = xfs_iext_max_nextents(large_extcount, whichfork); 947 - descr = xchk_xfile_ino_descr(sc, "%s fork mapping records", 948 - whichfork == XFS_DATA_FORK ? "data" : "attr"); 949 - error = xfarray_create(descr, max_bmbt_recs, 948 + error = xfarray_create("fork mapping records", max_bmbt_recs, 950 949 sizeof(struct xfs_bmbt_rec), &rb->bmap_records); 951 - kfree(descr); 952 950 if (error) 953 951 goto out_rb; 954 952
+5 -2
fs/xfs/scrub/btree.c
··· 372 372 { 373 373 xfs_agnumber_t agno; 374 374 xfs_agblock_t agbno; 375 + bool is_bnobt, is_rmapbt; 375 376 bool init_sa; 376 377 int error = 0; 377 378 378 379 if (!bs->cur) 379 380 return 0; 380 381 382 + is_bnobt = xfs_btree_is_bno(bs->cur->bc_ops); 383 + is_rmapbt = xfs_btree_is_rmap(bs->cur->bc_ops); 381 384 agno = xfs_daddr_to_agno(bs->cur->bc_mp, daddr); 382 385 agbno = xfs_daddr_to_agbno(bs->cur->bc_mp, daddr); 383 386 ··· 403 400 * have to nullify it (to shut down further block owner checks) if 404 401 * self-xref encounters problems. 405 402 */ 406 - if (!bs->sc->sa.bno_cur && xfs_btree_is_bno(bs->cur->bc_ops)) 403 + if (!bs->sc->sa.bno_cur && is_bnobt) 407 404 bs->cur = NULL; 408 405 409 406 xchk_xref_is_only_owned_by(bs->sc, agbno, 1, bs->oinfo); 410 - if (!bs->sc->sa.rmap_cur && xfs_btree_is_rmap(bs->cur->bc_ops)) 407 + if (!bs->sc->sa.rmap_cur && is_rmapbt) 411 408 bs->cur = NULL; 412 409 413 410 out_free:
+3
fs/xfs/scrub/common.c
··· 1399 1399 int error; 1400 1400 1401 1401 sub = xchk_scrub_create_subord(sc, scrub_type); 1402 + if (!sub) 1403 + return -ENOMEM; 1404 + 1402 1405 error = sub->sc.ops->scrub(&sub->sc); 1403 1406 xchk_scrub_free_subord(sub); 1404 1407 return error;
-25
fs/xfs/scrub/common.h
··· 247 247 int xchk_metadata_inode_forks(struct xfs_scrub *sc); 248 248 249 249 /* 250 - * Helper macros to allocate and format xfile description strings. 251 - * Callers must kfree the pointer returned. 252 - */ 253 - #define xchk_xfile_descr(sc, fmt, ...) \ 254 - kasprintf(XCHK_GFP_FLAGS, "XFS (%s): " fmt, \ 255 - (sc)->mp->m_super->s_id, ##__VA_ARGS__) 256 - #define xchk_xfile_ag_descr(sc, fmt, ...) \ 257 - kasprintf(XCHK_GFP_FLAGS, "XFS (%s): AG 0x%x " fmt, \ 258 - (sc)->mp->m_super->s_id, \ 259 - (sc)->sa.pag ? \ 260 - pag_agno((sc)->sa.pag) : (sc)->sm->sm_agno, \ 261 - ##__VA_ARGS__) 262 - #define xchk_xfile_ino_descr(sc, fmt, ...) \ 263 - kasprintf(XCHK_GFP_FLAGS, "XFS (%s): inode 0x%llx " fmt, \ 264 - (sc)->mp->m_super->s_id, \ 265 - (sc)->ip ? (sc)->ip->i_ino : (sc)->sm->sm_ino, \ 266 - ##__VA_ARGS__) 267 - #define xchk_xfile_rtgroup_descr(sc, fmt, ...) \ 268 - kasprintf(XCHK_GFP_FLAGS, "XFS (%s): rtgroup 0x%x " fmt, \ 269 - (sc)->mp->m_super->s_id, \ 270 - (sc)->sa.pag ? \ 271 - rtg_rgno((sc)->sr.rtg) : (sc)->sm->sm_agno, \ 272 - ##__VA_ARGS__) 273 - 274 - /* 275 250 * Setting up a hook to wait for intents to drain is costly -- we have to take 276 251 * the CPU hotplug lock and force an i-cache flush on all CPUs once to set it 277 252 * up, and again to tear it down. These costs add up quickly, so we only want
+4 -9
fs/xfs/scrub/dir.c
··· 1102 1102 sd->xname.name = sd->namebuf; 1103 1103 1104 1104 if (xfs_has_parent(sc->mp)) { 1105 - char *descr; 1106 - 1107 1105 /* 1108 1106 * Set up some staging memory for dirents that we can't check 1109 1107 * due to locking contention. 1110 1108 */ 1111 - descr = xchk_xfile_ino_descr(sc, "slow directory entries"); 1112 - error = xfarray_create(descr, 0, sizeof(struct xchk_dirent), 1113 - &sd->dir_entries); 1114 - kfree(descr); 1109 + error = xfarray_create("slow directory entries", 0, 1110 + sizeof(struct xchk_dirent), &sd->dir_entries); 1115 1111 if (error) 1116 1112 goto out_sd; 1117 1113 1118 - descr = xchk_xfile_ino_descr(sc, "slow directory entry names"); 1119 - error = xfblob_create(descr, &sd->dir_names); 1120 - kfree(descr); 1114 + error = xfblob_create("slow directory entry names", 1115 + &sd->dir_names); 1121 1116 if (error) 1122 1117 goto out_entries; 1123 1118 }
+9 -10
fs/xfs/scrub/dir_repair.c
··· 172 172 struct xrep_dir *rd = sc->buf; 173 173 174 174 xrep_findparent_scan_teardown(&rd->pscan); 175 - xfblob_destroy(rd->dir_names); 176 - xfarray_destroy(rd->dir_entries); 175 + if (rd->dir_names) 176 + xfblob_destroy(rd->dir_names); 177 + rd->dir_names = NULL; 178 + if (rd->dir_entries) 179 + xfarray_destroy(rd->dir_entries); 180 + rd->dir_names = NULL; 177 181 } 178 182 179 183 /* Set up for a directory repair. */ ··· 1788 1784 struct xrep_dir *rd) 1789 1785 { 1790 1786 struct xfs_scrub *sc = rd->sc; 1791 - char *descr; 1792 1787 int error; 1793 1788 1794 1789 /* Set up some staging memory for salvaging dirents. */ 1795 - descr = xchk_xfile_ino_descr(sc, "directory entries"); 1796 - error = xfarray_create(descr, 0, sizeof(struct xrep_dirent), 1797 - &rd->dir_entries); 1798 - kfree(descr); 1790 + error = xfarray_create("directory entries", 0, 1791 + sizeof(struct xrep_dirent), &rd->dir_entries); 1799 1792 if (error) 1800 1793 return error; 1801 1794 1802 - descr = xchk_xfile_ino_descr(sc, "directory entry names"); 1803 - error = xfblob_create(descr, &rd->dir_names); 1804 - kfree(descr); 1795 + error = xfblob_create("directory entry names", &rd->dir_names); 1805 1796 if (error) 1806 1797 goto out_xfarray; 1807 1798
+9 -10
fs/xfs/scrub/dirtree.c
··· 81 81 kfree(path); 82 82 } 83 83 84 - xfblob_destroy(dl->path_names); 85 - xfarray_destroy(dl->path_steps); 84 + if (dl->path_names) 85 + xfblob_destroy(dl->path_names); 86 + dl->path_names = NULL; 87 + if (dl->path_steps) 88 + xfarray_destroy(dl->path_steps); 89 + dl->path_steps = NULL; 86 90 mutex_destroy(&dl->lock); 87 91 } 88 92 ··· 96 92 struct xfs_scrub *sc) 97 93 { 98 94 struct xchk_dirtree *dl; 99 - char *descr; 100 95 int error; 101 96 102 97 xchk_fsgates_enable(sc, XCHK_FSGATES_DIRENTS); ··· 119 116 120 117 mutex_init(&dl->lock); 121 118 122 - descr = xchk_xfile_ino_descr(sc, "dirtree path steps"); 123 - error = xfarray_create(descr, 0, sizeof(struct xchk_dirpath_step), 124 - &dl->path_steps); 125 - kfree(descr); 119 + error = xfarray_create("dirtree path steps", 0, 120 + sizeof(struct xchk_dirpath_step), &dl->path_steps); 126 121 if (error) 127 122 goto out_dl; 128 123 129 - descr = xchk_xfile_ino_descr(sc, "dirtree path names"); 130 - error = xfblob_create(descr, &dl->path_names); 131 - kfree(descr); 124 + error = xfblob_create("dirtree path names", &dl->path_names); 132 125 if (error) 133 126 goto out_steps; 134 127
+18 -7
fs/xfs/scrub/ialloc_repair.c
··· 797 797 { 798 798 struct xrep_ibt *ri; 799 799 struct xfs_mount *mp = sc->mp; 800 - char *descr; 801 800 xfs_agino_t first_agino, last_agino; 802 801 int error = 0; 803 802 ··· 815 816 /* Set up enough storage to handle an AG with nothing but inodes. */ 816 817 xfs_agino_range(mp, pag_agno(sc->sa.pag), &first_agino, &last_agino); 817 818 last_agino /= XFS_INODES_PER_CHUNK; 818 - descr = xchk_xfile_ag_descr(sc, "inode index records"); 819 - error = xfarray_create(descr, last_agino, 819 + error = xfarray_create("inode index records", last_agino, 820 820 sizeof(struct xfs_inobt_rec_incore), 821 821 &ri->inode_records); 822 - kfree(descr); 823 822 if (error) 824 823 goto out_ri; 825 824 ··· 863 866 if (error) 864 867 goto out; 865 868 866 - if (xfs_has_finobt(sc->mp)) { 867 - sc->sm->sm_type = XFS_SCRUB_TYPE_FINOBT; 868 - error = xchk_iallocbt(sc); 869 + /* 870 + * If the inobt is still corrupt, we've failed to repair the filesystem 871 + * and should just bail out. 872 + * 873 + * If the inobt fails cross-examination with the finobt, the scan will 874 + * free the finobt cursor, so we need to mark the repair incomplete 875 + * and avoid walking off the end of the NULL finobt cursor. 876 + */ 877 + if (!xfs_has_finobt(sc->mp) || 878 + (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) 879 + goto out; 880 + 881 + sc->sm->sm_type = XFS_SCRUB_TYPE_FINOBT; 882 + if (!sc->sa.fino_cur) { 883 + xchk_set_incomplete(sc); 884 + goto out; 869 885 } 886 + error = xchk_iallocbt(sc); 870 887 871 888 out: 872 889 sc->sm->sm_type = old_type;
+4 -5
fs/xfs/scrub/nlinks.c
··· 971 971 972 972 xfs_dir_hook_del(xnc->sc->mp, &xnc->dhook); 973 973 974 - xfarray_destroy(xnc->nlinks); 974 + if (xnc->nlinks) 975 + xfarray_destroy(xnc->nlinks); 975 976 xnc->nlinks = NULL; 976 977 977 978 xchk_iscan_teardown(&xnc->collect_iscan); ··· 991 990 struct xchk_nlink_ctrs *xnc) 992 991 { 993 992 struct xfs_mount *mp = sc->mp; 994 - char *descr; 995 993 unsigned long long max_inos; 996 994 xfs_agnumber_t last_agno = mp->m_sb.sb_agcount - 1; 997 995 xfs_agino_t first_agino, last_agino; ··· 1007 1007 */ 1008 1008 xfs_agino_range(mp, last_agno, &first_agino, &last_agino); 1009 1009 max_inos = XFS_AGINO_TO_INO(mp, last_agno, last_agino) + 1; 1010 - descr = xchk_xfile_descr(sc, "file link counts"); 1011 - error = xfarray_create(descr, min(XFS_MAXINUMBER + 1, max_inos), 1010 + error = xfarray_create("file link counts", 1011 + min(XFS_MAXINUMBER + 1, max_inos), 1012 1012 sizeof(struct xchk_nlink), &xnc->nlinks); 1013 - kfree(descr); 1014 1013 if (error) 1015 1014 goto out_teardown; 1016 1015
+3 -8
fs/xfs/scrub/parent.c
··· 755 755 struct xfs_scrub *sc) 756 756 { 757 757 struct xchk_pptrs *pp; 758 - char *descr; 759 758 int error; 760 759 761 760 pp = kvzalloc(sizeof(struct xchk_pptrs), XCHK_GFP_FLAGS); ··· 767 768 * Set up some staging memory for parent pointers that we can't check 768 769 * due to locking contention. 769 770 */ 770 - descr = xchk_xfile_ino_descr(sc, "slow parent pointer entries"); 771 - error = xfarray_create(descr, 0, sizeof(struct xchk_pptr), 772 - &pp->pptr_entries); 773 - kfree(descr); 771 + error = xfarray_create("slow parent pointer entries", 0, 772 + sizeof(struct xchk_pptr), &pp->pptr_entries); 774 773 if (error) 775 774 goto out_pp; 776 775 777 - descr = xchk_xfile_ino_descr(sc, "slow parent pointer names"); 778 - error = xfblob_create(descr, &pp->pptr_names); 779 - kfree(descr); 776 + error = xfblob_create("slow parent pointer names", &pp->pptr_names); 780 777 if (error) 781 778 goto out_entries; 782 779
+6 -17
fs/xfs/scrub/parent_repair.c
··· 1497 1497 struct xrep_parent *rp) 1498 1498 { 1499 1499 struct xfs_scrub *sc = rp->sc; 1500 - char *descr; 1501 1500 struct xfs_da_geometry *geo = sc->mp->m_attr_geo; 1502 1501 int max_len; 1503 1502 int error; ··· 1524 1525 goto out_xattr_name; 1525 1526 1526 1527 /* Set up some staging memory for logging parent pointer updates. */ 1527 - descr = xchk_xfile_ino_descr(sc, "parent pointer entries"); 1528 - error = xfarray_create(descr, 0, sizeof(struct xrep_pptr), 1529 - &rp->pptr_recs); 1530 - kfree(descr); 1528 + error = xfarray_create("parent pointer entries", 0, 1529 + sizeof(struct xrep_pptr), &rp->pptr_recs); 1531 1530 if (error) 1532 1531 goto out_xattr_value; 1533 1532 1534 - descr = xchk_xfile_ino_descr(sc, "parent pointer names"); 1535 - error = xfblob_create(descr, &rp->pptr_names); 1536 - kfree(descr); 1533 + error = xfblob_create("parent pointer names", &rp->pptr_names); 1537 1534 if (error) 1538 1535 goto out_recs; 1539 1536 1540 1537 /* Set up some storage for copying attrs before the mapping exchange */ 1541 - descr = xchk_xfile_ino_descr(sc, 1542 - "parent pointer retained xattr entries"); 1543 - error = xfarray_create(descr, 0, sizeof(struct xrep_parent_xattr), 1544 - &rp->xattr_records); 1545 - kfree(descr); 1538 + error = xfarray_create("parent pointer xattr entries", 0, 1539 + sizeof(struct xrep_parent_xattr), &rp->xattr_records); 1546 1540 if (error) 1547 1541 goto out_names; 1548 1542 1549 - descr = xchk_xfile_ino_descr(sc, 1550 - "parent pointer retained xattr values"); 1551 - error = xfblob_create(descr, &rp->xattr_blobs); 1552 - kfree(descr); 1543 + error = xfblob_create("parent pointer xattr values", &rp->xattr_blobs); 1553 1544 if (error) 1554 1545 goto out_attr_keys; 1555 1546
+3 -10
fs/xfs/scrub/quotacheck.c
··· 741 741 struct xfs_scrub *sc, 742 742 struct xqcheck *xqc) 743 743 { 744 - char *descr; 745 744 struct xfs_quotainfo *qi = sc->mp->m_quotainfo; 746 745 unsigned long long max_dquots = XFS_DQ_ID_MAX + 1ULL; 747 746 int error; ··· 755 756 756 757 error = -ENOMEM; 757 758 if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_USER)) { 758 - descr = xchk_xfile_descr(sc, "user dquot records"); 759 - error = xfarray_create(descr, max_dquots, 759 + error = xfarray_create("user dquot records", max_dquots, 760 760 sizeof(struct xqcheck_dquot), &xqc->ucounts); 761 - kfree(descr); 762 761 if (error) 763 762 goto out_teardown; 764 763 } 765 764 766 765 if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_GROUP)) { 767 - descr = xchk_xfile_descr(sc, "group dquot records"); 768 - error = xfarray_create(descr, max_dquots, 766 + error = xfarray_create("group dquot records", max_dquots, 769 767 sizeof(struct xqcheck_dquot), &xqc->gcounts); 770 - kfree(descr); 771 768 if (error) 772 769 goto out_teardown; 773 770 } 774 771 775 772 if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_PROJ)) { 776 - descr = xchk_xfile_descr(sc, "project dquot records"); 777 - error = xfarray_create(descr, max_dquots, 773 + error = xfarray_create("project dquot records", max_dquots, 778 774 sizeof(struct xqcheck_dquot), &xqc->pcounts); 779 - kfree(descr); 780 775 if (error) 781 776 goto out_teardown; 782 777 }
+2 -11
fs/xfs/scrub/refcount_repair.c
··· 123 123 xrep_setup_ag_refcountbt( 124 124 struct xfs_scrub *sc) 125 125 { 126 - char *descr; 127 - int error; 128 - 129 - descr = xchk_xfile_ag_descr(sc, "rmap record bag"); 130 - error = xrep_setup_xfbtree(sc, descr); 131 - kfree(descr); 132 - return error; 126 + return xrep_setup_xfbtree(sc, "rmap record bag"); 133 127 } 134 128 135 129 /* Check for any obvious conflicts with this shared/CoW staging extent. */ ··· 698 704 { 699 705 struct xrep_refc *rr; 700 706 struct xfs_mount *mp = sc->mp; 701 - char *descr; 702 707 int error; 703 708 704 709 /* We require the rmapbt to rebuild anything. */ ··· 710 717 rr->sc = sc; 711 718 712 719 /* Set up enough storage to handle one refcount record per block. */ 713 - descr = xchk_xfile_ag_descr(sc, "reference count records"); 714 - error = xfarray_create(descr, mp->m_sb.sb_agblocks, 720 + error = xfarray_create("reference count records", mp->m_sb.sb_agblocks, 715 721 sizeof(struct xfs_refcount_irec), 716 722 &rr->refcount_records); 717 - kfree(descr); 718 723 if (error) 719 724 goto out_rr; 720 725
+3
fs/xfs/scrub/repair.c
··· 1136 1136 * setup/teardown routines. 1137 1137 */ 1138 1138 sub = xchk_scrub_create_subord(sc, scrub_type); 1139 + if (!sub) 1140 + return -ENOMEM; 1141 + 1139 1142 error = sub->sc.ops->scrub(&sub->sc); 1140 1143 if (error) 1141 1144 goto out;
+1 -4
fs/xfs/scrub/rmap_repair.c
··· 164 164 struct xfs_scrub *sc) 165 165 { 166 166 struct xrep_rmap *rr; 167 - char *descr; 168 167 int error; 169 168 170 169 xchk_fsgates_enable(sc, XCHK_FSGATES_RMAP); 171 170 172 - descr = xchk_xfile_ag_descr(sc, "reverse mapping records"); 173 - error = xrep_setup_xfbtree(sc, descr); 174 - kfree(descr); 171 + error = xrep_setup_xfbtree(sc, "reverse mapping records"); 175 172 if (error) 176 173 return error; 177 174
+2 -4
fs/xfs/scrub/rtbitmap_repair.c
··· 43 43 struct xchk_rtbitmap *rtb) 44 44 { 45 45 struct xfs_mount *mp = sc->mp; 46 - char *descr; 47 46 unsigned long long blocks = mp->m_sb.sb_rbmblocks; 48 47 int error; 49 48 ··· 51 52 return error; 52 53 53 54 /* Create an xfile to hold our reconstructed bitmap. */ 54 - descr = xchk_xfile_rtgroup_descr(sc, "bitmap file"); 55 - error = xfile_create(descr, blocks * mp->m_sb.sb_blocksize, &sc->xfile); 56 - kfree(descr); 55 + error = xfile_create("realtime bitmap file", 56 + blocks * mp->m_sb.sb_blocksize, &sc->xfile); 57 57 if (error) 58 58 return error; 59 59
+3 -12
fs/xfs/scrub/rtrefcount_repair.c
··· 128 128 xrep_setup_rtrefcountbt( 129 129 struct xfs_scrub *sc) 130 130 { 131 - char *descr; 132 - int error; 133 - 134 - descr = xchk_xfile_ag_descr(sc, "rmap record bag"); 135 - error = xrep_setup_xfbtree(sc, descr); 136 - kfree(descr); 137 - return error; 131 + return xrep_setup_xfbtree(sc, "realtime rmap record bag"); 138 132 } 139 133 140 134 /* Check for any obvious conflicts with this shared/CoW staging extent. */ ··· 698 704 { 699 705 struct xrep_rtrefc *rr; 700 706 struct xfs_mount *mp = sc->mp; 701 - char *descr; 702 707 int error; 703 708 704 709 /* We require the rmapbt to rebuild anything. */ ··· 715 722 rr->sc = sc; 716 723 717 724 /* Set up enough storage to handle one refcount record per rt extent. */ 718 - descr = xchk_xfile_ag_descr(sc, "reference count records"); 719 - error = xfarray_create(descr, mp->m_sb.sb_rextents, 720 - sizeof(struct xfs_refcount_irec), 725 + error = xfarray_create("realtime reference count records", 726 + mp->m_sb.sb_rextents, sizeof(struct xfs_refcount_irec), 721 727 &rr->refcount_records); 722 - kfree(descr); 723 728 if (error) 724 729 goto out_rr; 725 730
+1 -4
fs/xfs/scrub/rtrmap_repair.c
··· 103 103 struct xfs_scrub *sc) 104 104 { 105 105 struct xrep_rtrmap *rr; 106 - char *descr; 107 106 int error; 108 107 109 108 xchk_fsgates_enable(sc, XCHK_FSGATES_RMAP); 110 109 111 - descr = xchk_xfile_rtgroup_descr(sc, "reverse mapping records"); 112 - error = xrep_setup_xfbtree(sc, descr); 113 - kfree(descr); 110 + error = xrep_setup_xfbtree(sc, "realtime reverse mapping records"); 114 111 if (error) 115 112 return error; 116 113
+2 -5
fs/xfs/scrub/rtsummary.c
··· 43 43 struct xfs_scrub *sc) 44 44 { 45 45 struct xfs_mount *mp = sc->mp; 46 - char *descr; 47 46 struct xchk_rtsummary *rts; 48 47 int error; 49 48 ··· 69 70 * Create an xfile to construct a new rtsummary file. The xfile allows 70 71 * us to avoid pinning kernel memory for this purpose. 71 72 */ 72 - descr = xchk_xfile_descr(sc, "realtime summary file"); 73 - error = xfile_create(descr, XFS_FSB_TO_B(mp, mp->m_rsumblocks), 74 - &sc->xfile); 75 - kfree(descr); 73 + error = xfile_create("realtime summary file", 74 + XFS_FSB_TO_B(mp, mp->m_rsumblocks), &sc->xfile); 76 75 if (error) 77 76 return error; 78 77
+1 -1
fs/xfs/scrub/scrub.c
··· 634 634 635 635 sub = kzalloc(sizeof(*sub), XCHK_GFP_FLAGS); 636 636 if (!sub) 637 - return ERR_PTR(-ENOMEM); 637 + return NULL; 638 638 639 639 sub->old_smtype = sc->sm->sm_type; 640 640 sub->old_smflags = sc->sm->sm_flags;