Whamcloud - gitweb
LU-2726 procfs: Invalid assertion for counter_{add,sub}
authorBobi Jam <bobijam.xu@intel.com>
Fri, 1 Feb 2013 01:47:33 +0000 (09:47 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 7 Feb 2013 02:17:27 +0000 (21:17 -0500)
lprocfs_stats::lc_sum_irq is only used for obd_memory for accurate
memory usage counting, other procfs stats counters do not need it,
even though they can be used in RCU callbacks.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: I4c2dec50eecc0c63631f1915ba30a54a5da2fec1
Reviewed-on: http://review.whamcloud.com/5237
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John Hammond <johnlockwoodhammond@gmail.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lvfs/lvfs_lib.c

index 04f87ba..82e930b 100644 (file)
@@ -81,9 +81,6 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
        if (stats == NULL)
                return;
 
-       LASSERT(ergo((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) == 0,
-                    !cfs_in_interrupt()));
-
        /* With per-client stats, statistics are allocated only for
         * single CPU area, so the smp_id should be 0 always. */
        smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID, &flags);
@@ -100,8 +97,13 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
                 * as memory allocation could trigger memory shrinker call
                 * ldlm_pool_shrink(), which calls lprocfs_counter_add().
                 * LU-1727.
+                *
+                * Only obd_memory uses LPROCFS_STATS_FLAG_IRQ_SAFE
+                * flag, because it needs accurate counting lest memory leak
+                * check reports error.
                 */
-               if (cfs_in_interrupt())
+               if (cfs_in_interrupt() &&
+                   (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
                        percpu_cntr->lc_sum_irq += amount;
                else
                        percpu_cntr->lc_sum += amount;
@@ -127,9 +129,6 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
        if (stats == NULL)
                return;
 
-       LASSERT(ergo((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) == 0,
-                    !cfs_in_interrupt()));
-
        /* With per-client stats, statistics are allocated only for
         * single CPU area, so the smp_id should be 0 always. */
        smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID, &flags);
@@ -145,8 +144,13 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
                 * softirq context - right now that's the only case we're in
                 * softirq context here, use separate counter for that.
                 * bz20650.
+                *
+                * Only obd_memory uses LPROCFS_STATS_FLAG_IRQ_SAFE
+                * flag, because it needs accurate counting lest memory leak
+                * check reports error.
                 */
-               if (cfs_in_interrupt())
+               if (cfs_in_interrupt() &&
+                   (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0)
                        percpu_cntr->lc_sum_irq -= amount;
                else
                        percpu_cntr->lc_sum -= amount;