From 68d7acbca53fe6bff6b2940a6024cada47844d95 Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 10 Dec 2005 01:08:04 +0000 Subject: [PATCH] Branch b1_4_mountconf b=9845 can start OSTs via target_add rpc now, fixed llog file leaks, better empty log checks. --- lustre/include/linux/lustre_log.h | 1 + lustre/include/linux/lustre_mgs.h | 9 -- lustre/include/linux/obd.h | 12 +- lustre/mgs/mgs_fs.c | 1 + lustre/mgs/mgs_llog.c | 250 +++++++++++++++++++------------------ lustre/obdclass/llog.c | 9 ++ lustre/obdclass/llog_lvfs.c | 3 +- lustre/obdclass/obd_config.c | 7 ++ lustre/obdclass/obd_mount.c | 37 ++++-- lustre/obdfilter/filter.c | 15 +-- lustre/obdfilter/filter_internal.h | 8 -- lustre/ost/ost_handler.c | 6 +- 12 files changed, 196 insertions(+), 162 deletions(-) diff --git a/lustre/include/linux/lustre_log.h b/lustre/include/linux/lustre_log.h index 68dd7f2..96cd5d0 100644 --- a/lustre/include/linux/lustre_log.h +++ b/lustre/include/linux/lustre_log.h @@ -84,6 +84,7 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb, void *data, void *catdata); extern int llog_cancel_rec(struct llog_handle *loghandle, int index); extern int llog_close(struct llog_handle *cathandle); +extern int llog_get_size(struct llog_handle *loghandle); /* llog_cat.c - catalog api */ struct llog_process_data { diff --git a/lustre/include/linux/lustre_mgs.h b/lustre/include/linux/lustre_mgs.h index 77d74db..c7ad534 100644 --- a/lustre/include/linux/lustre_mgs.h +++ b/lustre/include/linux/lustre_mgs.h @@ -43,15 +43,6 @@ struct system_db { struct list_head ost_infos; int sdb_flags; }; -#define SDB_NO_LLOG 0x01 -#define LOG_IS_EMPTY(db) ((db)->sdb_flags & SDB_NO_LLOG) - -struct mgc_open_llog { - struct list_head mol_list; - __u64 mol_step; - llogid_t mol_id; - char mol_fsname[40]; -}; int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt); int mgs_fs_cleanup(struct obd_device *obddev); diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index 130ba16..7d34dcc 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -447,14 +447,20 @@ struct niobuf_local { int rc; }; + /* device types */ +/* FIXME all the references to these defines need to be updated */ #define LUSTRE_MDS_NAME "mds" #define LUSTRE_MDT_NAME "mdt" + #define LUSTRE_MDC_NAME "mdc" -#define LUSTRE_OSS_NAME "oss" -#define LUSTRE_OST_NAME "ost" + +/* FIXME just the names need to be changed */ +#define LUSTRE_OSS_NAME "ost" /*FIXME oss*/ +#define LUSTRE_OST_NAME "obdfilter" /* FIXME ost*/ +#define LUSTRE_OSTSAN_NAME "sanobdfilter" + #define LUSTRE_OSC_NAME "osc" -# define OBD_FILTER_DEVICENAME "obdfilter" #define LUSTRE_FILTER_NAME "filter" #define LUSTRE_SANOSC_NAME "sanosc" #define LUSTRE_SANOST_NAME "sanost" diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index 0025c3b..95bd148 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -54,6 +54,7 @@ int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt) int rc; ENTRY; + // FIXME what's this? rc = cleanup_group_info(); if (rc) RETURN(rc); diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index a668b70..44829d9 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -45,6 +45,9 @@ #include #include "mgs_internal.h" + +/******************** DB functions *********************/ + static int db_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, void *data) { @@ -56,12 +59,9 @@ static int db_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, CDEBUG(D_MGS, "db_handler\n"); - db->sdb_flags &= ~SDB_NO_LLOG; - if (rec->lrh_type == OBD_CFG_REC) { struct lustre_cfg *lcfg; - char index_str[16]; - int i, index; + int index; rc = lustre_cfg_sanity_check(cfg_buf, cfg_len); if (rc) @@ -70,18 +70,14 @@ static int db_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, lcfg = (struct lustre_cfg *)cfg_buf; if (lcfg->lcfg_command == LCFG_LOV_ADD_OBD) { - memset(index_str, 0, 16); - strncpy(index_str, (char *)lustre_cfg_buf(lcfg, 2), - lcfg->lcfg_buflens[2]); - index = simple_strtol(index_str, NULL, 0); - set_bit(i, db->index_map); + index = simple_strtol(lustre_cfg_string(lcfg, 2), + NULL, 0); + set_bit(index, db->index_map); } if (lcfg->lcfg_command == LCFG_LOV_DEL_OBD) { - memset(index_str, 0, 16); - strncpy(index_str, (char *)lustre_cfg_buf(lcfg, 2), - lcfg->lcfg_buflens[2]); - index = simple_strtol(index_str, NULL, 0); - clear_bit(i, db->index_map); + index = simple_strtol(lustre_cfg_string(lcfg, 2), + NULL, 0); + clear_bit(index, db->index_map); } } else { CERROR("unhandled lrh_type: %#x\n", rec->lrh_type); @@ -105,16 +101,17 @@ static int get_db_from_llog(struct obd_device *obd, char *logname, if (rc) GOTO(out_pop, rc); - llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL); + rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(out_close, rc); rc = llog_process(loghandle, db_handler, (void *)db, NULL); - + CDEBUG(D_MGS, "get_db = %d\n", rc); out_close: rc2 = llog_close(loghandle); if (!rc) rc = rc2; + out_pop: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); @@ -174,7 +171,6 @@ static struct system_db *mgs_new_db(struct obd_device *obd, char *fsname) } strncpy(db->fsname, fsname, sizeof(db->fsname)); //INIT_LIST_HEAD(&db->ost_infos); - db->sdb_flags |= SDB_NO_LLOG; spin_lock(&mgs->mgs_system_db_lock); list_add(&db->db_list, &mgs->mgs_system_db_list); @@ -259,10 +255,6 @@ static int mgs_find_or_make_db(struct obd_device *obd, char *name, *dbh = db; - if (LOG_IS_EMPTY(db)) { - CDEBUG(D_MGS, "llog %s is empty\n", name); - } - return 0; } @@ -291,63 +283,8 @@ int mgs_set_next_index(struct obd_device *obd, struct mgmt_target_info *mti) return rc; } - -static int mgs_backup_llog(struct obd_device *obd, char* fsname) -{ - struct file *filp, *bak_filp; - struct lvfs_run_ctxt saved; - char *logname, *buf; - loff_t soff = 0 , doff = 0; - int count = 4096, len; - int rc = 0; - - OBD_ALLOC(logname, PATH_MAX); - if (logname == NULL) - return -ENOMEM; - - OBD_ALLOC(buf, count); - if (!buf) - GOTO(out , rc = -ENOMEM); - - len = snprintf(logname, PATH_MAX, "%s/%s.bak", - MOUNT_CONFIGS_DIR, fsname); - - if (len >= PATH_MAX - 1) { - GOTO(out, -ENAMETOOLONG); - } - - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - - bak_filp = l_filp_open(logname, O_RDWR|O_CREAT|O_TRUNC, 0660); - if (IS_ERR(bak_filp)) { - rc = PTR_ERR(bak_filp); - CERROR("backup logfile open %s: %d\n", logname, rc); - GOTO(pop, rc); - } - sprintf(logname, "%s/%s", MOUNT_CONFIGS_DIR, fsname); - filp = l_filp_open(logname, O_RDONLY, 0); - if (IS_ERR(filp)) { - rc = PTR_ERR(filp); - CERROR("logfile open %s: %d\n", logname, rc); - GOTO(close1f, rc); - } - - while ((rc = lustre_fread(filp, buf, count, &soff)) > 0) { - rc = lustre_fwrite(bak_filp, buf, count, &doff); - break; - } - - filp_close(filp, 0); -close1f: - filp_close(bak_filp, 0); -pop: - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); -out: - if (buf) - OBD_FREE(buf, count); - OBD_FREE(logname, PATH_MAX); - return rc; -} + +/******************** config log recording functions *********************/ static int mgs_do_record(struct obd_device *obd, struct llog_handle *llh, struct lustre_cfg *lcfg) @@ -503,12 +440,92 @@ static int record_end_log(struct obd_device *obd, struct llog_handle **llh) int rc = 0; push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + rc = llog_close(*llh); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); *llh = NULL; + + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); RETURN(rc); } +static int mgs_log_is_empty(struct obd_device *obd, char *name) +{ + struct lvfs_run_ctxt saved; + struct llog_handle *llh; + int rc = 0; + + /* FIXME cache the empty state in the db */ + + push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), + &llh, NULL, name); + if (rc == 0) { + llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL); + rc = llog_get_size(llh); + llog_close(llh); + } + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + /* header is record 1 */ + return(rc <= 1); +} + +static int mgs_backup_llog(struct obd_device *obd, char* fsname) +{ + struct file *filp, *bak_filp; + struct lvfs_run_ctxt saved; + char *logname, *buf; + loff_t soff = 0 , doff = 0; + int count = 4096, len; + int rc = 0; + + OBD_ALLOC(logname, PATH_MAX); + if (logname == NULL) + return -ENOMEM; + + OBD_ALLOC(buf, count); + if (!buf) + GOTO(out , rc = -ENOMEM); + + len = snprintf(logname, PATH_MAX, "%s/%s.bak", + MOUNT_CONFIGS_DIR, fsname); + + if (len >= PATH_MAX - 1) { + GOTO(out, -ENAMETOOLONG); + } + + push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + + bak_filp = l_filp_open(logname, O_RDWR|O_CREAT|O_TRUNC, 0660); + if (IS_ERR(bak_filp)) { + rc = PTR_ERR(bak_filp); + CERROR("backup logfile open %s: %d\n", logname, rc); + GOTO(pop, rc); + } + sprintf(logname, "%s/%s", MOUNT_CONFIGS_DIR, fsname); + filp = l_filp_open(logname, O_RDONLY, 0); + if (IS_ERR(filp)) { + rc = PTR_ERR(filp); + CERROR("logfile open %s: %d\n", logname, rc); + GOTO(close1f, rc); + } + + while ((rc = lustre_fread(filp, buf, count, &soff)) > 0) { + rc = lustre_fwrite(bak_filp, buf, count, &doff); + break; + } + + filp_close(filp, 0); +close1f: + filp_close(bak_filp, 0); +pop: + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); +out: + if (buf) + OBD_FREE(buf, count); + OBD_FREE(logname, PATH_MAX); + return rc; +} + static int mgs_clear_log(struct obd_device *obd, char *name) { struct lvfs_run_ctxt saved; @@ -531,6 +548,8 @@ static int mgs_clear_log(struct obd_device *obd, char *name) return(rc); } +/******************** config "macros" *********************/ + /* lov is the first thing in the mdt and client logs */ static int mgs_write_log_lov(struct obd_device *obd, char *fsname, char *logname, char *lovname) @@ -565,6 +584,7 @@ static int mgs_write_log_lov(struct obd_device *obd, char *fsname, rc = record_start_log(obd, &llh, logname); rc = record_attach(obd, llh, lovname, "lov", uuid); rc = record_lov_setup(obd, llh, lovname, lovdesc); + rc = record_end_log(obd, &llh); RETURN(rc); } @@ -572,40 +592,29 @@ static int mgs_write_log_lov(struct obd_device *obd, char *fsname, static int mgs_write_log_mdt(struct obd_device *obd, struct mgmt_target_info *mti) { - struct system_db *db; struct llog_handle *llh = NULL; char *cliname, *mdcname, *lovname, *nodeuuid, *mdsuuid, *mdcuuid; int rc, first_log = 0; - rc = mgs_find_or_make_db(obd, mti->mti_fsname, &db); - if (rc || !db) { - CERROR("Can't get db for %s\n", mti->mti_fsname); - return(-EINVAL); - } - CDEBUG(D_MGS, "writing new mdt %s\n", mti->mti_svname); name_create(mti->mti_fsname, "-mdtlov", &lovname); /* Append mdt info to mdt log */ - if (LOG_IS_EMPTY(db)) { - /* First time for all logs for this fs */ + if (mgs_log_is_empty(obd, mti->mti_svname)) { + /* This is the first time for all logs for this fs, + since any ost should have already started the mdt log. */ first_log++; - rc = mgs_clear_log(obd, mti->mti_svname); rc = mgs_write_log_lov(obd, mti->mti_fsname, mti->mti_svname, lovname); - } else { - rc = mgs_backup_llog(obd, mti->mti_fsname); - if (rc) { - CERROR("Can not backup llog, abort updating llog.\n"); - return rc; - } - } + } + name_create(mti->mti_svname, "_UUID", &mdsuuid); - /* We added the lov+mount opt, maybe some osc's, now for the mds. + /* We added the lov, maybe some osc's, now for the mdt. We might add more ost's after this. Note that during the parsing - of this log, this is when the mds will start. This was not - formerly part of the mds log, it was directly executed by lconf. */ + of this log, this is when the mdt will start. (This was not + formerly part of the old mds log, it was directly executed by + lconf.) */ /* #09 L mount_option 0: 1:mdsA 2:lov_mdsA attach mds mdsA mdsA_UUID @@ -619,13 +628,12 @@ static int mgs_write_log_mdt(struct obd_device *obd, mti->mti_svname, 0/*options*/); rc = record_end_log(obd, &llh); - /* Append mdt info to the client log */ + /* Append the mdt info to the client log */ name_create(mti->mti_fsname, "-client", &cliname); name_destroy(lovname); name_create(mti->mti_fsname, "-clilov", &lovname); if (first_log) { /* Start client log */ - rc = mgs_clear_log(obd, cliname); rc = mgs_write_log_lov(obd, mti->mti_fsname, cliname, lovname); } @@ -664,7 +672,6 @@ static int mgs_write_log_mdt(struct obd_device *obd, /* Add the ost info to the client/mdt lov */ static int mgs_write_log_osc(struct obd_device *obd, struct mgmt_target_info *mti, - int first_log, char *logname, char *lovname, char *ostuuid) { struct llog_handle *llh = NULL; @@ -672,9 +679,9 @@ static int mgs_write_log_osc(struct obd_device *obd, char index[5]; int rc; - if (first_log) { - /* First osc, add the lov */ - rc = mgs_clear_log(obd, logname); + if (mgs_log_is_empty(obd, logname)) { + /* The first time an osc is added, setup the lov */ + CDEBUG(D_MGS, "First log, creating %s\n", logname); rc = mgs_write_log_lov(obd, mti->mti_fsname, logname, lovname); } @@ -708,23 +715,26 @@ static int mgs_write_log_osc(struct obd_device *obd, static int mgs_write_log_ost(struct obd_device *obd, struct mgmt_target_info *mti) { - struct system_db *db; struct llog_handle *llh = NULL; char *logname, *lovname, *ostuuid; - int rc, first_log = 0; - - rc = mgs_find_or_make_db(obd, mti->mti_fsname, &db); - if (rc || !db) { - CERROR("Can't get db for %s\n", mti->mti_fsname); - return(-EINVAL); - } - if (LOG_IS_EMPTY(db)) - /* First time for all logs for this fs */ - first_log++; + int rc; CDEBUG(D_MGS, "writing new ost %s\n", mti->mti_svname); /* The ost startup log */ + + /* If the ost log already exists, that means that someone reformatted + the ost and it called target_add again. + FIXME check and warn here, maybe inc config ver #? Or abort, + and claim there's already a server with that name? Maybe need + another flag to say it's okay to rewrite. + Heck, what do we do about the client and mds logs? We better + abort. */ + if (!mgs_log_is_empty(obd, mti->mti_svname)) { + CERROR("The config log for %s already exists, not adding.\n", + mti->mti_svname); + return -EALREADY; + } /* attach obdfilter ost1 ost1_UUID setup /dev/loop2 ldiskfs f|n errors=remount-ro,user_xattr @@ -742,16 +752,16 @@ static int mgs_write_log_ost(struct obd_device *obd, the lov */ /* Append ost info to mdt log */ // FIXME need real mdt name - name_create(mti->mti_fsname, "-mdt0001", &logname); + name_create(mti->mti_fsname, "-MDT0001", &logname); name_create(mti->mti_fsname, "-mdtlov", &lovname); - mgs_write_log_osc(obd, mti, first_log, logname, lovname, ostuuid); + mgs_write_log_osc(obd, mti, logname, lovname, ostuuid); name_destroy(lovname); name_destroy(logname); /* Append ost info to the client log */ name_create(mti->mti_fsname, "-client", &logname); name_create(mti->mti_fsname, "-clilov", &lovname); - mgs_write_log_osc(obd, mti, first_log, logname, lovname, ostuuid); + mgs_write_log_osc(obd, mti, logname, lovname, ostuuid); name_destroy(lovname); name_destroy(logname); @@ -774,6 +784,8 @@ int mgs_write_log_target(struct obd_device *obd, return rc; } +/******************** unused *********************/ + static int decompose_fullfsname(char *fullfsname, char *fsname, char *poolname) { char *p = NULL; diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index 85cec7b..f4d5116 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -316,3 +316,12 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb, RETURN(rc); } EXPORT_SYMBOL(llog_process); + +int llog_get_size(struct llog_handle *loghandle) +{ + if (loghandle && loghandle->lgh_hdr) + return loghandle->lgh_hdr->llh_count; + return 0; +} +EXPORT_SYMBOL(llog_get_size); + diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index 30b697a..3a959c9 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -445,7 +445,6 @@ static struct file *llog_filp_open(char *name, int flags, int mode) CERROR("logfile creation %s: %ld\n", logname, PTR_ERR(filp)); } - OBD_FREE(logname, PATH_MAX); return filp; } @@ -544,6 +543,8 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, finish: if (oa) obdo_free(oa); + // FIXME remove + CDEBUG(D_ERROR, "opened %s fp=%p\n", name?name:"by id", handle->lgh_file); RETURN(rc); cleanup: switch (cleanup_phase) { diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index be382df..e73eeb3 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -691,6 +691,9 @@ out: return err; } +int class_config_dump_handler(struct llog_handle * handle, + struct llog_rec_hdr *rec, void *data); + static int class_config_llog_handler(struct llog_handle * handle, struct llog_rec_hdr *rec, void *data) { @@ -699,6 +702,10 @@ static int class_config_llog_handler(struct llog_handle * handle, char *cfg_buf = (char*) (rec + 1); int rc = 0; ENTRY; + + // FIXME remove + class_config_dump_handler(handle, rec, data); + switch (rec->lrh_type) { case OBD_CFG_REC: { struct lustre_cfg *lcfg, *lcfg_new; diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 226d675..eb63b01 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -406,7 +406,7 @@ int lustre_get_process_log(struct super_block *sb, char *logname, //FIXME Copy the mgs remote log to the local disk -#if 1 +#if 0 /* For debugging, it's useful to just dump the log */ class_config_dump_llog(rctxt, logname, cfg); #endif @@ -512,7 +512,7 @@ static int server_start_mgs(struct super_block *sb) return rc; } -static void server_stop_mgs(struct super_block *sb) +static int server_stop_mgs(struct super_block *sb) { struct obd_device *obd; char mgsname[] = "MGS"; @@ -524,12 +524,13 @@ static void server_stop_mgs(struct super_block *sb) obd = class_name2obd(mgsname); if (!obd) { CDEBUG(D_CONFIG, "mgs %s not running\n", mgsname); - return; + return -EALREADY; } /* The MGS should always stop when we say so */ obd->obd_force = 1; - class_manual_cleanup(obd); + rc = class_manual_cleanup(obd); + return rc; } /* Set up a mgcobd to process startup logs */ @@ -609,6 +610,7 @@ static int lustre_start_mgc(struct super_block *sb) atomic_set(&obd->u.cli.cl_mgc_refcount, 1); out: + /* note that many lsi's can point to the same mgc.*/ lsi->lsi_mgc = obd; return rc; } @@ -626,6 +628,8 @@ static int lustre_stop_mgc(struct super_block *sb) lsi->lsi_mgc = NULL; 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)); return -EBUSY; @@ -681,10 +685,11 @@ static int server_mgc_clear_fs(struct obd_device *mgc) } /* Stop MDS/OSS if nobody is using them */ -static void server_stop_servers(struct super_block *sb) +static int server_stop_servers(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); struct obd_device *obd; + int rc; /* if this was an MDT, and there are no more MDT's, clean up the MDS */ if (IS_MDT(lsi->lsi_ldd) && (obd = class_name2obd("MDS"))) { @@ -696,7 +701,7 @@ static void server_stop_servers(struct super_block *sb) obd->obd_force = 1; if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER) obd->obd_fail = 1; - class_manual_cleanup(obd); + rc = class_manual_cleanup(obd); } } @@ -704,14 +709,18 @@ static void server_stop_servers(struct super_block *sb) if (IS_OST(lsi->lsi_ldd) && (obd = class_name2obd("OSS"))) { struct obd_type *type = class_search_type(LUSTRE_OST_NAME); if (!type || !type->typ_refcnt) { + int err; /* nobody is using the OST type, clean the OSS */ if (lsi->lsi_flags & LSI_UMOUNT_FORCE) obd->obd_force = 1; if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER) obd->obd_fail = 1; - class_manual_cleanup(obd); + err = class_manual_cleanup(obd); + if (!rc) + rc = err; } } + return rc; } /* Add this target to the fs, get a new index if needed */ @@ -825,7 +834,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt) rc = lustre_start_simple("MDS", LUSTRE_MDT_NAME, 0, 0); if (rc) { CERROR("failed to start MDS: %d\n", rc); - goto out; + goto out_servers; } } } @@ -838,7 +847,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt) rc = lustre_start_simple("OSS", LUSTRE_OSS_NAME, 0, 0); if (rc) { CERROR("failed to start OSS: %d\n", rc); - goto out; + goto out_servers; } } } @@ -885,6 +894,7 @@ out: /* Release the mgc fs for others to use */ server_mgc_clear_fs(lsi->lsi_mgc); +out_servers: if (rc) server_stop_servers(sb); return(rc); @@ -1219,6 +1229,15 @@ int lustre_common_put_super(struct super_block *sb) CDEBUG(D_MOUNT, "dropping sb %p\n", 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. */ + } rc = lustre_free_lsi(sb); return rc; } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index d9fe902..59aeed1 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1642,11 +1642,6 @@ static int filter_cleanup(struct obd_device *obd) LL_DQUOT_OFF(filter->fo_sb); - if (atomic_read(&filter->fo_vfsmnt->mnt_count) > 1) - CERROR("%s: mount point %p busy, mnt_count: %d\n", - obd->obd_name, filter->fo_vfsmnt, - atomic_read(&filter->fo_vfsmnt->mnt_count)); - must_put = server_put_mount(obd->obd_name, filter->fo_vfsmnt); /* must_put is for old method (l_p_m returns non-0 on err) */ @@ -2927,14 +2922,14 @@ static int __init obdfilter_init(void) return -ENOMEM; rc = class_register_type(&filter_obd_ops, lvars.module_vars, - OBD_FILTER_DEVICENAME); + LUSTRE_OST_NAME); if (rc) GOTO(out, rc); rc = class_register_type(&filter_sanobd_ops, lvars.module_vars, - OBD_FILTER_SAN_DEVICENAME); + LUSTRE_OSTSAN_NAME); if (rc) { - class_unregister_type(OBD_FILTER_DEVICENAME); + class_unregister_type(LUSTRE_OST_NAME); out: OBD_FREE(obdfilter_created_scratchpad, OBDFILTER_CREATED_SCRATCHPAD_ENTRIES * @@ -2945,8 +2940,8 @@ out: static void __exit obdfilter_exit(void) { - class_unregister_type(OBD_FILTER_SAN_DEVICENAME); - class_unregister_type(OBD_FILTER_DEVICENAME); + class_unregister_type(LUSTRE_OSTSAN_NAME); + class_unregister_type(LUSTRE_OST_NAME); OBD_FREE(obdfilter_created_scratchpad, OBDFILTER_CREATED_SCRATCHPAD_ENTRIES * sizeof(*obdfilter_created_scratchpad)); diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index 9f86d09..4e42953 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -14,14 +14,6 @@ #define FILTER_LAYOUT_VERSION "2" -#ifndef OBD_FILTER_DEVICENAME -# define OBD_FILTER_DEVICENAME "obdfilter" -#endif - -#ifndef OBD_FILTER_SAN_DEVICENAME -# define OBD_FILTER_SAN_DEVICENAME "sanobdfilter" -#endif - #define LAST_RCVD "last_rcvd" #define HEALTH_CHECK "health_check" #define FILTER_INIT_OBJID 0 diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index c016bf9..dff29f2 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1503,7 +1503,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf) ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE, OST_MAXREPSIZE, OST_REQUEST_PORTAL, OSC_REPLY_PORTAL, - obd_timeout * 1000, ost_handle, LUSTRE_OST_NAME, + obd_timeout * 1000, ost_handle, LUSTRE_OSS_NAME, obd->obd_proc_entry, ost_print_req, OST_NUM_THREADS); if (ost->ost_service == NULL) { @@ -1634,12 +1634,12 @@ static int __init ost_init(void) lprocfs_init_vars(ost,&lvars); RETURN(class_register_type(&ost_obd_ops, lvars.module_vars, - LUSTRE_OST_NAME)); + LUSTRE_OSS_NAME)); } static void /*__exit*/ ost_exit(void) { - class_unregister_type(LUSTRE_OST_NAME); + class_unregister_type(LUSTRE_OSS_NAME); } MODULE_AUTHOR("Cluster File Systems, Inc. "); -- 1.8.3.1