From: Niu Yawei Date: Wed, 11 Jan 2012 03:59:10 +0000 (-0800) Subject: LU-919 obdclass: remove hard coded 0x5a5a5a X-Git-Tag: 2.1.55~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=afe043c883c7b833a702dfe00d3814f0e18d3942 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: Idc271621017d071b3e2dce5d0ec6fb854127a955 Reviewed-on: http://review.whamcloud.com/1953 Reviewed-by: Lai Siyao Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index 54f3f04..fef7a4c 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -445,7 +445,7 @@ static inline void llog_ctxt_put(struct llog_ctxt *ctxt) { if (ctxt == NULL) return; - LASSERT_ATOMIC_GT_LT(&ctxt->loc_refcount, 0, 0x5a5a5a); + LASSERT_ATOMIC_GT_LT(&ctxt->loc_refcount, 0, LI_POISON); CDEBUG(D_INFO, "PUTting ctxt %p : new refcount %d\n", ctxt, cfs_atomic_read(&ctxt->loc_refcount) - 1); __llog_ctxt_put(ctxt); diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 59ab55e..6921762 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -777,7 +777,7 @@ EXPORT_SYMBOL(class_export_get); void class_export_put(struct obd_export *exp) { LASSERT(exp != NULL); - LASSERT_ATOMIC_GT_LT(&exp->exp_refcount, 0, 0x5a5a5a); + LASSERT_ATOMIC_GT_LT(&exp->exp_refcount, 0, LI_POISON); CDEBUG(D_INFO, "PUTting export %p : new refcount %d\n", exp, cfs_atomic_read(&exp->exp_refcount) - 1); @@ -953,7 +953,7 @@ void class_import_put(struct obd_import *imp) ENTRY; LASSERT(cfs_list_empty(&imp->imp_zombie_chain)); - LASSERT_ATOMIC_GE_LT(&imp->imp_refcount, 0, 0x5a5a5a); + LASSERT_ATOMIC_GT_LT(&imp->imp_refcount, 0, LI_POISON); CDEBUG(D_INFO, "import %p refcount=%d obd=%s\n", imp, cfs_atomic_read(&imp->imp_refcount) - 1, diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c index 1c8eccf..23487ae 100644 --- a/lustre/obdclass/llog_obd.c +++ b/lustre/obdclass/llog_obd.c @@ -136,7 +136,7 @@ int llog_cleanup(struct llog_ctxt *ctxt) /* * Banlance the ctxt get when calling llog_cleanup() */ - LASSERT(cfs_atomic_read(&ctxt->loc_refcount) < 0x5a5a5a); + LASSERT(cfs_atomic_read(&ctxt->loc_refcount) < LI_POISON); LASSERT(cfs_atomic_read(&ctxt->loc_refcount) > 1); llog_ctxt_put(ctxt);