Commit 421b3449 authored by Nathan Scott's avatar Nathan Scott Committed by Nathan Scott

[XFS] Ensure maxagi not updated early during growfs, conflicts with

concurrent inode allocations.  Fix from ASANO Masahiro.

SGI Modid: xfs-linux:xfs-kern:177699a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 5dec14bf
......@@ -142,6 +142,7 @@ xfs_growfs_data_private(
int dpct;
int error;
xfs_agnumber_t nagcount;
xfs_agnumber_t nagimax = 0;
xfs_rfsblock_t nb, nb_mod;
xfs_rfsblock_t new;
xfs_rfsblock_t nfree;
......@@ -183,7 +184,7 @@ xfs_growfs_data_private(
memset(&mp->m_perag[oagcount], 0,
(nagcount - oagcount) * sizeof(xfs_perag_t));
mp->m_flags |= XFS_MOUNT_32BITINODES;
xfs_initialize_perag(mp, nagcount);
nagimax = xfs_initialize_perag(mp, nagcount);
up_write(&mp->m_peraglock);
}
tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS);
......@@ -372,6 +373,9 @@ xfs_growfs_data_private(
if (error) {
return error;
}
/* New allocation groups fully initialized, so update mount struct */
if (nagimax)
mp->m_maxagi = nagimax;
if (mp->m_sb.sb_imax_pct) {
__uint64_t icount = mp->m_sb.sb_dblocks * mp->m_sb.sb_imax_pct;
do_div(icount, 100);
......
......@@ -318,10 +318,10 @@ xfs_mount_validate_sb(
return 0;
}
void
xfs_initialize_perag(xfs_mount_t *mp, int agcount)
xfs_agnumber_t
xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount)
{
int index, max_metadata;
xfs_agnumber_t index, max_metadata;
xfs_perag_t *pag;
xfs_agino_t agino;
xfs_ino_t ino;
......@@ -377,7 +377,7 @@ xfs_initialize_perag(xfs_mount_t *mp, int agcount)
pag->pagi_inodeok = 1;
}
}
mp->m_maxagi = index;
return index;
}
/*
......@@ -951,7 +951,7 @@ xfs_mountfs(
mp->m_perag =
kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t), KM_SLEEP);
xfs_initialize_perag(mp, sbp->sb_agcount);
mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount);
/*
* log's mount-time initialization. Perform 1st part recovery if needed
......
......@@ -551,7 +551,7 @@ extern int xfs_readsb(xfs_mount_t *mp);
extern void xfs_freesb(xfs_mount_t *);
extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int);
extern int xfs_syncsub(xfs_mount_t *, int, int, int *);
extern void xfs_initialize_perag(xfs_mount_t *, int);
extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t);
extern void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t,
__int64_t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment