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 | |
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')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 23 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 2 |
3 files changed, 23 insertions, 5 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 61a29e1191a8..ca74d3f5910e 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -3848,6 +3848,9 @@ xlog_do_recover( | |||
3848 | ASSERT(XFS_SB_GOOD_VERSION(sbp)); | 3848 | ASSERT(XFS_SB_GOOD_VERSION(sbp)); |
3849 | xfs_buf_relse(bp); | 3849 | xfs_buf_relse(bp); |
3850 | 3850 | ||
3851 | /* We've re-read the superblock so re-initialize per-cpu counters */ | ||
3852 | xfs_icsb_reinit_counters(log->l_mp); | ||
3853 | |||
3851 | xlog_recover_check_summary(log); | 3854 | xlog_recover_check_summary(log); |
3852 | 3855 | ||
3853 | /* Normal transactions can now occur */ | 3856 | /* Normal transactions can now occur */ |
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) |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index eb94b977f84c..82304b94646d 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -307,10 +307,12 @@ typedef struct xfs_icsb_cnts { | |||
307 | #define XFS_ICSB_LAZY_COUNT (1 << 1) /* accuracy not needed */ | 307 | #define XFS_ICSB_LAZY_COUNT (1 << 1) /* accuracy not needed */ |
308 | 308 | ||
309 | extern int xfs_icsb_init_counters(struct xfs_mount *); | 309 | extern int xfs_icsb_init_counters(struct xfs_mount *); |
310 | extern void xfs_icsb_reinit_counters(struct xfs_mount *); | ||
310 | extern void xfs_icsb_sync_counters_flags(struct xfs_mount *, int); | 311 | extern void xfs_icsb_sync_counters_flags(struct xfs_mount *, int); |
311 | 312 | ||
312 | #else | 313 | #else |
313 | #define xfs_icsb_init_counters(mp) (0) | 314 | #define xfs_icsb_init_counters(mp) (0) |
315 | #define xfs_icsb_reinit_counters(mp) do { } while (0) | ||
314 | #define xfs_icsb_sync_counters_flags(mp, flags) do { } while (0) | 316 | #define xfs_icsb_sync_counters_flags(mp, flags) do { } while (0) |
315 | #endif | 317 | #endif |
316 | 318 | ||