From 421b3449c34e336b0683538a7f95e03b0fd082dc Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Sat, 28 Aug 2004 11:58:55 +1000 Subject: [PATCH] [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: Nathan Scott --- fs/xfs/xfs_fsops.c | 6 +++++- fs/xfs/xfs_mount.c | 10 +++++----- fs/xfs/xfs_mount.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 4736fc4eaeed7..4e4e966d17ac3 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -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); diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 6bbcd7bd68b8c..9c8e7c5a7e512 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -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 diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index f51ec12968d08..c194b8ef03aa4 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -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); -- 2.53.0