From: nathan Date: Tue, 13 Dec 2005 20:21:56 +0000 (+0000) Subject: Branch b1_4_mountconf X-Git-Tag: v1_8_0_110~486^4~101 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3ee588e6e615cb7c80b1fd060e8c70dfeed2e89a;p=fs%2Flustre-release.git Branch b1_4_mountconf b=9845 fixed memory leaks and double connect problem (target_destroy_export) mgmt, ost, mdt, clients all start and stop cleanly --- diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 2c1cbb4..30e8a3c 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -953,7 +953,6 @@ struct mgmt_target_info { __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); diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 7d34dcc..d5cbdd4 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -322,7 +322,6 @@ struct client_obd { 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; diff --git a/lustre/mgc/mgc_internal.h b/lustre/mgc/mgc_internal.h index 8005ad3..26da3e0 100644 --- a/lustre/mgc/mgc_internal.h +++ b/lustre/mgc/mgc_internal.h @@ -5,13 +5,5 @@ #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 diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 0528fc2..d578331 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -76,15 +76,12 @@ int mgc_target_add(struct obd_export *exp, struct mgmt_target_info *mti) 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); @@ -219,8 +216,6 @@ static int mgc_cleanup(struct obd_device *obd) 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); @@ -231,63 +226,32 @@ static int mgc_cleanup(struct obd_device *obd) 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); } diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 22fe136..99f29a0 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -235,6 +235,7 @@ static int mgs_cleanup(struct obd_device *obd) if (mgs->mgs_sb == NULL) RETURN(0); + save_dev = lvfs_sbdev(mgs->mgs_sb); lprocfs_obd_cleanup(obd); @@ -248,18 +249,13 @@ static int mgs_cleanup(struct obd_device *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); } @@ -267,17 +263,13 @@ static int mgs_cleanup(struct obd_device *obd) 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); @@ -301,14 +293,12 @@ static int mgs_handle_target_add(struct ptlrpc_request *req) } 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); } @@ -494,6 +484,7 @@ static struct obd_ops mgs_obd_ops = { .o_setup = mgs_setup, .o_precleanup = mgs_precleanup, .o_cleanup = mgs_cleanup, + .o_destroy_export = target_destroy_export, .o_iocontrol = mgs_iocontrol, }; diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index d3e597c..25e0bea 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -581,6 +581,8 @@ static int mgs_write_log_lov(struct obd_device *obd, char *fsname, /* 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); diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index d71d514..cc74b67 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -412,21 +412,27 @@ int lustre_get_process_log(struct super_block *sb, char *logname, #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(); @@ -1063,12 +1069,16 @@ static void server_put_super(struct super_block *sb) 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. */ @@ -1232,13 +1242,13 @@ int lustre_common_put_super(struct super_block *sb) 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; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 2ca68eb..bd2da48 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -575,7 +575,6 @@ void lustre_swab_mgmt_target_info(struct mgmt_target_info *mti) __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)