GOTO(err_put, rc = PTR_ERR(obd->obd_fsops));
/* namespace for mgs llog */
- obd->obd_namespace = ldlm_namespace_new("MGS", LDLM_NAMESPACE_SERVER);
- if (obd->obd_namespace == NULL) {
- mgs_cleanup(obd);
+ obd->obd_namespace = ldlm_namespace_new("MGS", LDLM_NAMESPACE_SERVER,
+ LDLM_NAMESPACE_MODEST);
+ if (obd->obd_namespace == NULL)
GOTO(err_ops, rc = -ENOMEM);
- }
/* ldlm setup */
ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
struct mgs_obd *mgs = &obd->u.mgs;
ENTRY;
- ping_evictor_stop();
-
if (mgs->mgs_sb == NULL)
RETURN(0);
+ ping_evictor_stop();
+
ptlrpc_unregister_service(mgs->mgs_service);
mgs_cleanup_fsdb_list(obd);
int rc, flags = 0;
ENTRY;
- rc = mgc_logname2resid(fsname, &res_id);
+ rc = mgc_fsname2resid(fsname, &res_id);
if (!rc)
rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id,
LDLM_PLAIN, NULL, LCK_EX,
/* Log writing contention is handled by the fsdb_sem */
if (mti->mti_flags & LDD_F_WRITECONF) {
- if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
+ if (mti->mti_flags & LDD_F_SV_TYPE_MDT &&
+ mti->mti_stripe_index == 0) {
rc = mgs_erase_logs(obd, mti->mti_fsname);
LCONSOLE_WARN("%s: Logs for fs %s were removed by user "
"request. All servers must be restarted "
"in order to regenerate the logs."
"\n", obd->obd_name, mti->mti_fsname);
- } else if (mti->mti_flags & LDD_F_SV_TYPE_OST) {
+ } else if (mti->mti_flags &
+ (LDD_F_SV_TYPE_OST | LDD_F_SV_TYPE_MDT)) {
rc = mgs_erase_log(obd, mti->mti_svname);
LCONSOLE_WARN("%s: Regenerating %s log by user "
"request.\n",
RETURN(rc);
}
+static int mgs_set_info_rpc(struct ptlrpc_request *req)
+{
+ struct obd_device *obd = req->rq_export->exp_obd;
+ struct mgs_send_param *msp, *rep_msp;
+ struct lustre_handle lockh;
+ int rep_size[] = { sizeof(struct ptlrpc_body), sizeof(*msp) };
+ int lockrc, rc;
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
+ char fsname[MTI_NAME_MAXLEN];
+ ENTRY;
+
+ msp = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*msp), NULL);
+
+ /* Construct lustre_cfg structure to pass to function mgs_setparam */
+ lustre_cfg_bufs_reset(&bufs, NULL);
+ lustre_cfg_bufs_set_string(&bufs, 1, msp->mgs_param);
+ lcfg = lustre_cfg_new(LCFG_PARAM, &bufs);
+ rc = mgs_setparam(obd, lcfg, fsname);
+ if (rc) {
+ CERROR("Error %d in setting the parameter %s for fs %s\n",
+ rc, msp->mgs_param, fsname);
+ RETURN(rc);
+ }
+
+ /* Revoke lock so everyone updates. Should be alright if
+ * someone was already reading while we were updating the logs,
+ * so we don't really need to hold the lock while we're
+ * writing.
+ */
+ if (fsname[0]) {
+ lockrc = mgs_get_cfg_lock(obd, fsname, &lockh);
+ if (lockrc != ELDLM_OK)
+ CERROR("lock error %d for fs %s\n", lockrc,
+ fsname);
+ else
+ mgs_put_cfg_lock(&lockh);
+ }
+ lustre_cfg_free(lcfg);
+
+ lustre_pack_reply(req, 2, rep_size, NULL);
+ rep_msp = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
+ sizeof(*rep_msp));
+ memcpy(rep_msp, msp, sizeof(*rep_msp));
+
+ RETURN(rc);
+}
+
int mgs_handle(struct ptlrpc_request *req)
{
int fail = OBD_FAIL_MGS_ALL_REPLY_NET;
DEBUG_REQ(D_MGS, req, "target del");
//rc = mgs_handle_target_del(req);
break;
+ case MGS_SET_INFO:
+ rc = mgs_set_info_rpc(req);
+ break;
case LDLM_ENQUEUE:
DEBUG_REQ(D_MGS, req, "enqueue");