static int mds_lov_clean(struct obd_device *obd) { struct mds_obd *mds = &obd->u.mds; struct obd_device *osc = mds->mds_lov_obd; ENTRY; if (mds->mds_profile) { class_del_profile(mds->mds_profile); OBD_FREE(mds->mds_profile, strlen(mds->mds_profile) + 1); mds->mds_profile = NULL; } /* There better be a lov */ if (!osc) RETURN(0); if (IS_ERR(osc)) RETURN(PTR_ERR(osc)); obd_register_observer(osc, NULL); /* Give lov our same shutdown flags */ osc->obd_force = obd->obd_force; osc->obd_fail = obd->obd_fail; /* Cleanup the lov */ obd_disconnect(mds->mds_lov_exp); class_manual_cleanup(osc); RETURN(0); }
/* * obd_disconnect handler used by the MDT to disconnect from the master target. * We trigger cleanup on disconnect since it means that the MDT is about to * shutdown. */ static int qmt_device_obd_disconnect(struct obd_export *exp) { struct obd_device *obd = exp->exp_obd; int rc; ENTRY; rc = class_disconnect(exp); if (rc) RETURN(rc); rc = class_manual_cleanup(obd); RETURN(0); }
/* * once last export (we don't count self-export) disappeared * mdd can be released */ static int mdd_obd_disconnect(struct obd_export *exp) { struct obd_device *obd = exp->exp_obd; struct mdd_device *mdd = lu2mdd_dev(obd->obd_lu_dev); int rc, release = 0; ENTRY; mdd->mdd_connects--; if (mdd->mdd_connects == 0) release = 1; rc = class_disconnect(exp); if (rc == 0 && release) class_manual_cleanup(obd); RETURN(rc); }
static int lustre_stop_mgc(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); struct obd_device *obd; char *niduuid = 0, *ptr = 0; int i, rc = 0, len = 0; if (!lsi) return -ENOENT; obd = lsi->lsi_mgc; if (!obd) return -ENOENT; lsi->lsi_mgc = NULL; mutex_lock(&mgc_start_lock); LASSERT(atomic_read(&obd->u.cli.cl_mgc_refcount) > 0); if (!atomic_dec_and_test(&obd->u.cli.cl_mgc_refcount)) { /* This is not fatal, every client that stops will call in here. */ CDEBUG(D_MOUNT, "mgc still has %d references.\n", atomic_read(&obd->u.cli.cl_mgc_refcount)); GOTO(out, rc = -EBUSY); } /* The MGC has no recoverable data in any case. * force shotdown set in umount_begin */ obd->obd_no_recov = 1; if (obd->u.cli.cl_mgc_mgsexp) { /* An error is not fatal, if we are unable to send the disconnect mgs ping evictor cleans up the export */ rc = obd_disconnect(obd->u.cli.cl_mgc_mgsexp); if (rc) CDEBUG(D_MOUNT, "disconnect failed %d\n", rc); } /* Save the obdname for cleaning the nid uuids, which are obdname_XX */ len = strlen(obd->obd_name) + 6; OBD_ALLOC(niduuid, len); if (niduuid) { strcpy(niduuid, obd->obd_name); ptr = niduuid + strlen(niduuid); } rc = class_manual_cleanup(obd); if (rc) GOTO(out, rc); /* Clean the nid uuids */ if (!niduuid) GOTO(out, rc = -ENOMEM); for (i = 0; i < lsi->lsi_lmd->lmd_mgs_failnodes; i++) { sprintf(ptr, "_%x", i); rc = do_lcfg(LUSTRE_MGC_OBDNAME, 0, LCFG_DEL_UUID, niduuid, 0, 0, 0); if (rc) CERROR("del MDC UUID %s failed: rc = %d\n", niduuid, rc); } out: if (niduuid) OBD_FREE(niduuid, len); /* class_import_put will get rid of the additional connections */ mutex_unlock(&mgc_start_lock); return rc; }