From a7eface85ea2d2aa6198681264b082a0244855d4 Mon Sep 17 00:00:00 2001 From: Bob Glossman Date: Thu, 17 Sep 2015 12:05:02 -0700 Subject: [PATCH] LU-7077 target: avoid using possible error return NULL pointer previous fix http://review.whamcloud.com/15576 added a call to cfs_hash_getref(). add LASSERT() to ensure the can never happen here return value of NULL is in fact never seen. Signed-off-by: Bob Glossman Signed-off-by: Di Wang Change-Id: Ic6132b5450534db0bb9b89c3dd6f55517450c42a Reviewed-on: http://review.whamcloud.com/16473 Tested-by: Jenkins Reviewed-by: Dmitry Eremin Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/obdclass/genops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 3d0b310..14e0344 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -944,7 +944,10 @@ void class_unlink_export(struct obd_export *exp) struct tg_export_data *ted = &exp->exp_target_data; struct cfs_hash *hash; + /* Because obd_gen_hash will not be released until + * class_cleanup(), so hash should never be NULL here */ hash = cfs_hash_getref(exp->exp_obd->obd_gen_hash); + LASSERT(hash != NULL); cfs_hash_del(hash, &ted->ted_lcd->lcd_generation, &exp->exp_gen_hash); cfs_hash_putref(hash); -- 1.8.3.1