From 94fc345399b3cd94a96aa4b3f607f2dc9d669a98 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Fri, 2 Feb 2018 23:00:15 +0800 Subject: [PATCH] LU-8990 lod: put root at cleanup '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 Change-Id: I6f1ab0ba149ccf95279c1182c90a5588607ad8fa Reviewed-on: https://review.whamcloud.com/31143 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/lod/lod_dev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index 8c98137..0c2ddcb 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -1045,11 +1045,6 @@ static int lod_process_config(const struct lu_env *env, 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; @@ -1064,6 +1059,11 @@ static int lod_process_config(const struct lu_env *env, 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 @@ -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; + 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); -- 1.8.3.1