From: tappro Date: Wed, 6 Sep 2006 21:09:57 +0000 (+0000) Subject: - check ft_export exists X-Git-Tag: v1_8_0_110~486^2~1002 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=527b8fa0fac8984a7719eb4de23f455cd46bbe1d;p=fs%2Flustre-release.git - check ft_export exists - fix obd_precleanup/cleanup issues with lu_device handling - small fixes in mdt_handler --- diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index c626b10..b1b66b9 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -334,7 +334,8 @@ void fld_client_fini(struct lu_client_fld *fld) &fld->lcf_targets, ft_chain) { fld->lcf_count--; list_del(&target->ft_chain); - class_export_put(target->ft_exp); + if (target->ft_exp != NULL) + class_export_put(target->ft_exp); OBD_FREE_PTR(target); } spin_unlock(&fld->lcf_lock); diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 7e36cbb..b619a67 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -399,17 +399,18 @@ static inline int obd_precleanup(struct obd_device *obd, #ifdef __KERNEL__ ldt = obd->obd_type->typ_lu; d = obd->obd_lu_dev; - if (ldt != NULL && d != NULL) { - struct lu_context ctx; - - rc = lu_context_init(&ctx, ldt->ldt_ctx_tags); - if (rc == 0) { - lu_context_enter(&ctx); - ldt->ldt_ops->ldto_device_fini(&ctx, d); - lu_context_exit(&ctx); - lu_context_fini(&ctx); - obd->obd_lu_dev = NULL; - rc = 0; + if (ldt != NULL) { + LASSERT(d != NULL); + if (cleanup_stage == OBD_CLEANUP_EXPORTS) { + struct lu_context ctx; + + rc = lu_context_init(&ctx, ldt->ldt_ctx_tags); + if (rc == 0) { + lu_context_enter(&ctx); + ldt->ldt_ops->ldto_device_fini(&ctx, d); + lu_context_exit(&ctx); + lu_context_fini(&ctx); + } } } else #endif @@ -433,8 +434,9 @@ static inline int obd_cleanup(struct obd_device *obd) #ifdef __KERNEL__ ldt = obd->obd_type->typ_lu; d = obd->obd_lu_dev; - if (ldt != NULL && d != NULL) { + if (ldt != NULL) { struct lu_context ctx; + LASSERT(d != NULL); rc = lu_context_init(&ctx, ldt->ldt_ctx_tags); if (rc == 0) { @@ -443,7 +445,6 @@ static inline int obd_cleanup(struct obd_device *obd) lu_context_exit(&ctx); lu_context_fini(&ctx); obd->obd_lu_dev = NULL; - rc = 0; } } else #endif diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 4f90d63..22f6de1 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2499,6 +2499,7 @@ static void mdt_stack_fini(const struct lu_context *ctx, CERROR("Cannot alloc lcfg!\n"); return; } + LASSERT(top); top->ld_ops->ldo_process_config(ctx, top, lcfg); lu_site_purge(ctx, top->ld_site, ~0); @@ -2506,15 +2507,15 @@ static void mdt_stack_fini(const struct lu_context *ctx, struct obd_type *type; struct lu_device_type *ldt = d->ld_type; - lu_device_put(d); - /* each fini() returns next device in stack of layers * * so we can avoid the recursion */ n = ldt->ldt_ops->ldto_device_fini(ctx, d); + lu_device_put(d); ldt->ldt_ops->ldto_device_free(ctx, d); type = ldt->ldt_obd_type; type->typ_refcnt--; class_put_type(type); + /* switch to the next device in the layer */ d = n; } @@ -2635,7 +2636,7 @@ static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m) struct lu_site *ls = d->ld_site; ENTRY; - + target_cleanup_recovery(m->mdt_md_dev.md_lu_dev.ld_obd); mdt_fs_cleanup(ctx, m); ping_evictor_stop(); mdt_stop_ptlrpc_service(m); @@ -3014,13 +3015,12 @@ static int mdt_destroy_export(struct obd_export *export) ENTRY; med = &export->exp_mdt_data; - LASSERT(mdt); target_destroy_export(export); if (obd_uuid_equals(&export->exp_client_uuid, &obd->obd_uuid)) RETURN(0); - + LASSERT(mdt != NULL); rc = lu_context_init(&ctxt, LCT_MD_THREAD); if (rc) RETURN(rc);