xfs: get rid of the xchk_xfile_*_descr calls
The xchk_xfile_*_descr macros call kasprintf, which can fail to allocate
memory if the formatted string is larger than 16 bytes (or whatever the
nofail guarantees are nowadays). Some of them could easily exceed that,
and Jiaming Zhang found a few places where that can happen with syzbot.
The descriptions are debugging aids and aren't required to be unique, so
let's just pass in static strings and eliminate this path to failure.
Note this patch touches a number of commits, most of which were merged
between 6.6 and 6.14.
Cc: r772577952@gmail.com
Cc: <stable@vger.kernel.org> # v6.12
Fixes: ab97f4b1c0 ("xfs: repair AGI unlinked inode bucket lists")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Jiaming Zhang <r772577952@gmail.com>
This commit is contained in:
parent
eaec8aeff3
commit
60382993a2
|
|
@ -1708,7 +1708,6 @@ xrep_agi(
|
||||||
{
|
{
|
||||||
struct xrep_agi *ragi;
|
struct xrep_agi *ragi;
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
|
@ -1742,17 +1741,13 @@ xrep_agi(
|
||||||
xagino_bitmap_init(&ragi->iunlink_bmp);
|
xagino_bitmap_init(&ragi->iunlink_bmp);
|
||||||
sc->buf_cleanup = xrep_agi_buf_cleanup;
|
sc->buf_cleanup = xrep_agi_buf_cleanup;
|
||||||
|
|
||||||
descr = xchk_xfile_ag_descr(sc, "iunlinked next pointers");
|
error = xfarray_create("iunlinked next pointers", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(xfs_agino_t),
|
sizeof(xfs_agino_t), &ragi->iunlink_next);
|
||||||
&ragi->iunlink_next);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
descr = xchk_xfile_ag_descr(sc, "iunlinked prev pointers");
|
error = xfarray_create("iunlinked prev pointers", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(xfs_agino_t),
|
sizeof(xfs_agino_t), &ragi->iunlink_prev);
|
||||||
&ragi->iunlink_prev);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -850,7 +850,6 @@ xrep_allocbt(
|
||||||
struct xrep_abt *ra;
|
struct xrep_abt *ra;
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
unsigned int busy_gen;
|
unsigned int busy_gen;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* We require the rmapbt to rebuild anything. */
|
/* We require the rmapbt to rebuild anything. */
|
||||||
|
|
@ -876,11 +875,9 @@ xrep_allocbt(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up enough storage to handle maximally fragmented free space. */
|
/* Set up enough storage to handle maximally fragmented free space. */
|
||||||
descr = xchk_xfile_ag_descr(sc, "free space records");
|
error = xfarray_create("free space records", mp->m_sb.sb_agblocks / 2,
|
||||||
error = xfarray_create(descr, mp->m_sb.sb_agblocks / 2,
|
|
||||||
sizeof(struct xfs_alloc_rec_incore),
|
sizeof(struct xfs_alloc_rec_incore),
|
||||||
&ra->free_records);
|
&ra->free_records);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_ra;
|
goto out_ra;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1529,7 +1529,6 @@ xrep_xattr_setup_scan(
|
||||||
struct xrep_xattr **rxp)
|
struct xrep_xattr **rxp)
|
||||||
{
|
{
|
||||||
struct xrep_xattr *rx;
|
struct xrep_xattr *rx;
|
||||||
char *descr;
|
|
||||||
int max_len;
|
int max_len;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
|
@ -1555,35 +1554,26 @@ xrep_xattr_setup_scan(
|
||||||
goto out_rx;
|
goto out_rx;
|
||||||
|
|
||||||
/* Set up some staging for salvaged attribute keys and values */
|
/* Set up some staging for salvaged attribute keys and values */
|
||||||
descr = xchk_xfile_ino_descr(sc, "xattr keys");
|
error = xfarray_create("xattr keys", 0, sizeof(struct xrep_xattr_key),
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xrep_xattr_key),
|
|
||||||
&rx->xattr_records);
|
&rx->xattr_records);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_rx;
|
goto out_rx;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "xattr names");
|
error = xfblob_create("xattr names", &rx->xattr_blobs);
|
||||||
error = xfblob_create(descr, &rx->xattr_blobs);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_keys;
|
goto out_keys;
|
||||||
|
|
||||||
if (xfs_has_parent(sc->mp)) {
|
if (xfs_has_parent(sc->mp)) {
|
||||||
ASSERT(sc->flags & XCHK_FSGATES_DIRENTS);
|
ASSERT(sc->flags & XCHK_FSGATES_DIRENTS);
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc,
|
error = xfarray_create("xattr parent pointer entries", 0,
|
||||||
"xattr retained parent pointer entries");
|
|
||||||
error = xfarray_create(descr, 0,
|
|
||||||
sizeof(struct xrep_xattr_pptr),
|
sizeof(struct xrep_xattr_pptr),
|
||||||
&rx->pptr_recs);
|
&rx->pptr_recs);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_values;
|
goto out_values;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc,
|
error = xfblob_create("xattr parent pointer names",
|
||||||
"xattr retained parent pointer names");
|
&rx->pptr_names);
|
||||||
error = xfblob_create(descr, &rx->pptr_names);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_pprecs;
|
goto out_pprecs;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -923,7 +923,6 @@ xrep_bmap(
|
||||||
bool allow_unwritten)
|
bool allow_unwritten)
|
||||||
{
|
{
|
||||||
struct xrep_bmap *rb;
|
struct xrep_bmap *rb;
|
||||||
char *descr;
|
|
||||||
xfs_extnum_t max_bmbt_recs;
|
xfs_extnum_t max_bmbt_recs;
|
||||||
bool large_extcount;
|
bool large_extcount;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
@ -945,11 +944,8 @@ xrep_bmap(
|
||||||
/* Set up enough storage to handle the max records for this fork. */
|
/* Set up enough storage to handle the max records for this fork. */
|
||||||
large_extcount = xfs_has_large_extent_counts(sc->mp);
|
large_extcount = xfs_has_large_extent_counts(sc->mp);
|
||||||
max_bmbt_recs = xfs_iext_max_nextents(large_extcount, whichfork);
|
max_bmbt_recs = xfs_iext_max_nextents(large_extcount, whichfork);
|
||||||
descr = xchk_xfile_ino_descr(sc, "%s fork mapping records",
|
error = xfarray_create("fork mapping records", max_bmbt_recs,
|
||||||
whichfork == XFS_DATA_FORK ? "data" : "attr");
|
|
||||||
error = xfarray_create(descr, max_bmbt_recs,
|
|
||||||
sizeof(struct xfs_bmbt_rec), &rb->bmap_records);
|
sizeof(struct xfs_bmbt_rec), &rb->bmap_records);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_rb;
|
goto out_rb;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,31 +246,6 @@ static inline bool xchk_could_repair(const struct xfs_scrub *sc)
|
||||||
|
|
||||||
int xchk_metadata_inode_forks(struct xfs_scrub *sc);
|
int xchk_metadata_inode_forks(struct xfs_scrub *sc);
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper macros to allocate and format xfile description strings.
|
|
||||||
* Callers must kfree the pointer returned.
|
|
||||||
*/
|
|
||||||
#define xchk_xfile_descr(sc, fmt, ...) \
|
|
||||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): " fmt, \
|
|
||||||
(sc)->mp->m_super->s_id, ##__VA_ARGS__)
|
|
||||||
#define xchk_xfile_ag_descr(sc, fmt, ...) \
|
|
||||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): AG 0x%x " fmt, \
|
|
||||||
(sc)->mp->m_super->s_id, \
|
|
||||||
(sc)->sa.pag ? \
|
|
||||||
pag_agno((sc)->sa.pag) : (sc)->sm->sm_agno, \
|
|
||||||
##__VA_ARGS__)
|
|
||||||
#define xchk_xfile_ino_descr(sc, fmt, ...) \
|
|
||||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): inode 0x%llx " fmt, \
|
|
||||||
(sc)->mp->m_super->s_id, \
|
|
||||||
(sc)->ip ? (sc)->ip->i_ino : (sc)->sm->sm_ino, \
|
|
||||||
##__VA_ARGS__)
|
|
||||||
#define xchk_xfile_rtgroup_descr(sc, fmt, ...) \
|
|
||||||
kasprintf(XCHK_GFP_FLAGS, "XFS (%s): rtgroup 0x%x " fmt, \
|
|
||||||
(sc)->mp->m_super->s_id, \
|
|
||||||
(sc)->sa.pag ? \
|
|
||||||
rtg_rgno((sc)->sr.rtg) : (sc)->sm->sm_agno, \
|
|
||||||
##__VA_ARGS__)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setting up a hook to wait for intents to drain is costly -- we have to take
|
* Setting up a hook to wait for intents to drain is costly -- we have to take
|
||||||
* the CPU hotplug lock and force an i-cache flush on all CPUs once to set it
|
* the CPU hotplug lock and force an i-cache flush on all CPUs once to set it
|
||||||
|
|
|
||||||
|
|
@ -1102,22 +1102,17 @@ xchk_directory(
|
||||||
sd->xname.name = sd->namebuf;
|
sd->xname.name = sd->namebuf;
|
||||||
|
|
||||||
if (xfs_has_parent(sc->mp)) {
|
if (xfs_has_parent(sc->mp)) {
|
||||||
char *descr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up some staging memory for dirents that we can't check
|
* Set up some staging memory for dirents that we can't check
|
||||||
* due to locking contention.
|
* due to locking contention.
|
||||||
*/
|
*/
|
||||||
descr = xchk_xfile_ino_descr(sc, "slow directory entries");
|
error = xfarray_create("slow directory entries", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xchk_dirent),
|
sizeof(struct xchk_dirent), &sd->dir_entries);
|
||||||
&sd->dir_entries);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_sd;
|
goto out_sd;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "slow directory entry names");
|
error = xfblob_create("slow directory entry names",
|
||||||
error = xfblob_create(descr, &sd->dir_names);
|
&sd->dir_names);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_entries;
|
goto out_entries;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1784,20 +1784,15 @@ xrep_dir_setup_scan(
|
||||||
struct xrep_dir *rd)
|
struct xrep_dir *rd)
|
||||||
{
|
{
|
||||||
struct xfs_scrub *sc = rd->sc;
|
struct xfs_scrub *sc = rd->sc;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Set up some staging memory for salvaging dirents. */
|
/* Set up some staging memory for salvaging dirents. */
|
||||||
descr = xchk_xfile_ino_descr(sc, "directory entries");
|
error = xfarray_create("directory entries", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xrep_dirent),
|
sizeof(struct xrep_dirent), &rd->dir_entries);
|
||||||
&rd->dir_entries);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "directory entry names");
|
error = xfblob_create("directory entry names", &rd->dir_names);
|
||||||
error = xfblob_create(descr, &rd->dir_names);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_xfarray;
|
goto out_xfarray;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,6 @@ xchk_setup_dirtree(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
struct xchk_dirtree *dl;
|
struct xchk_dirtree *dl;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
xchk_fsgates_enable(sc, XCHK_FSGATES_DIRENTS);
|
xchk_fsgates_enable(sc, XCHK_FSGATES_DIRENTS);
|
||||||
|
|
@ -116,16 +115,12 @@ xchk_setup_dirtree(
|
||||||
|
|
||||||
mutex_init(&dl->lock);
|
mutex_init(&dl->lock);
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "dirtree path steps");
|
error = xfarray_create("dirtree path steps", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xchk_dirpath_step),
|
sizeof(struct xchk_dirpath_step), &dl->path_steps);
|
||||||
&dl->path_steps);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_dl;
|
goto out_dl;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "dirtree path names");
|
error = xfblob_create("dirtree path names", &dl->path_names);
|
||||||
error = xfblob_create(descr, &dl->path_names);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_steps;
|
goto out_steps;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -797,7 +797,6 @@ xrep_iallocbt(
|
||||||
{
|
{
|
||||||
struct xrep_ibt *ri;
|
struct xrep_ibt *ri;
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
xfs_agino_t first_agino, last_agino;
|
xfs_agino_t first_agino, last_agino;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
|
|
@ -816,11 +815,9 @@ xrep_iallocbt(
|
||||||
/* Set up enough storage to handle an AG with nothing but inodes. */
|
/* Set up enough storage to handle an AG with nothing but inodes. */
|
||||||
xfs_agino_range(mp, pag_agno(sc->sa.pag), &first_agino, &last_agino);
|
xfs_agino_range(mp, pag_agno(sc->sa.pag), &first_agino, &last_agino);
|
||||||
last_agino /= XFS_INODES_PER_CHUNK;
|
last_agino /= XFS_INODES_PER_CHUNK;
|
||||||
descr = xchk_xfile_ag_descr(sc, "inode index records");
|
error = xfarray_create("inode index records", last_agino,
|
||||||
error = xfarray_create(descr, last_agino,
|
|
||||||
sizeof(struct xfs_inobt_rec_incore),
|
sizeof(struct xfs_inobt_rec_incore),
|
||||||
&ri->inode_records);
|
&ri->inode_records);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_ri;
|
goto out_ri;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -990,7 +990,6 @@ xchk_nlinks_setup_scan(
|
||||||
struct xchk_nlink_ctrs *xnc)
|
struct xchk_nlink_ctrs *xnc)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
unsigned long long max_inos;
|
unsigned long long max_inos;
|
||||||
xfs_agnumber_t last_agno = mp->m_sb.sb_agcount - 1;
|
xfs_agnumber_t last_agno = mp->m_sb.sb_agcount - 1;
|
||||||
xfs_agino_t first_agino, last_agino;
|
xfs_agino_t first_agino, last_agino;
|
||||||
|
|
@ -1007,10 +1006,9 @@ xchk_nlinks_setup_scan(
|
||||||
*/
|
*/
|
||||||
xfs_agino_range(mp, last_agno, &first_agino, &last_agino);
|
xfs_agino_range(mp, last_agno, &first_agino, &last_agino);
|
||||||
max_inos = XFS_AGINO_TO_INO(mp, last_agno, last_agino) + 1;
|
max_inos = XFS_AGINO_TO_INO(mp, last_agno, last_agino) + 1;
|
||||||
descr = xchk_xfile_descr(sc, "file link counts");
|
error = xfarray_create("file link counts",
|
||||||
error = xfarray_create(descr, min(XFS_MAXINUMBER + 1, max_inos),
|
min(XFS_MAXINUMBER + 1, max_inos),
|
||||||
sizeof(struct xchk_nlink), &xnc->nlinks);
|
sizeof(struct xchk_nlink), &xnc->nlinks);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_teardown;
|
goto out_teardown;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -755,7 +755,6 @@ xchk_parent_pptr(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
struct xchk_pptrs *pp;
|
struct xchk_pptrs *pp;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
pp = kvzalloc(sizeof(struct xchk_pptrs), XCHK_GFP_FLAGS);
|
pp = kvzalloc(sizeof(struct xchk_pptrs), XCHK_GFP_FLAGS);
|
||||||
|
|
@ -768,16 +767,12 @@ xchk_parent_pptr(
|
||||||
* Set up some staging memory for parent pointers that we can't check
|
* Set up some staging memory for parent pointers that we can't check
|
||||||
* due to locking contention.
|
* due to locking contention.
|
||||||
*/
|
*/
|
||||||
descr = xchk_xfile_ino_descr(sc, "slow parent pointer entries");
|
error = xfarray_create("slow parent pointer entries", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xchk_pptr),
|
sizeof(struct xchk_pptr), &pp->pptr_entries);
|
||||||
&pp->pptr_entries);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_pp;
|
goto out_pp;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "slow parent pointer names");
|
error = xfblob_create("slow parent pointer names", &pp->pptr_names);
|
||||||
error = xfblob_create(descr, &pp->pptr_names);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_entries;
|
goto out_entries;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1497,7 +1497,6 @@ xrep_parent_setup_scan(
|
||||||
struct xrep_parent *rp)
|
struct xrep_parent *rp)
|
||||||
{
|
{
|
||||||
struct xfs_scrub *sc = rp->sc;
|
struct xfs_scrub *sc = rp->sc;
|
||||||
char *descr;
|
|
||||||
struct xfs_da_geometry *geo = sc->mp->m_attr_geo;
|
struct xfs_da_geometry *geo = sc->mp->m_attr_geo;
|
||||||
int max_len;
|
int max_len;
|
||||||
int error;
|
int error;
|
||||||
|
|
@ -1525,32 +1524,22 @@ xrep_parent_setup_scan(
|
||||||
goto out_xattr_name;
|
goto out_xattr_name;
|
||||||
|
|
||||||
/* Set up some staging memory for logging parent pointer updates. */
|
/* Set up some staging memory for logging parent pointer updates. */
|
||||||
descr = xchk_xfile_ino_descr(sc, "parent pointer entries");
|
error = xfarray_create("parent pointer entries", 0,
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xrep_pptr),
|
sizeof(struct xrep_pptr), &rp->pptr_recs);
|
||||||
&rp->pptr_recs);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_xattr_value;
|
goto out_xattr_value;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc, "parent pointer names");
|
error = xfblob_create("parent pointer names", &rp->pptr_names);
|
||||||
error = xfblob_create(descr, &rp->pptr_names);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_recs;
|
goto out_recs;
|
||||||
|
|
||||||
/* Set up some storage for copying attrs before the mapping exchange */
|
/* Set up some storage for copying attrs before the mapping exchange */
|
||||||
descr = xchk_xfile_ino_descr(sc,
|
error = xfarray_create("parent pointer xattr entries", 0,
|
||||||
"parent pointer retained xattr entries");
|
sizeof(struct xrep_parent_xattr), &rp->xattr_records);
|
||||||
error = xfarray_create(descr, 0, sizeof(struct xrep_parent_xattr),
|
|
||||||
&rp->xattr_records);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_names;
|
goto out_names;
|
||||||
|
|
||||||
descr = xchk_xfile_ino_descr(sc,
|
error = xfblob_create("parent pointer xattr values", &rp->xattr_blobs);
|
||||||
"parent pointer retained xattr values");
|
|
||||||
error = xfblob_create(descr, &rp->xattr_blobs);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_attr_keys;
|
goto out_attr_keys;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -741,7 +741,6 @@ xqcheck_setup_scan(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
struct xqcheck *xqc)
|
struct xqcheck *xqc)
|
||||||
{
|
{
|
||||||
char *descr;
|
|
||||||
struct xfs_quotainfo *qi = sc->mp->m_quotainfo;
|
struct xfs_quotainfo *qi = sc->mp->m_quotainfo;
|
||||||
unsigned long long max_dquots = XFS_DQ_ID_MAX + 1ULL;
|
unsigned long long max_dquots = XFS_DQ_ID_MAX + 1ULL;
|
||||||
int error;
|
int error;
|
||||||
|
|
@ -756,28 +755,22 @@ xqcheck_setup_scan(
|
||||||
|
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_USER)) {
|
if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_USER)) {
|
||||||
descr = xchk_xfile_descr(sc, "user dquot records");
|
error = xfarray_create("user dquot records", max_dquots,
|
||||||
error = xfarray_create(descr, max_dquots,
|
|
||||||
sizeof(struct xqcheck_dquot), &xqc->ucounts);
|
sizeof(struct xqcheck_dquot), &xqc->ucounts);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_teardown;
|
goto out_teardown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_GROUP)) {
|
if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_GROUP)) {
|
||||||
descr = xchk_xfile_descr(sc, "group dquot records");
|
error = xfarray_create("group dquot records", max_dquots,
|
||||||
error = xfarray_create(descr, max_dquots,
|
|
||||||
sizeof(struct xqcheck_dquot), &xqc->gcounts);
|
sizeof(struct xqcheck_dquot), &xqc->gcounts);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_teardown;
|
goto out_teardown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_PROJ)) {
|
if (xfs_this_quota_on(sc->mp, XFS_DQTYPE_PROJ)) {
|
||||||
descr = xchk_xfile_descr(sc, "project dquot records");
|
error = xfarray_create("project dquot records", max_dquots,
|
||||||
error = xfarray_create(descr, max_dquots,
|
|
||||||
sizeof(struct xqcheck_dquot), &xqc->pcounts);
|
sizeof(struct xqcheck_dquot), &xqc->pcounts);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_teardown;
|
goto out_teardown;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,13 +123,7 @@ int
|
||||||
xrep_setup_ag_refcountbt(
|
xrep_setup_ag_refcountbt(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
char *descr;
|
return xrep_setup_xfbtree(sc, "rmap record bag");
|
||||||
int error;
|
|
||||||
|
|
||||||
descr = xchk_xfile_ag_descr(sc, "rmap record bag");
|
|
||||||
error = xrep_setup_xfbtree(sc, descr);
|
|
||||||
kfree(descr);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for any obvious conflicts with this shared/CoW staging extent. */
|
/* Check for any obvious conflicts with this shared/CoW staging extent. */
|
||||||
|
|
@ -704,7 +698,6 @@ xrep_refcountbt(
|
||||||
{
|
{
|
||||||
struct xrep_refc *rr;
|
struct xrep_refc *rr;
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* We require the rmapbt to rebuild anything. */
|
/* We require the rmapbt to rebuild anything. */
|
||||||
|
|
@ -717,11 +710,9 @@ xrep_refcountbt(
|
||||||
rr->sc = sc;
|
rr->sc = sc;
|
||||||
|
|
||||||
/* Set up enough storage to handle one refcount record per block. */
|
/* Set up enough storage to handle one refcount record per block. */
|
||||||
descr = xchk_xfile_ag_descr(sc, "reference count records");
|
error = xfarray_create("reference count records", mp->m_sb.sb_agblocks,
|
||||||
error = xfarray_create(descr, mp->m_sb.sb_agblocks,
|
|
||||||
sizeof(struct xfs_refcount_irec),
|
sizeof(struct xfs_refcount_irec),
|
||||||
&rr->refcount_records);
|
&rr->refcount_records);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_rr;
|
goto out_rr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,14 +164,11 @@ xrep_setup_ag_rmapbt(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
struct xrep_rmap *rr;
|
struct xrep_rmap *rr;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
xchk_fsgates_enable(sc, XCHK_FSGATES_RMAP);
|
xchk_fsgates_enable(sc, XCHK_FSGATES_RMAP);
|
||||||
|
|
||||||
descr = xchk_xfile_ag_descr(sc, "reverse mapping records");
|
error = xrep_setup_xfbtree(sc, "reverse mapping records");
|
||||||
error = xrep_setup_xfbtree(sc, descr);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ xrep_setup_rtbitmap(
|
||||||
struct xchk_rtbitmap *rtb)
|
struct xchk_rtbitmap *rtb)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
unsigned long long blocks = mp->m_sb.sb_rbmblocks;
|
unsigned long long blocks = mp->m_sb.sb_rbmblocks;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
|
@ -52,9 +51,8 @@ xrep_setup_rtbitmap(
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
/* Create an xfile to hold our reconstructed bitmap. */
|
/* Create an xfile to hold our reconstructed bitmap. */
|
||||||
descr = xchk_xfile_rtgroup_descr(sc, "bitmap file");
|
error = xfile_create("realtime bitmap file",
|
||||||
error = xfile_create(descr, blocks * mp->m_sb.sb_blocksize, &sc->xfile);
|
blocks * mp->m_sb.sb_blocksize, &sc->xfile);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,13 +128,7 @@ int
|
||||||
xrep_setup_rtrefcountbt(
|
xrep_setup_rtrefcountbt(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
char *descr;
|
return xrep_setup_xfbtree(sc, "realtime rmap record bag");
|
||||||
int error;
|
|
||||||
|
|
||||||
descr = xchk_xfile_ag_descr(sc, "rmap record bag");
|
|
||||||
error = xrep_setup_xfbtree(sc, descr);
|
|
||||||
kfree(descr);
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for any obvious conflicts with this shared/CoW staging extent. */
|
/* Check for any obvious conflicts with this shared/CoW staging extent. */
|
||||||
|
|
@ -704,7 +698,6 @@ xrep_rtrefcountbt(
|
||||||
{
|
{
|
||||||
struct xrep_rtrefc *rr;
|
struct xrep_rtrefc *rr;
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* We require the rmapbt to rebuild anything. */
|
/* We require the rmapbt to rebuild anything. */
|
||||||
|
|
@ -722,11 +715,9 @@ xrep_rtrefcountbt(
|
||||||
rr->sc = sc;
|
rr->sc = sc;
|
||||||
|
|
||||||
/* Set up enough storage to handle one refcount record per rt extent. */
|
/* Set up enough storage to handle one refcount record per rt extent. */
|
||||||
descr = xchk_xfile_ag_descr(sc, "reference count records");
|
error = xfarray_create("realtime reference count records",
|
||||||
error = xfarray_create(descr, mp->m_sb.sb_rextents,
|
mp->m_sb.sb_rextents, sizeof(struct xfs_refcount_irec),
|
||||||
sizeof(struct xfs_refcount_irec),
|
|
||||||
&rr->refcount_records);
|
&rr->refcount_records);
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
goto out_rr;
|
goto out_rr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,14 +103,11 @@ xrep_setup_rtrmapbt(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
struct xrep_rtrmap *rr;
|
struct xrep_rtrmap *rr;
|
||||||
char *descr;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
xchk_fsgates_enable(sc, XCHK_FSGATES_RMAP);
|
xchk_fsgates_enable(sc, XCHK_FSGATES_RMAP);
|
||||||
|
|
||||||
descr = xchk_xfile_rtgroup_descr(sc, "reverse mapping records");
|
error = xrep_setup_xfbtree(sc, "realtime reverse mapping records");
|
||||||
error = xrep_setup_xfbtree(sc, descr);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ xchk_setup_rtsummary(
|
||||||
struct xfs_scrub *sc)
|
struct xfs_scrub *sc)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = sc->mp;
|
struct xfs_mount *mp = sc->mp;
|
||||||
char *descr;
|
|
||||||
struct xchk_rtsummary *rts;
|
struct xchk_rtsummary *rts;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
|
@ -70,10 +69,8 @@ xchk_setup_rtsummary(
|
||||||
* Create an xfile to construct a new rtsummary file. The xfile allows
|
* Create an xfile to construct a new rtsummary file. The xfile allows
|
||||||
* us to avoid pinning kernel memory for this purpose.
|
* us to avoid pinning kernel memory for this purpose.
|
||||||
*/
|
*/
|
||||||
descr = xchk_xfile_descr(sc, "realtime summary file");
|
error = xfile_create("realtime summary file",
|
||||||
error = xfile_create(descr, XFS_FSB_TO_B(mp, mp->m_rsumblocks),
|
XFS_FSB_TO_B(mp, mp->m_rsumblocks), &sc->xfile);
|
||||||
&sc->xfile);
|
|
||||||
kfree(descr);
|
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue