From 15133066c209254282e5e4bc3b84f44e7c2c4f24 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Tue, 10 Jan 2012 20:24:59 -0800 Subject: [PATCH] LU-919 obdclass: remove hard coded 0x5a5a5a 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 Signed-off-by: Niu Yawei Change-Id: Ia1105e48326c20a37d887ba9dc926ea300d97741 Reviewed-on: http://review.whamcloud.com/1954 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Johann Lombardi --- lustre/include/lustre_log.h | 2 +- lustre/include/obd_class.h | 2 +- lustre/obdclass/genops.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index 23a036a..90b0df6 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -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); \ diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 5a37b56..3cb7584 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -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) diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 9406341..ab61bbc 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -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, -- 1.8.3.1