diff options
author | Lachlan McIlroy <lachlan@sgi.com> | 2007-02-10 02:36:29 -0500 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2007-02-10 02:36:29 -0500 |
commit | 5478eead8528f6cb5ebe3015fb88b68b175e1093 (patch) | |
tree | 13a5a0f48f25ef5fd77fe6b1ca8e062be94fc8f4 /fs/xfs/xfs_mount.c | |
parent | c97be736051dacefb00643095d76fd5b70dfef7b (diff) |
[XFS] Re-initialize the per-cpu superblock counters after recovery.
After filesystem recovery the superblock is re-read to bring in any
changes. If the per-cpu superblock counters are not re-initialized from
the superblock then the next time the per-cpu counters are disabled they
might overwrite the global counter with a bogus value.
SGI-PV: 957348
SGI-Modid: xfs-linux-melb:xfs-kern:27999a
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 30a5781a46d4..3bed0cf0d8af 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -543,11 +543,8 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
543 | ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); | 543 | ASSERT(XFS_BUF_VALUSEMA(bp) <= 0); |
544 | } | 544 | } |
545 | 545 | ||
546 | xfs_icsb_lock(mp); | 546 | /* Initialize per-cpu counters */ |
547 | xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0); | 547 | xfs_icsb_reinit_counters(mp); |
548 | xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0); | ||
549 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0); | ||
550 | xfs_icsb_unlock(mp); | ||
551 | 548 | ||
552 | mp->m_sb_bp = bp; | 549 | mp->m_sb_bp = bp; |
553 | xfs_buf_relse(bp); | 550 | xfs_buf_relse(bp); |
@@ -1811,6 +1808,22 @@ xfs_icsb_init_counters( | |||
1811 | return 0; | 1808 | return 0; |
1812 | } | 1809 | } |
1813 | 1810 | ||
1811 | void | ||
1812 | xfs_icsb_reinit_counters( | ||
1813 | xfs_mount_t *mp) | ||
1814 | { | ||
1815 | xfs_icsb_lock(mp); | ||
1816 | /* | ||
1817 | * start with all counters disabled so that the | ||
1818 | * initial balance kicks us off correctly | ||
1819 | */ | ||
1820 | mp->m_icsb_counters = -1; | ||
1821 | xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0); | ||
1822 | xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0); | ||
1823 | xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0); | ||
1824 | xfs_icsb_unlock(mp); | ||
1825 | } | ||
1826 | |||
1814 | STATIC void | 1827 | STATIC void |
1815 | xfs_icsb_destroy_counters( | 1828 | xfs_icsb_destroy_counters( |
1816 | xfs_mount_t *mp) | 1829 | xfs_mount_t *mp) |