__u32 mti_stripe_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */
__u64 mti_stripe_size;
__u64 mti_stripe_offset;
- __u32 mti_rc; /* return code from MGS */
};
extern void lustre_swab_mgmt_target_info(struct mgmt_target_info *oinfo);
struct osc_creator cl_oscc;
/* mgc datastruct */
struct semaphore cl_mgc_sem;
- struct mgc_rpc_lock *cl_mgc_rpc_lock;
struct vfsmount *cl_mgc_vfsmnt;
struct super_block *cl_mgc_sb;
struct dentry *cl_mgc_configs_dir;
#ifndef MGC_INTERNAL_H
#define MGC_INTERNAL_H
-struct mgc_rpc_lock {
- struct semaphore rpcl_sem;
-};
-
-static inline void mgc_init_rpc_lock(struct mgc_rpc_lock *lck)
-{
- sema_init(&lck->rpcl_sem, 1);
-}
#endif
if (!rc) {
rep_mti = lustre_swab_repbuf(req, 0, sizeof(*rep_mti),
lustre_swab_mgmt_target_info);
- if (mti->mti_rc) {
- CERROR ("target_add failed. rc=%d\n", mti->mti_rc);
- GOTO (out, rc = mti->mti_rc);
- }
memcpy(mti, rep_mti, sizeof(*rep_mti));
CDEBUG(D_MGC, "target_add %s got index = %d\n",
mti->mti_svname, mti->mti_stripe_index);
+ } else {
+ CERROR("target_add failed. rc=%d\n", rc);
}
-out:
ptlrpc_req_finished(req);
RETURN(rc);
struct client_obd *cli = &obd->u.cli;
int rc;
- //lprocfs_obd_cleanup(obd);
-
/* FIXME calls to mgc_fs_setup must take an obd ref to insure there's
no fs by the time we get here. */
LASSERT(cli->cl_mgc_vfsmnt == NULL);
ptlrpcd_decref();
- OBD_FREE(cli->cl_mgc_rpc_lock, sizeof (*cli->cl_mgc_rpc_lock));
-
return client_obd_cleanup(obd);
}
-/* the same as mdc_setup */
static int mgc_setup(struct obd_device *obd, obd_count len, void *buf)
{
- struct client_obd *cli = &obd->u.cli;
int rc;
ENTRY;
- OBD_ALLOC(cli->cl_mgc_rpc_lock, sizeof (*cli->cl_mgc_rpc_lock));
- if (!cli->cl_mgc_rpc_lock)
- RETURN(-ENOMEM);
- mgc_init_rpc_lock(cli->cl_mgc_rpc_lock);
-
ptlrpcd_addref();
rc = client_obd_setup(obd, len, buf);
if (rc)
- GOTO(err_rpc_lock, rc);
+ GOTO(err_decref, rc);
rc = obd_llog_init(obd, obd, 0, NULL);
if (rc) {
CERROR("failed to setup llogging subsystems\n");
- GOTO(err_rpc_lock, rc);
+ GOTO(err_cleanup, rc);
}
-#if 0
- struct lustre_mount_info *lmi;
- /* FIXME There's only one mgc for all local servers. Must mgc_fs_setup
- on demand only when reading a local log file, then cleanup.
- Make sure there's a lock so nobody else can mgc_fs_setup in the
- meantime */
- lmi = lustre_get_mount(obd->obd_name);
- if (lmi) {
- CERROR("mgc has local disk\n");
- /* there's a local disk, we must get access */
- rc = mgc_fs_setup(obd, lmi->lmi_sb, lmi->lmi_mnt);
- if (rc) {
- CERROR("fs setup failed %d\n", rc);
- mgc_cleanup(obd);
- RETURN(-ENOENT);
- }
- }
- else
- CERROR("mgc does not have local disk (client only)\n");
-#endif
-
- INIT_LIST_HEAD(&cli->cl_mgc_open_llogs);
-
RETURN(rc);
-err_rpc_lock:
+err_cleanup:
+ client_obd_cleanup(obd);
+err_decref:
ptlrpcd_decref();
- OBD_FREE(cli->cl_mgc_rpc_lock, sizeof (*cli->cl_mgc_rpc_lock));
RETURN(rc);
}
if (mgs->mgs_sb == NULL)
RETURN(0);
+
save_dev = lvfs_sbdev(mgs->mgs_sb);
lprocfs_obd_cleanup(obd);
ldlm_namespace_free(obd->obd_namespace, obd->obd_force);
- spin_lock_bh(&obd->obd_processing_task_lock);
- if (obd->obd_recovering) {
- target_cancel_recovery_timer(obd);
- obd->obd_recovering = 0;
- }
- spin_unlock_bh(&obd->obd_processing_task_lock);
+ LASSERT(!obd->obd_recovering);
lvfs_clear_rdonly(save_dev);
fsfilt_put_ops(obd->obd_fsops);
- LCONSOLE_INFO("MGS %s has stopped.\n", obd->obd_name);
+ LCONSOLE_INFO("%s has stopped.\n", obd->obd_name);
RETURN(0);
}
static int mgs_handle_target_add(struct ptlrpc_request *req)
{
struct obd_device *obd = req->rq_export->exp_obd;
- struct mgmt_target_info *req_mti, *mti, *rep_mti;
+ struct mgmt_target_info *mti, *rep_mti;
int rep_size = sizeof(*mti);
int rc;
ENTRY;
- OBD_ALLOC(mti, sizeof(*mti));
- if (!mti)
- GOTO(out, rc = -ENOMEM);
- req_mti = lustre_swab_reqbuf(req, 0, sizeof(*mti),
- lustre_swab_mgmt_target_info);
- memcpy(mti, req_mti, sizeof(*mti));
+ mti = lustre_swab_reqbuf(req, 0, sizeof(*mti),
+ lustre_swab_mgmt_target_info);
CDEBUG(D_MGS, "adding %s, index=%d\n", mti->mti_svname,
mti->mti_stripe_index);
}
out:
- CDEBUG(D_MGS, "replying with %s, index=%d\n", mti->mti_svname,
- mti->mti_stripe_index);
+ CDEBUG(D_MGS, "replying with %s, index=%d, rc=%d\n", mti->mti_svname,
+ mti->mti_stripe_index, rc);
lustre_pack_reply(req, 1, &rep_size, NULL);
/* send back the whole mti in the reply */
rep_mti = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_mti));
memcpy(rep_mti, mti, sizeof(*rep_mti));
- // FIXME rc is redundant, part of the req (target_send_reply)
- rep_mti->mti_rc = rc;
RETURN(rc);
}
.o_setup = mgs_setup,
.o_precleanup = mgs_precleanup,
.o_cleanup = mgs_cleanup,
+ .o_destroy_export = target_destroy_export,
.o_iocontrol = mgs_iocontrol,
};
/* can these be the same? */
uuid = (char *)lovdesc->ld_uuid.uuid;
+ /* This should always be the first entry in a log.
+ rc = mgs_clear_log(obd, logname); */
rc = record_start_log(obd, &llh, logname);
rc = record_attach(obd, llh, lovname, "lov", uuid);
rc = record_lov_setup(obd, llh, lovname, lovdesc);
#endif
rc = class_config_parse_llog(rctxt, logname, cfg);
obd_disconnect(exp);
- if (rc) {
+
+ if (rc && lmd_is_client(lsi->lsi_lmd)) {
int rc2;
- LCONSOLE_ERROR("%s: The configuration '%s' could not be read "
+ LCONSOLE_INFO("%s: The configuration '%s' could not be read "
"from the MGS (%d). Trying local log.\n",
mgc->obd_name, logname, rc);
/* If we couldn't connect to the MGS, try reading a copy
of the config log stored locally on disk */
rc2 = class_config_parse_llog(lctxt, logname, cfg);
if (rc2) {
- LCONSOLE_ERROR("%s: Can't read the local config (%d)\n",
+ CERROR("%s: Can't read the local config (%d)\n",
mgc->obd_name, rc2);
} else {
rc = 0;
}
}
+ if (rc) {
+ LCONSOLE_ERROR("%s: The configuration '%s' could not be read "
+ "(%d), mount will fail.\n",
+ mgc->obd_name, logname, rc);
+ }
CDEBUG(D_MOUNT, "after lustre_get_process_log %s\n", logname);
class_obd_list();
obd->obd_force = 1;
if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER)
obd->obd_fail = 1;
+ /* We can't seem to give an error return code
+ to .put_super, so we better make sure we clean up!
+ FIXME is there a way to get around this? */
+ obd->obd_force = 1;
class_manual_cleanup(obd);
} else {
CERROR("no obd %s\n", lsi->lsi_ldd->ldd_svname);
}
- server_stop_servers(sb);
+ server_stop_servers(sb);
/* If they wanted the mgs to stop separately from the mdt, they
should have put it on a different device. */
rc = lustre_stop_mgc(sb);
if (rc) {
- CDEBUG(D_MOUNT, "Can't stop MGC - busy? %d\n", rc);
if (rc != -EBUSY) {
CERROR("Can't stop MGC: %d\n", rc);
return rc;
}
/* BUSY just means that there's some other obd that
needs the mgc. Let him clean it up. */
+ CDEBUG(D_MOUNT, "MGC busy, not stopping\n");
}
rc = lustre_free_lsi(sb);
return rc;
__swab32s(&mti->mti_stripe_pattern);
__swab64s(&mti->mti_stripe_size);
__swab64s(&mti->mti_stripe_offset);
- __swab32s(&mti->mti_rc);
}
static void lustre_swab_obd_dqinfo (struct obd_dqinfo *i)