Whamcloud - gitweb
LU-8990 lod: put root at cleanup 43/31143/3
authorLai Siyao <lai.siyao@intel.com>
Fri, 2 Feb 2018 15:00:15 +0000 (23:00 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 27 Feb 2018 03:42:04 +0000 (03:42 +0000)
'lod_md_root' was put at precleanup, but soak test shows there exists
race, and some ongoing request may re-initialize it, move this put
to cleanup.

Also add debug code to dump remaining objects if lod device is still
referenced at lod_device_free().

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: I6f1ab0ba149ccf95279c1182c90a5588607ad8fa
Reviewed-on: https://review.whamcloud.com/31143
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_dev.c

index 8c98137..0c2ddcb 100644 (file)
@@ -1045,11 +1045,6 @@ static int lod_process_config(const struct lu_env *env,
                GOTO(out, rc);
        }
        case LCFG_PRE_CLEANUP: {
                GOTO(out, rc);
        }
        case LCFG_PRE_CLEANUP: {
-               if (lod->lod_md_root != NULL) {
-                       dt_object_put(env, &lod->lod_md_root->ldo_obj);
-                       lod->lod_md_root = NULL;
-               }
-
                lod_sub_process_config(env, lod, &lod->lod_mdt_descs, lcfg);
                lod_sub_process_config(env, lod, &lod->lod_ost_descs, lcfg);
                next = &lod->lod_child->dd_lu_dev;
                lod_sub_process_config(env, lod, &lod->lod_mdt_descs, lcfg);
                lod_sub_process_config(env, lod, &lod->lod_ost_descs, lcfg);
                next = &lod->lod_child->dd_lu_dev;
@@ -1064,6 +1059,11 @@ static int lod_process_config(const struct lu_env *env,
                break;
        }
        case LCFG_CLEANUP: {
                break;
        }
        case LCFG_CLEANUP: {
+               if (lod->lod_md_root != NULL) {
+                       dt_object_put(env, &lod->lod_md_root->ldo_obj);
+                       lod->lod_md_root = NULL;
+               }
+
                /*
                 * do cleanup on underlying storage only when
                 * all OSPs are cleaned up, as they use that OSD as well
                /*
                 * do cleanup on underlying storage only when
                 * all OSPs are cleaned up, as they use that OSD as well
@@ -1684,6 +1684,11 @@ static struct lu_device *lod_device_free(const struct lu_env *env,
        struct lu_device  *next = &lod->lod_child->dd_lu_dev;
        ENTRY;
 
        struct lu_device  *next = &lod->lod_child->dd_lu_dev;
        ENTRY;
 
+       if (atomic_read(&lu->ld_ref) > 0 &&
+           !cfs_hash_is_empty(lu->ld_site->ls_obj_hash)) {
+               LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL);
+               lu_site_print(env, lu->ld_site, &msgdata, lu_cdebug_printer);
+       }
        LASSERTF(atomic_read(&lu->ld_ref) == 0, "lu is %p\n", lu);
        dt_device_fini(&lod->lod_dt_dev);
        OBD_FREE_PTR(lod);
        LASSERTF(atomic_read(&lu->ld_ref) == 0, "lu is %p\n", lu);
        dt_device_fini(&lod->lod_dt_dev);
        OBD_FREE_PTR(lod);