Whamcloud - gitweb
LU-7077 target: avoid using possible error return NULL pointer 73/16473/5
authorBob Glossman <bob.glossman@intel.com>
Thu, 17 Sep 2015 19:05:02 +0000 (12:05 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 19 Nov 2015 22:03:31 +0000 (22:03 +0000)
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 <bob.glossman@intel.com>
Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: Ic6132b5450534db0bb9b89c3dd6f55517450c42a
Reviewed-on: http://review.whamcloud.com/16473
Tested-by: Jenkins
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/obdclass/genops.c

index 3d0b310..14e0344 100644 (file)
@@ -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);