Whamcloud - gitweb
LU-919 obdclass: remove hard coded 0x5a5a5a
authorNiu Yawei <niu@whamcloud.com>
Wed, 11 Jan 2012 04:24:59 +0000 (20:24 -0800)
committerJohann Lombardi <johann@whamcloud.com>
Wed, 29 Aug 2012 16:19:37 +0000 (12:19 -0400)
We assert atomic_t value with hard coded 0x5a5a5a in several places,
which could result in false assertion failure when the reference count
getting very large in some extreme case.

The hard coded 0x5a5a5a should be replaced by LI_POISON.

Signed-off-by: Bruno Faccini <bruno.faccini@bull.net>
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ia1105e48326c20a37d887ba9dc926ea300d97741
Reviewed-on: http://review.whamcloud.com/1954
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/include/lustre_log.h
lustre/include/obd_class.h
lustre/obdclass/genops.c

index 23a036a..90b0df6 100644 (file)
@@ -406,7 +406,7 @@ do {                                                                        \
          if ((ctxt) == NULL)                                                \
                  break;                                                     \
          LASSERT(atomic_read(&(ctxt)->loc_refcount) > 0);                   \
-         LASSERT(atomic_read(&(ctxt)->loc_refcount) < 0x5a5a5a);            \
+         LASSERT(atomic_read(&(ctxt)->loc_refcount) < LI_POISON);           \
          CDEBUG(D_INFO, "PUTting ctxt %p : new refcount %d\n", (ctxt),      \
                 atomic_read(&(ctxt)->loc_refcount) - 1);                    \
          __llog_ctxt_put(ctxt);                                             \
index 5a37b56..3cb7584 100644 (file)
@@ -202,7 +202,7 @@ do {                                                                           \
         CDEBUG(D_INFO, "PUTting export %p : new refcount %d\n", (exp),         \
                atomic_read(&(exp)->exp_refcount) - 1);                         \
         LASSERT(atomic_read(&(exp)->exp_refcount) > 0);                        \
-        LASSERT(atomic_read(&(exp)->exp_refcount) < 0x5a5a5a);                 \
+        LASSERT(atomic_read(&(exp)->exp_refcount) < LI_POISON);                \
         __class_export_put(exp);                                               \
 } while (0)
 
index 9406341..ab61bbc 100644 (file)
@@ -800,7 +800,7 @@ static void import_handle_addref(void *import)
 struct obd_import *class_import_get(struct obd_import *import)
 {
         LASSERT(atomic_read(&import->imp_refcount) >= 0);
-        LASSERT(atomic_read(&import->imp_refcount) < 0x5a5a5a);
+        LASSERT(atomic_read(&import->imp_refcount) < LI_POISON);
         atomic_inc(&import->imp_refcount);
         CDEBUG(D_INFO, "import %p refcount=%d obd=%s\n", import,
                atomic_read(&import->imp_refcount), 
@@ -814,7 +814,7 @@ void class_import_put(struct obd_import *import)
         ENTRY;
 
         LASSERT(atomic_read(&import->imp_refcount) > 0);
-        LASSERT(atomic_read(&import->imp_refcount) < 0x5a5a5a);
+        LASSERT(atomic_read(&import->imp_refcount) < LI_POISON);
         LASSERT(list_empty(&import->imp_zombie_chain));
 
         CDEBUG(D_INFO, "import %p refcount=%d obd=%s\n", import,