Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5478eead8528f6cb5ebe3015fb88b68b175e1093
Commit:     5478eead8528f6cb5ebe3015fb88b68b175e1093
Parent:     c97be736051dacefb00643095d76fd5b70dfef7b
Author:     Lachlan McIlroy <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 10 18:36:29 2007 +1100
Committer:  Tim Shimmin <[EMAIL PROTECTED]>
CommitDate: Sat Feb 10 18:36:29 2007 +1100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: David Chinner <[EMAIL PROTECTED]>
    Signed-off-by: Tim Shimmin <[EMAIL PROTECTED]>
---
 fs/xfs/xfs_log_recover.c |    3 +++
 fs/xfs/xfs_mount.c       |   23 ++++++++++++++++++-----
 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 61a29e1..ca74d3f 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3848,6 +3848,9 @@ xlog_do_recover(
        ASSERT(XFS_SB_GOOD_VERSION(sbp));
        xfs_buf_relse(bp);
 
+       /* We've re-read the superblock so re-initialize per-cpu counters */
+       xfs_icsb_reinit_counters(log->l_mp);
+
        xlog_recover_check_summary(log);
 
        /* Normal transactions can now occur */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 30a5781..3bed0cf 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)
                ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
        }
 
-       xfs_icsb_lock(mp);
-       xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0);
-       xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0);
-       xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0);
-       xfs_icsb_unlock(mp);
+       /* Initialize per-cpu counters */
+       xfs_icsb_reinit_counters(mp);
 
        mp->m_sb_bp = bp;
        xfs_buf_relse(bp);
@@ -1811,6 +1808,22 @@ xfs_icsb_init_counters(
        return 0;
 }
 
+void
+xfs_icsb_reinit_counters(
+       xfs_mount_t     *mp)
+{
+       xfs_icsb_lock(mp);
+       /*
+        * start with all counters disabled so that the
+        * initial balance kicks us off correctly
+        */
+       mp->m_icsb_counters = -1;
+       xfs_icsb_balance_counter(mp, XFS_SBS_ICOUNT, 0, 0);
+       xfs_icsb_balance_counter(mp, XFS_SBS_IFREE, 0, 0);
+       xfs_icsb_balance_counter(mp, XFS_SBS_FDBLOCKS, 0, 0);
+       xfs_icsb_unlock(mp);
+}
+
 STATIC void
 xfs_icsb_destroy_counters(
        xfs_mount_t     *mp)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index eb94b97..82304b9 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -307,10 +307,12 @@ typedef struct xfs_icsb_cnts {
 #define XFS_ICSB_LAZY_COUNT    (1 << 1)        /* accuracy not needed */
 
 extern int     xfs_icsb_init_counters(struct xfs_mount *);
+extern void    xfs_icsb_reinit_counters(struct xfs_mount *);
 extern void    xfs_icsb_sync_counters_flags(struct xfs_mount *, int);
 
 #else
 #define xfs_icsb_init_counters(mp)     (0)
+#define xfs_icsb_reinit_counters(mp)   do { } while (0)
 #define xfs_icsb_sync_counters_flags(mp, flags)        do { } while (0)
 #endif
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to