&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);
#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
#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) {
lu_context_exit(&ctx);
lu_context_fini(&ctx);
obd->obd_lu_dev = NULL;
- rc = 0;
}
} else
#endif
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);
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;
}
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);
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);