From a55dadb1cd2580fb6171484d4ecab4faa9e4bf4f Mon Sep 17 00:00:00 2001 From: tappro Date: Sat, 7 Oct 2006 22:08:21 +0000 Subject: [PATCH] - fast fix of mountconf bug when mds is set up before osc are added. This issues the race between recovery can start but not all osc are added yet. Fix adds obd_configured flag to track when config llog parsing is finished and MDS is really set up and ready for recovery. --- lustre/include/obd.h | 3 ++- lustre/ldlm/ldlm_lib.c | 5 +++-- lustre/mds/mds_lov.c | 6 ++++++ lustre/obdclass/obd_config.c | 19 +++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index f52abc2..072e819 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -878,7 +878,8 @@ struct obd_device { obd_starting:1, /* started setup */ obd_force:1, /* cleanup with > 0 obd refcount */ obd_fail:1, /* cleanup with failover */ - obd_async_recov:1; /* allow asyncronous orphan cleanup */ + obd_async_recov:1, /* allow asyncronous orphan cleanup */ + obd_configured:1; /* config llog parsed completely */ atomic_t obd_refcount; cfs_waitq_t obd_refcount_waitq; cfs_proc_dir_entry_t *obd_proc_entry; diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 8400b01..74911f3 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -720,7 +720,7 @@ int target_handle_connect(struct ptlrpc_request *req) if (target->obd_recovering) { lustre_msg_add_op_flags(req->rq_repmsg, MSG_CONNECT_RECOVERING); - target_start_recovery_timer(target/*, handler*/); + target_start_recovery_timer(target); } /* Tell the client if we support replayable requests */ @@ -1309,7 +1309,8 @@ static int check_for_clients(struct obd_device *obd) if (obd->obd_abort_recovery) return 1; LASSERT(obd->obd_connected_clients <= obd->obd_max_recoverable_clients); - if (obd->obd_connected_clients == obd->obd_max_recoverable_clients) + if (obd->obd_configured && + obd->obd_connected_clients == obd->obd_max_recoverable_clients) return 1; return 0; } diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 3d66ec8..e965887 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -237,6 +237,12 @@ static int mds_lov_update_desc(struct obd_device *obd, struct obd_export *lov) CDEBUG(D_CONFIG, "updated max_mdsize/max_cookiesize: %d/%d\n", mds->mds_max_mdsize, mds->mds_max_cookiesize); + /*XXX this notifies the MDD until lov handling use old mds code */ + if (obd->obd_upcall.onu_owner) { + LASSERT(obd->obd_upcall.onu_upcall != NULL); + rc = obd->obd_upcall.onu_upcall(NULL, NULL, 0, + obd->obd_upcall.onu_owner); + } out: OBD_FREE(ld, sizeof(*ld)); RETURN(rc); diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 397ee21..681847d 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1057,6 +1057,23 @@ out: RETURN(rc); } +void class_config_notify_end(const char *name) +{ + ENTRY; + struct obd_device *obd; + + /*XXX: This is fast fix to mountconf issue when osc are set up + * while recovery is in progress already. + * The MDS should wait the end of config llog parsing before starting + * recovery. This is done via obd_configured flag for now + */ + obd = class_name2obd(name); + if (obd) { + obd->obd_configured = 1; + } + EXIT; +} + int class_config_parse_llog(struct llog_ctxt *ctxt, char *name, struct config_llog_instance *cfg) { @@ -1081,6 +1098,8 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name, rc = llog_process(llh, class_config_llog_handler, cfg, &cd); + class_config_notify_end(name); + CDEBUG(D_CONFIG, "Processed log %s gen %d-%d (rc=%d)\n", name, cd.first_idx + 1, cd.last_idx, rc); if (cfg) -- 1.8.3.1