From 7439c8a0e7c87bc81a43913b770f9b81782de3ba Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 2 Dec 2005 01:27:22 +0000 Subject: [PATCH] Branch b1_4_mountconf b=9845 llog generation and target add on mgs --- lustre/include/linux/lustre_disk.h | 18 +- lustre/include/linux/lustre_idl.h | 9 +- lustre/include/linux/lustre_mgs.h | 4 + lustre/mgs/mgs_handler.c | 58 ++- lustre/mgs/mgs_internal.h | 5 +- lustre/mgs/mgs_llog.c | 874 +++++++++++++++++++------------------ lustre/ptlrpc/pack_generic.c | 1 + 7 files changed, 500 insertions(+), 469 deletions(-) diff --git a/lustre/include/linux/lustre_disk.h b/lustre/include/linux/lustre_disk.h index 2240028..2d483c4 100644 --- a/lustre/include/linux/lustre_disk.h +++ b/lustre/include/linux/lustre_disk.h @@ -91,17 +91,21 @@ struct lustre_disk_data { #define MT_STR(data) mt_str((data)->ldd_mount_type) /* Make the mdt/ost server obd name based on the filesystem name */ -static inline void ldd_make_sv_name(struct lustre_disk_data *ldd) +static inline void make_sv_name(__u32 flags, __u32 index, char *fs, char *name) { - if (IS_MDT(ldd) || IS_OST(ldd)) { - sprintf(ldd->ldd_svname, "%.8s-%s%04x", - ldd->ldd_fsname, - IS_MDT(ldd) ? "MDT" : "OST", - ldd->ldd_svindex); + if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) { + sprintf(name, "%.8s-%s%04x", fs, + (flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST", + index); } else { - sprintf(ldd->ldd_svname, "MGMT"); + sprintf(name, "MGMT"); } } +static inline void ldd_make_sv_name(struct lustre_disk_data *ldd) +{ + make_sv_name(ldd->ldd_flags, ldd->ldd_svindex, + ldd->ldd_fsname, ldd->ldd_svname); +} /****************** mount command *********************/ diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 1aaf956..e46d177 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -944,16 +944,17 @@ typedef enum { struct mgmt_target_info { char mti_fsname[NAME_MAXLEN]; - char mti_targetname[NAME_MAXLEN]; + char mti_svname[NAME_MAXLEN]; char mti_nodename[NAME_MAXLEN]; char mti_uuid[UUID_MAXLEN]; __u64 mti_nid; /* lnet_nid_t */ //nid list? __u32 mti_config_ver; __u32 mti_flags; __u32 mti_stripe_index; - __u32 mti_stripe_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */ - __u64 mti_stripe_size; /* in bytes */ - __u64 mti_stripe_offset; /* in bytes */ + __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/lustre_mgs.h b/lustre/include/linux/lustre_mgs.h index 8ab6bca..77d74db 100644 --- a/lustre/include/linux/lustre_mgs.h +++ b/lustre/include/linux/lustre_mgs.h @@ -35,12 +35,16 @@ struct mgc_op_data { __u64 obj_version; }; + struct system_db { char fsname[64]; struct list_head db_list; void* index_map; 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; diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 7d17a0a..7b227af 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -46,7 +46,6 @@ #include #include "mgs_internal.h" -static int mgs_postsetup(struct obd_device *obd); static int mgs_cleanup(struct obd_device *obd); /* Establish a connection to the MGS.*/ @@ -162,10 +161,13 @@ static int mgs_setup(struct obd_device *obd, obd_count len, void *buf) if (rc < 0) GOTO(err_fs, rc); - rc = mgs_postsetup(obd); + rc = llog_setup(obd, LLOG_CONFIG_ORIG_CTXT, obd, 0, NULL, + &llog_lvfs_ops); if (rc) GOTO(err_fs, rc); + mgs_init_db_list(obd); + lprocfs_init_vars(mgs, &lvars); lprocfs_obd_setup(obd, lvars.obd_vars); @@ -190,23 +192,17 @@ err_put: return rc; } -static int mgs_postsetup(struct obd_device *obd) -{ - int rc = 0; - ENTRY; - - rc = llog_setup(obd, LLOG_CONFIG_ORIG_CTXT, obd, 0, NULL, - &llog_lvfs_ops); - RETURN(rc); -} - static int mgs_precleanup(struct obd_device *obd, int stage) { int rc = 0; ENTRY; - llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT)); - rc = obd_llog_finish(obd, 0); + switch (stage) { + case OBD_CLEANUP_SELF_EXP: + mgs_cleanup_db_list(obd); + llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT)); + rc = obd_llog_finish(obd, 0); + } RETURN(rc); } @@ -256,6 +252,7 @@ static int mgs_handle_target_add(struct ptlrpc_request *req) struct mgmt_target_info *req_mti, *mti, *rep_mti; int rep_size = sizeof(*mti); int index, rc; + ENTER; OBD_ALLOC(mti, sizeof(*mti)); if (!mti) @@ -264,23 +261,38 @@ static int mgs_handle_target_add(struct ptlrpc_request *req) lustre_swab_mgmt_target_info); memcpy(mti, req_mti, sizeof(*mti)); - /* NEED_INDEX implies NEED_REGISTER, but not vice-versa */ + /* set the new target index if needed */ if (mti->mti_flags & LDD_F_NEED_INDEX) { - rc = mgs_get_index(mti); - // rc = mgmt_handle_first_connect(req); + rc = mgs_set_next_index(mti); + if (rc) { + CERROR("Can't get index (%d)\n", rc); + GOTO(out, rc); + } } - if (mti->mti_flags & LDD_F_SV_TYPE_MDT) { - rc = llog_add_mds(obd, mti); + /* create the log for the new target */ + rc = mgs_write_log_target(mti); + if (rc) { + CERROR("Failed to write %s log (%d)\n", + mti->mti_svname, rc); + GOTO(out, rc); + } + + /* update the other logs that depend on new targets */ + rc = mgs_write_log_add(mti); + if (rc) { + CERROR("Failed to add %s to lov's (%d)\n", + mti->mti_svname, rc); + GOTO(out, rc); } out: 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)); - if (rc) - rep_mti->mti_stripe_index = rc; - return rc; + rep_mti->mti_rc = rc; + RETURN(rc); } int mgs_handle(struct ptlrpc_request *req) @@ -288,6 +300,8 @@ int mgs_handle(struct ptlrpc_request *req) int fail = OBD_FAIL_MGMT_ALL_REPLY_NET; int rc = 0; ENTRY; + + CERROR("MGS handle\n"); OBD_FAIL_RETURN(OBD_FAIL_MGMT_ALL_REQUEST_NET | OBD_FAIL_ONCE, 0); diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h index 9733fba..83224ec 100644 --- a/lustre/mgs/mgs_internal.h +++ b/lustre/mgs/mgs_internal.h @@ -11,6 +11,9 @@ extern struct lvfs_callback_ops mgs_lvfs_ops; -int mgs_get_index(struct obd_device *obd, mgmt_target_info *mti); +int mgs_init_db_list(struct obd_device *obd); +int mgs_cleanup_db_list(struct obd_device *obd); +int mgs_set_next_index(struct obd_device *obd, mgmt_target_info *mti); +int mgs_write_log_target(struct obd_device *obd, struct mgmt_target_info *mti) #endif diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 599d460..0763198 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -26,6 +26,7 @@ #define EXPORT_SYMTAB #endif #define DEBUG_SUBSYSTEM S_MGS +#define D_MGS D_CONFIG|D_ERROR #ifdef __KERNEL__ #include @@ -44,17 +45,17 @@ #include #include "mgs_internal.h" -static struct lustre_cfg_bufs llog_bufs; -static int get_index_map_handler(struct llog_handle *llh, - struct llog_rec_hdr *rec, - void *data) +static int db_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, + void *data) { - void *index_map = data; + struct system_db *db = (struct system_db *)data; int cfg_len = rec->lrh_len; char *cfg_buf = (char*) (rec + 1); int rc = 0; ENTRY; + db->sdb_flags &= ~SDB_NO_LLOG; + if (rec->lrh_type == OBD_CFG_REC) { struct lustre_cfg *lcfg; char index_str[16]; @@ -71,14 +72,14 @@ static int get_index_map_handler(struct llog_handle *llh, strncpy(index_str, (char *)lustre_cfg_buf(lcfg, 2), lcfg->lcfg_buflens[2]); index = simple_strtol(index_str, NULL, 0); - set_bit(i, index_map); + set_bit(i, 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, index_map); + clear_bit(i, db->index_map); } } else { CERROR("unhandled lrh_type: %#x\n", rec->lrh_type); @@ -88,21 +89,17 @@ out: RETURN(rc); } -static int get_index_map_from_llog(struct obd_device *obd, char *fsname, - void *index_map) +static int get_db_from_llog(struct obd_device *obd, char *logname, + struct system_db *db) { struct llog_handle *loghandle; struct lvfs_run_ctxt saved; int rc, rc2; - OBD_ALLOC(index_map, 4096); - if (!index_map) - return -ENOMEM; - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); rc = llog_create(llog_get_context(obd, LLOG_CONFIG_REPL_CTXT), - &loghandle, NULL, fsname); + &loghandle, NULL, logname); if (rc) GOTO(out_pop, rc); @@ -110,8 +107,7 @@ static int get_index_map_from_llog(struct obd_device *obd, char *fsname, if (rc) GOTO(out_close, rc); - rc = llog_process(loghandle, get_index_map_handler, - index_map, NULL); + rc = llog_process(loghandle, db_handler, (void *)db, NULL); out_close: rc2 = llog_close(loghandle); @@ -127,13 +123,13 @@ static int next_ost_index(void *index_map, int map_len) { int i; for (i = 0; i < map_len * 8; i++) - if (test_bit(i, index_map)) + if (!test_bit(i, index_map)) return i; - CERROR("Index exceed upping.\n"); + CERROR("max index exceeded.\n"); return -ERANGE; } -static int get_ost_number(void *index_map, int map_len) +static int count_osts(void *index_map, int map_len) { int i,num; for (i = 0, num = 0; i < map_len * 8; i++) @@ -142,131 +138,216 @@ static int get_ost_number(void *index_map, int map_len) return num; } -int mgs_get_index(struct obd_device *obd, mgmt_target_info *mti) +static struct system_db *mgs_find_db(struct obd_device *obd, char *fsname) { struct mgs_obd *mgs = &obd->u.mgs; struct system_db *db; struct list_head *tmp; - int rc = 0; list_for_each(tmp, &mgs->mgs_system_db_list) { db = list_entry(tmp, struct system_db, db_list); - if (strcmp(db->fsname, mti->mti_fsname) == 0) { - if (mti->mti_flags & LDD_F_SV_TYPE_OST) - *new_index = next_ost_index(db->index_map, 4096); - else - *new_index = 1; /*FIXME*/ - return 0; + if (strcmp(db->fsname, fsname) == 0) { + return db; } } - + return NULL; +} + +#define INDEX_MAP_SIZE 4096 + +static struct system_db *mgs_new_db(struct obd_device *obd, char *fsname) +{ + struct mgs_obd *mgs = &obd->u.mgs; + struct system_db *db; + OBD_ALLOC(db, sizeof(*db)); if (!db) - return -ENOMEM; - strcpy(db->fsname, mti->mti_fsname); - INIT_LIST_HEAD(&db->db_list); + return NULL; + OBD_ALLOC(db->index_map, INDEX_MAP_SIZE); + if (!db->index_map) { + OBD_FREE(db); + return NULL; + } + strncpy(db->fsname, fsname, sizeof(db->fsname)); INIT_LIST_HEAD(&db->ost_infos); - rc = get_index_map_from_llog(obd, mti->mti_fsname, db->index_map); - if (rc) - GOTO(clean, rc); + db->sdb_flags |= SDB_NO_LLOG; + spin_lock(&mgs->mgs_system_db_lock); list_add(&db->db_list, &mgs->mgs_system_db_list); spin_unlock(&mgs->mgs_system_db_lock); - *new_index = next_ost_index(db->index_map, 4096); + return db; +} -out: - return rc; -clean: - OBD_FREE(db, sizeof(*db)); - goto out; +static void mgs_free_db(struct system_db *db) +{ + list_del(&db->db_list); + OBD_FREE(db->index_map, INDEX_MAP_SIZE); + OBD_FREE(db, sizeof(*db); } -static int mgs_do_record(struct obd_device *obd, struct llog_handle *llh, - void *cfg_buf) +int mgs_init_db_list(struct obd_device *obd) { - struct lvfs_run_ctxt saved; - struct llog_rec_hdr rec; - int rc = 0; + struct mgs_obd *mgs = &obd->u.mgs; + spin_lock_init(&mgs->mgs_system_db_lock); + INIT_LIST_HEAD(&mgs->mgs_system_db_list); + return 0; +} - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_write_rec(llh, &rec, NULL, 0, cfg_buf, -1); - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); +int mgs_cleanup_db_list(struct obd_device *obd) +{ + struct mgs_obd *mgs = &obd->u.mgs; + struct system_db *db; + struct list_head *tmp, *tmp2; + spin_lock(&mgs->mgs_system_db_lock); + list_for_each_safe(tmp, tmp2, &mgs->mgs_system_db_list) { + db = list_entry(tmp, struct system_db, db_list); + mgs_free_db(db); + } + spin_unlock(&mgs->mgs_system_db_lock); + return 0; +} - RETURN(rc); +static inline int name_create(char *prefix, char *suffix, char **newname){ + OBD_ALLOC(newname, strlen(prefix) + strlen(suffix) + 1); + if (!newname) + return -ENOMEM; + sprintf(newname, "%s%s", prefix, suffix); + return 0; } -static int record_attach(struct obd_device *obd, struct llog_handle *llh, - char* name, char *type, char *uuid) +static inline void name_destroy(char *newname){ + if (newname) + OBD_FREE(newname, strlen(newname) + 1); +} + + +static int mgs_find_or_make_db(struct obd_device *obd, char *name, + struct system_db **dbh) { - struct lustre_cfg *lcfg; - int rc; + struct system_db *db; + char *cliname; + int rc = 0; - lustre_cfg_bufs_reset(&llog_bufs, name); + db = mgs_find_db(obd, name); + if (db) { + *dbh = db; + return 0; + } - lustre_cfg_bufs_set_string(&llog_bufs, 1, type); - if (uuid) - lustre_cfg_bufs_set_string(&llog_bufs, 2, uuid); + CDEBUG(D_MGS, "Creating new db\n"); + db = mgs_new_db(name); + if (!db) + return -ENOMEM; - lcfg = lustre_cfg_new(LCFG_ATTACH, &llog_bufs); + /* extract the db from the client llog */ + name_create(name, "-client", &cliname); + rc = get_db_from_llog(obd, cliname, db); + name_destroy(cliname); + if (rc) { + CERROR("Can't get db from llog %d\n", rc); + mgs_free_db(db); + return rc; + } - rc = mgs_do_record(obd, llh, (void *)lcfg); + *dbh = db; + + if (LOG_IS_EMPTY(db)) { + CDEBUG(D_MGS, "llog %s is empty\n", name); + } - lustre_cfg_free(lcfg); - return rc; + return 0; } -static int record_add_uuid(struct obd_device *obd, struct llog_handle *llh, - uint64_t nid, char *uuid) +int mgs_set_next_index(struct obd_device *obd, mgmt_target_info *mti) { - struct lustre_cfg *lcfg; - int rc; + struct mgs_obd *mgs = &obd->u.mgs; + struct system_db *db; + int rc = 0; - lustre_cfg_bufs_reset(&llog_bufs, NULL); - if (uuid) - lustre_cfg_bufs_set_string(&llog_bufs, 1, uuid); + rc = mgs_find_or_make_db(obd, mti->mti_fsname, db); - lcfg = lustre_cfg_new(LCFG_ADD_UUID, &llog_bufs); - lcfg->lcfg_nid = nid; + if (mti->mti_flags & LDD_F_SV_TYPE_OST) + mti->mti_stripe_index = next_ost_index(db->index_map, + INDEX_MAP_SIZE); + else + mti->mti_stripe_index = 1; /*FIXME*/ - rc = mgs_do_record(obd, llh, (void *)lcfg); + make_sv_name(mti->mti_flags, mti->mti_stripe_index, + mti->mti_fsname, mti->mti_svname); + + CDEBUG(D_MGS, "Set new index for %s\n", mti->mti_svname); - lustre_cfg_free(lcfg); return rc; } -static int record_lov_setup(struct obd_device *obd, struct llog_handle *llh, - char *device_name, struct lov_desc *desc) +static inline int mgs_do_record(struct obd_device *obd, struct llog_handle *llh, + struct lustre_cfg *lcfg) { - struct lustre_cfg *lcfg; + struct lvfs_run_ctxt saved; + struct llog_rec_hdr rec; int rc; - lustre_cfg_bufs_reset(&llog_bufs, device_name); + push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + rc = llog_write_rec(llh, &rec, NULL, 0, (void *)lcfg, -1); + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + return rc; +} - lustre_cfg_bufs_set(&llog_bufs, 1, desc, sizeof(*desc)); +static int do_record(struct obd_device *obd, struct llog_handle *llh, + char *cfgname, lnet_nid_t nid, int cmd, + char *s1, char *s2, char *s3, char *s4) +{ + struct lustre_cfg_bufs bufs; + struct lustre_cfg *lcfg; + int rc; + + CDEBUG(D_TRACE, "lcfg %s %#x %s %s %s %s\n", cfgname, + cmd, s1, s2, s3, s4); + + lustre_cfg_bufs_reset(&bufs, cfgname); + if (s1) + lustre_cfg_bufs_set_string(&bufs, 1, s1); + if (s2) + lustre_cfg_bufs_set_string(&bufs, 2, s2); + if (s3) + lustre_cfg_bufs_set_string(&bufs, 3, s3); + if (s4) + lustre_cfg_bufs_set_string(&bufs, 4, s4); + + lcfg = lustre_cfg_new(cmd, &bufs); + lcfg->lcfg_nid = nid; - lcfg = lustre_cfg_new(LCFG_SETUP, &llog_bufs); + rc = mgs_do_record(obd, llh, lcfg); + + lustre_cfg_free(lcfg); + return(rc); +} - rc = mgs_do_record(obd, llh, (void *)lcfg); +static inline int record_attach(struct obd_device *obd, struct llog_handle *llh, + char* name, char *type, char *uuid) +{ + return do_record(obd,llh,name,0,LCFG_ATTACH,type,uuid,0,0); +} - lustre_cfg_free(lcfg); - return rc; +static inline int record_add_uuid(struct obd_device *obd, struct llog_handle *llh, + uint64_t nid, char *uuid) +{ + return do_record(obd,llh,NULL,nid,LCFG_ADD_UUID,uuid,0,0,0); } -static int record_setup(struct obd_device *obd, struct llog_handle *llh, - char *device_name, int args, char**argv) +static int record_lov_setup(struct obd_device *obd, struct llog_handle *llh, + char *device_name, struct lov_desc *desc) { + struct lustre_cfg_bufs bufs; struct lustre_cfg *lcfg; - int i, rc; - - lustre_cfg_bufs_reset(&llog_bufs, device_name); + int rc; - for(i = 1; i < args ; i++) - lustre_cfg_bufs_set_string(&llog_bufs, i, argv[i-1]); - + lustre_cfg_bufs_reset(&bufs, device_name); + lustre_cfg_bufs_set(&llog_bufs, 1, desc, sizeof(*desc)); lcfg = lustre_cfg_new(LCFG_SETUP, &llog_bufs); - rc = mgs_do_record(obd, llh, (void *)lcfg); + rc = mgs_do_record(obd, llh, lcfg); lustre_cfg_free(lcfg); return rc; @@ -277,76 +358,46 @@ static int record_lov_modify_tgts(struct obd_device *obd, char *lov_name, char *op, char *ost_uuid, char *index, char *gen) { - struct lustre_cfg *lcfg; - int cmd, rc; - - lustre_cfg_bufs_reset(&llog_bufs, lov_name); - - if (!strncmp(op, "add", 4)) { + int cmd; + if (strncmp(op, "add", 3) == 0) cmd = LCFG_LOV_ADD_OBD; - } else if (!strncmp(op, "del", 4)) { + else cmd = LCFG_LOV_DEL_OBD; - } - - lustre_cfg_bufs_set_string(&llog_bufs, 1, ost_uuid); - lustre_cfg_bufs_set_string(&llog_bufs, 2, index); - lustre_cfg_bufs_set_string(&llog_bufs, 3, gen); - - lcfg = lustre_cfg_new(cmd, &llog_bufs); - - rc = mgs_do_record(obd, llh, (void *)lcfg); - - lustre_cfg_free(lcfg); - return rc; + + return do_record(obd,llh,lov_name,0,cmd,ost_uuid,index,gen,0); } -static int record_mount_point(struct obd_device *obd, struct llog_handle *llh, - char *profile, char *lov_name, char *mdc_name) +static inline int record_mount_opt(struct obd_device *obd, struct llog_handle *llh, + char *profile, char *lov_name, char *mdc_name) { - struct lustre_cfg *lcfg; - int rc; - - lustre_cfg_bufs_reset(&llog_bufs, NULL); - - lustre_cfg_bufs_set_string(&llog_bufs, 1, profile); - lustre_cfg_bufs_set_string(&llog_bufs, 2, lov_name); - if (mdc_name) - lustre_cfg_bufs_set_string(&llog_bufs, 2, mdc_name); - - lcfg = lustre_cfg_new(LCFG_MOUNTOPT, &llog_bufs); - - rc = mgs_do_record(obd, llh, (void *)lcfg); - - lustre_cfg_free(lcfg); - return rc; + return do_record(obd,llh,NULL,0,LCFG_MOUNTOPT,profile,lov_name,mdc_name,0); } -static int mgs_start_record(struct obd_device *obd, - struct llog_handle *llh, char *name) +static int mgs_start_log(struct obd_device *obd, + struct llog_handle **llh, char *name) { static struct obd_uuid cfg_uuid = { .uuid = "config_uuid" }; struct lvfs_run_ctxt saved; - struct llog_handle **llh_res; int rc = 0; - if (llh) + if (*llh) RETURN(-EBUSY); - llh_res = &llh; - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), - llh_res, NULL, name); + llh, NULL, name); if (rc == 0) - llog_init_handle(llh, LLOG_F_IS_PLAIN, &cfg_uuid); + llog_init_handle(*llh, LLOG_F_IS_PLAIN, &cfg_uuid); + else + *llh = NULL; pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); RETURN(rc); } -static int mgs_end_record(struct obd_device *obd, +static int mgs_end_log(struct obd_device *obd, struct llog_handle *llh, char* name) { struct lvfs_run_ctxt saved; @@ -359,20 +410,15 @@ static int mgs_end_record(struct obd_device *obd, RETURN(rc); } -static int mgs_clear_record(struct obd_device *obd, - struct llog_handle *llh, char *name) +static int mgs_clear_log(struct obd_device *obd, char *name) { struct lvfs_run_ctxt saved; - struct llog_handle **llh_res; + struct llog_handle *llh; int rc = 0; - if (llh) - RETURN(-EBUSY); - llh_res = &llh; - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), - llh_res, NULL, name); + &llh, NULL, name); if (rc == 0) { llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL); rc = llog_destroy(llh); @@ -380,132 +426,282 @@ static int mgs_clear_record(struct obd_device *obd, } pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - RETURN(rc); + if (rc) + CERROR("failed to clear log %s: %d\n", name, rc); + + return(rc); } -static int mgs_write_basic_llog(struct obd_device *obd, - struct mgmt_target_info *mti) +/* 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 *mdcname) { + struct llog_handle *llh; + struct lov_desc *lovdesc; + char lov_name[64]; + char uuid[64]; int rc = 0; - CERROR("New basic LLOG.\n"); /*FIXME: add soon*/ + ENTRY; + + /* FIXME just make lov_setup accept empty desc (put uuid in buf 2) */ + OBD_ALLOC(lovdesc, sizeof(*lovdesc)); + if (lovdesc == NULL) + GOTO(cleanup, rc = -ENOMEM); + /* Use defaults here, will fix them later with LCFG_PARAM */ + lovdesc->ld_pattern = 0; + lovdesc->ld_default_stripe_size = 1024*1024; + lovdesc->ld_default_stripe_offset = 0; + sprintf(lov_name, "lov_%s", mti->mti_fsname); + /* can these be the same? */ + sprintf(uuid, "%s_lov_UUID", mti->mti_fsname); + sprintf((char*)lovdesc->ld_uuid.uuid, "%s_UUID", lov_name); + + rc = mgs_start_log(obd, &llh, logname); + if (rc) { + CERROR("failed to record log %s: %d\n", name, rc); + GOTO(out, rc); + } + + rc = record_attach(obd, llh, lov_name, "lov", uuid); + if (rc) { + CERROR("failed to record log(attach lov) %s: %d\n", name, rc); + GOTO(out, rc); + } + + rc = record_lov_setup(obd, llh, lov_name, lovdesc); + if (rc) { + CERROR("failed to record log(setup) %s: %d\n", name, rc); + GOTO(out, rc); + } + + /* profile is the same as the logname */ + rc = record_mount_opt(obd, llh, logname, lov_name, mdcname); + if (rc) { + CERROR("failed to record log(mount_opt) %s: %d\n", + logname, rc); + GOTO(cleanup, rc); + } + + rc = mgs_end_log(obd, llh, name); + if (rc) { + CERROR("failed to record log %s: %d\n", name, rc); + GOTO(out, rc); + } +out: + RETURN(rc); +} + +static int mgs_write_log_mdt(struct obd_device *obd, + struct mgmt_target_info *mti) +{ + struct system_db *db; + struct llog_handle *llh; + char *cliname, *mdcname, *tmpname; + int rc; + + 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); + } + + name_create(mti->mti_fsname, "-client", &cliname); + name_create(mti->mti_fsname, "-mdc", &mdcname); + if (LOG_IS_EMPTY(db)) { + /* First time for all logs for this fs */ + rc = mgs_clear_log(obd, mti->mti_svname); + rc = mgs_write_log_lov(obd, mti->mti_fsname, mti->mti_svname,0); + /* Start client log */ + rc = mgs_clear_log(obd, cliname); + rc = mgs_write_log_lov(obd, mti->mti_fsname, cliname, mdcname); + } + + /* We added the lov+mount opt, maybe some osc's, now for the mds. + We might add more ost's after this. Note that during the parsing + of this log, this is when the mds will start. */ + rc = mgs_start_log(obd, &llh, mti->mti_svname); + name_create(mti->mti_svname, "_UUID", &tmpname); + rc = record_attach(obd, llh, mti->mti_svname, LUSTRE_MDS_NAME, tmpname); + name_destroy(tmpname); + rc = do_record(obd,llh,mti->mti_svname,0,LCFG_SETUP, + "somedev"/*ignored*/,"sometype"/*ignored*/, + mti->mti_svname, 0/*options*/); + rc = mgs_end_record(obd, llh, logname); + + /* Add the mdt info to the client */ + /* FIXME add lines to client +#09 L add_uuid nid=uml1@tcp(0x20000c0a80201) 0: 1:uml1_UUID +#10 L attach 0:MDC_uml1_mdsA_MNT_client 1:mdc 2:1d834_MNT_client_031388313f +#11 L setup 0:MDC_uml1_mdsA_MNT_client 1:mdsA_UUID 2:uml1_UUID +#12 L add_uuid nid=uml2@tcp(0x20000c0a80202) 0: 1:uml2_UUID +#13 L add_conn 0:MDC_uml1_mdsA_MNT_client 1:uml2_UUID +#14 L mount_option 0: 1:client 2:lov1 3:MDC_uml1_mdsA_MNT_client + */ + name_destroy(mdcname); + name_destroy(cliname); return rc; } -static int mgs_write_target_llog(struct obd_device *obd, - struct mgmt_target_info *mti) +int mgs_write_log_target(struct obd_device *obd, + struct mgmt_target_info *mti) { - struct mgs_open_llog *mol; + if (mti->mti_flags & LDD_F_SV_TYPE_MDT) { + rc = mgs_write_llog_mdt(mti); + } else if (mti->mti_flags & LDD_F_SV_TYPE_OST) { + rc = mgs_write_llog_ost(mti); + } else { + CERROR("Unknown target type, can't create log\n", + mti->mti_svname); + rc = -EINVAL; + } + return rc; +} + +int llog_add_mds(struct obd_device *obd, struct mgmt_target_info *mti) +{ + struct mgs_obd *mgs = &obd->u.mgs; struct llog_handle *llh; - struct list_head *tmp; - char *name = mti->mti_fsname; - struct lov_desc *lovdesc; - char lov_name[64]; + struct system_db *db; + char logname[64], lov_name[64]; + char mds_node_uuid[64]; char uuid[64]; - int i, rc = 0; + char mdc_name[80]; + char mdc_uuid[64]; + char *setup_argv[2]; + struct lov_desc *ld; + int rc = 0; + + db = mgs_find_db(obd, mti->mti_fsname); + if (!db) + RETURN(-EINVAL); llh = llog_alloc_handle(); if (llh == NULL) RETURN(-ENOMEM); - OBD_ALLOC(lovdesc, sizeof(*lovdesc)); - if (lovdesc == NULL) - GOTO(cleanup, rc = -ENOMEM); - lovdesc->ld_pattern = mti->mti_stripe_pattern; - lovdesc->ld_default_stripe_size = mti->mti_stripe_size; - lovdesc->ld_default_stripe_offset = mti->mti_stripe_offset; + OBD_ALLOC(ld, sizeof(*ld)); + if (!ld) + GOTO(out, rc = -ENOMEM); - rc = mgs_clear_record(obd, llh, name); + ld->ld_tgt_count = count_osts(db->index_map, INDEX_MAP_SIZE); + ld->ld_default_stripe_count = mti->mti_stripe_size; + ld->ld_pattern = mti->mti_stripe_pattern; + ld->ld_default_stripe_offset = mti->mti_stripe_offset; + sprintf((char*)ld->ld_uuid.uuid, "lov1_UUID"); + + /* Two phases: 1. writing mds log. + 2. writing client log + */ + + /*First phase: writing mds log */ + sprintf(logname, "%s/mds1", mti->mti_fullfsname); + + rc = mgs_start_record(obd, llh, logname); if (rc) { - CERROR("failed to clear log %s: %d\n", name, rc); + CERROR("failed to record log %s: %d\n", logname, rc); + GOTO(out, rc);; + } + + /* the same uuid for lov and osc */ + sprintf(uuid, "%s_lov_UUID", mti->mti_target_name); + sprintf(lov_name, "lov_client"); + + rc = record_attach(obd, llh, lov_name, "lov", uuid); + if (rc) { + CERROR("failed to record log(attach lov) %s: %d\n", logname, rc); + GOTO(out, rc);; + } + + rc = record_lov_setup(obd, llh, lov_name, ld); + if (rc) { + CERROR("failed to record log(setup) %s: %d\n", logname, rc); + GOTO(out, rc);; + } + + rc = record_mount_point(obd, llh, mti->mti_target_name, lov_name, NULL); + if (rc) { + CERROR("failed to record log(mount_point) %s: %d\n", + logname, rc); GOTO(cleanup, rc); } - rc = mgs_start_record(obd, llh, name); + rc = mgs_end_record(obd, llh, logname); if (rc) { - CERROR("failed to record log %s: %d\n", name, rc); + CERROR("failed to record log %s: %d\n", logname, rc); GOTO(cleanup, rc); } + /*Second phase: writing client log */ + sprintf(logname, "%s/client", logname); + + rc = mgs_start_record(obd, llh, logname); + if (rc) { + CERROR("failed to record log %s: %d\n", logname, rc); + GOTO(out, rc);; + } + /* the same uuid for lov and osc */ - sprintf(uuid, "%s_lov_UUID", mti->mti_fsname); - sprintf(lov_name, "lov_%s", mti->mti_fsname); - sprintf((char*)lovdesc->ld_uuid.uuid, "%s_UUID", lov_name); + sprintf(uuid, "%s_lov_UUID", mti->mti_target_name); + sprintf(lov_name, "lov_client"); rc = record_attach(obd, llh, lov_name, "lov", uuid); if (rc) { - CERROR("failed to record log(attach lov) %s: %d\n", name, rc); - GOTO(cleanup, rc); + CERROR("failed to record log(attach lov) %s: %d\n", + logname, rc); + GOTO(out, rc);; + } + + rc = record_lov_setup(obd, llh, lov_name, ld); + if (rc) { + CERROR("failed to record log(setup) %s: %d\n", logname, rc); + GOTO(out, rc);; + } + + sprintf(mds_node_uuid, "%s_UUID", mti->mti_target_nodename); + rc = record_add_uuid(obd, llh, mti->mti_nid, mds_node_uuid); + if (rc) { + CERROR("failed to record log(add uuid) %s: %d\n", + logname, rc); + RETURN(rc); } + + sprintf(mdc_name, "MDC_%s_%s_MNT_client", + mti->mti_target_nodename, mti->mti_target_name); + sprintf(mdc_uuid, "MDC_%s_UUID", mti->mti_fullfsname); - rc = record_lov_setup(obd, llh, lov_name, lovdesc); + rc = record_attach(obd, llh, mdc_name, "mdc", mdc_uuid); if (rc) { - CERROR("failed to record log(setup) %s: %d\n", name, rc); - GOTO(cleanup, rc); + CERROR("failed to record log(attach) %s: %d\n", + logname, rc); + RETURN(rc); } -#if 0 - i = 0; - list_for_each(tmp, &db->ost_infos) { - char ost_node_uuid[64]; - char osc_name[64]; - char index[16]; - char *setup_argv[2]; - struct mgmt_target_info *oinfo; - - oinfo = list_entry(tmp, struct mgmt_target_info, mti_list); - - sprintf(ost_node_uuid, "%s_UUID", oinfo->mti_nodename); - sprintf(osc_name,"OSC_%s_%s_%s", - db->mds_nodename, oinfo->mti_ostname, db->mds_name); - - rc = record_add_uuid(obd, llh, oinfo->mti_nid, ost_node_uuid); - if (rc) { - CERROR("failed to record log(add_uuid) %s: %d\n", - name, rc); - RETURN(rc); - } - - rc = record_attach(obd, llh, osc_name, "osc", uuid); - if (rc) { - CERROR("failed to record log(attach_uuid) %s: %d\n", - name, rc); - RETURN(rc); - } - - setup_argv[0] = oinfo->mti_ostuuid; - setup_argv[1] = ost_node_uuid; - rc = record_setup(obd, llh, osc_name, 2, setup_argv); - if (rc) { - CERROR("failed to record log(setup) %s: %d\n", - name, rc); - RETURN(rc); - } - sprintf(index, "%d", oinfo->mti_stripe_index); - rc = record_lov_modify_tgts(obd, llh, lov_name, "add", - oinfo->mti_ostuuid, index, "1"); - if (rc) { - CERROR("failed to record log(lov_modify_tgts) %s: %d\n", - name, rc); - RETURN(rc); - } + sprintf(setup_argv[0],"%s_UUID", mti->mti_mds_name); + rc = do_record(obd,llh,mdc_name,0,LCFG_SETUP,mds_uuid FIXME,mds_node_uuid,0,0); + if (rc) { + CERROR("failed to record log(setup) %s: %d\n", + logname, rc); + RETURN(rc); } -#endif - rc = record_mount_point(obd, llh, mti->mti_target_name, lov_name, NULL); + + rc = record_mount_point(obd, llh, "client", lov_name, NULL); if (rc) { - CERROR("failed to record log(lov_modify_tgts) %s: %d\n", - name, rc); - GOTO(cleanup, rc); + CERROR("failed to record log(mount_point) %s: %d\n", + logname, rc); + RETURN(rc); } - rc = mgs_end_record(obd, llh, name); + rc = mgs_end_record(obd, llh, logname); if (rc) { - CERROR("failed to record log %s: %d\n", name, rc); - GOTO(cleanup, rc); + CERROR("failed to record log %s: %d\n", logname, rc); + RETURN(rc); } -out: - RETURN(rc); + cleanup: + OBD_FREE(ld, sizeof(*ld)); +out: llog_free_handle(llh); + return rc; } static int mgs_write_client_llog(struct obd_device *obd, char* name) @@ -533,7 +729,7 @@ static int mgs_write_client_llog(struct obd_device *obd, char* name) llh = mol->mol_cfg_llh; - rc = mgs_clear_record(obd, llh, name); + rc = mgs_clear_log(obd, llh, name); if (rc) { CERROR("failed to clear log %s: %d\n", name, rc); RETURN(rc); @@ -591,7 +787,7 @@ static int mgs_write_client_llog(struct obd_device *obd, char* name) setup_argv[0] = oinfo->mti_ostuuid; setup_argv[1] = ost_node_uuid; - rc = record_setup(obd, llh, osc_name, 2, setup_argv); + do_record(obd,llh,osc_name,0,LCFG_SETUP,oinfo->mti_ostuuid,ost_node_uuid,0,0); if (rc) { CERROR("failed to record log(setup) %s: %d\n", name, rc); @@ -627,9 +823,7 @@ static int mgs_write_client_llog(struct obd_device *obd, char* name) RETURN(rc); } - setup_argv[0] = db->mds_uuid; - setup_argv[1] = mds_node_uuid; - rc = record_setup(obd, llh, mdc_name, 2, setup_argv); + rc = do_record(obd,llh,mdc_name,0,LCFG_SETUP,db->mds_uuid,mds_node_uuid,0,0); if (rc) { CERROR("failed to record log(setup) %s: %d\n", name, rc); @@ -651,37 +845,16 @@ static int mgs_write_client_llog(struct obd_device *obd, char* name) #endif RETURN(rc); } -#if 0 -int mgs_update_llog(struct obd_device *obd, char *name) -{ - char logname[64]; - int rc = 0; - - /* Two phases: 1. writing mds log. - 2. writing client log - */ - - /*First phase: writing mds log */ - sprintf(logname, "%s/mds1", name); - rc = mgs_write_mds_llog(obd, logname); - if (rc) { - CERROR("failed to write log %s: %d\n", logname, rc); - RETURN(rc); - } - - /*Second phase: writing client log */ - sprintf(logname, "%s/client", name); - rc = mgs_write_client_llog(obd, logname); - if (rc) { - CERROR("failed to write log %s: %d\n", logname, rc); - RETURN(rc); - } +static int mgs_write_log_add(struct obd_device *obd, + struct mgmt_target_info *mti) +{ + int rc = 0; + CERROR("New basic LLOG.\n"); /*FIXME: add soon*/ return rc; } -#endif -int decompose_fullfsname(char *fullfsname, char *fsname, char *poolname) +static int decompose_fullfsname(char *fullfsname, char *fsname, char *poolname) { char *p = NULL; @@ -737,12 +910,11 @@ out: return rc; } -int llog_add_ost(struct obd_device *obd, struct mgmt_target_info *mti) +int mgs_write_llog_ost(struct obd_device *obd, struct mgmt_target_info *mti) { struct mgs_obd *mgs = &obd->u.mgs; struct llog_handle *llh; - struct system_db *db = NULL; - struct list_head *tmp; + struct system_db *db; char logname[64], lov_name[64]; char ost_node_uuid[64]; char osc_name[64]; @@ -751,14 +923,7 @@ int llog_add_ost(struct obd_device *obd, struct mgmt_target_info *mti) char index[16]; int rc = 0; - list_for_each(tmp, &mgs->mgs_system_db_list) { - struct system_db *tmp_db; - tmp_db = list_entry(tmp, struct system_db, db_list); - if (!strcmp(tmp_db->fsname, mti->mti_fsname)) { - db = tmp_db; - break; - } - } + db = mgs_find_db(obd, mti->mti_fsname); if (!db) RETURN(-EINVAL); @@ -797,9 +962,7 @@ int llog_add_ost(struct obd_device *obd, struct mgmt_target_info *mti) GOTO(out, rc); } - setup_argv[0] = mti->mti_ostuuid; - setup_argv[1] = ost_node_uuid; - rc = record_setup(obd, llh, osc_name, 2, setup_argv); + rc = do_record(obd,llh,osc_name,0,LCFG_SETUP,mti->mti_ostuuid,ost_node_uuid,0,0); if (rc) { CERROR("failed to record log(setup) %s: %d\n", logname, rc); @@ -848,9 +1011,7 @@ int llog_add_ost(struct obd_device *obd, struct mgmt_target_info *mti) GOTO(out, rc); } - setup_argv[0] = mti->mti_ostuuid; - setup_argv[1] = ost_node_uuid; - rc = record_setup(obd, llh, osc_name, 2, setup_argv); + rc = do_record(obd,llh,osc_name,0,LCFG_SETUP,mti->mti_ostuuid,ost_node_uuid,0,0); if (rc) { CERROR("failed to record log(setup) %s: %d\n", logname, rc); @@ -877,163 +1038,6 @@ out: } EXPORT_SYMBOL(llog_add_ost); -int llog_add_mds(struct obd_device *obd, struct mgmt_target_info *mti) -{ - struct mgs_obd *mgs = &obd->u.mgs; - struct llog_handle *llh; - struct system_db *db = NULL; - struct list_head *tmp; - char logname[64], lov_name[64]; - char mds_node_uuid[64]; - char uuid[64]; - char mdc_name[80]; - char mdc_uuid[64]; - char *setup_argv[2]; - struct lov_desc *ld; - int rc = 0; - - list_for_each(tmp, &mgs->mgs_system_db_list) { - struct system_db *tmp_db; - tmp_db = list_entry(tmp, struct system_db, db_list); - if (!strcmp(tmp_db->fsname, mti->mti_fullfsname)) { - db = tmp_db; - break; - } - } - if (!db) - RETURN(-EINVAL); - - llh = llog_alloc_handle(); - if (llh == NULL) - RETURN(-ENOMEM); - - OBD_ALLOC(ld, sizeof(*ld)); - if (!ld) - GOTO(out, rc = -ENOMEM); - - ld->ld_tgt_count = get_ost_number(db->index_map, 4096); - ld->ld_default_stripe_count = mti->mti_stripe_size; - ld->ld_pattern = mti->mti_stripe_pattern; - ld->ld_default_stripe_offset = mti->mti_stripe_offset; - sprintf((char*)ld->ld_uuid.uuid, "lov1_UUID"); - - /* Two phases: 1. writing mds log. - 2. writing client log - */ - - /*First phase: writing mds log */ - sprintf(logname, "%s/mds1", mti->mti_fullfsname); - - rc = mgs_start_record(obd, llh, logname); - if (rc) { - CERROR("failed to record log %s: %d\n", logname, rc); - GOTO(out, rc);; - } - - /* the same uuid for lov and osc */ - sprintf(uuid, "%s_lov_UUID", mti->mti_target_name); - sprintf(lov_name, "lov_client"); - - rc = record_attach(obd, llh, lov_name, "lov", uuid); - if (rc) { - CERROR("failed to record log(attach lov) %s: %d\n", logname, rc); - GOTO(out, rc);; - } - - rc = record_lov_setup(obd, llh, lov_name, ld); - if (rc) { - CERROR("failed to record log(setup) %s: %d\n", logname, rc); - GOTO(out, rc);; - } - - rc = record_mount_point(obd, llh, mti->mti_target_name, lov_name, NULL); - if (rc) { - CERROR("failed to record log(mount_point) %s: %d\n", - logname, rc); - GOTO(cleanup, rc); - } - - rc = mgs_end_record(obd, llh, logname); - if (rc) { - CERROR("failed to record log %s: %d\n", logname, rc); - GOTO(cleanup, rc); - } - - /*Second phase: writing client log */ - sprintf(logname, "%s/client", logname); - - rc = mgs_start_record(obd, llh, logname); - if (rc) { - CERROR("failed to record log %s: %d\n", logname, rc); - GOTO(out, rc);; - } - - /* the same uuid for lov and osc */ - sprintf(uuid, "%s_lov_UUID", mti->mti_target_name); - sprintf(lov_name, "lov_client"); - - rc = record_attach(obd, llh, lov_name, "lov", uuid); - if (rc) { - CERROR("failed to record log(attach lov) %s: %d\n", - logname, rc); - GOTO(out, rc);; - } - - rc = record_lov_setup(obd, llh, lov_name, ld); - if (rc) { - CERROR("failed to record log(setup) %s: %d\n", logname, rc); - GOTO(out, rc);; - } - - sprintf(mds_node_uuid, "%s_UUID", mti->mti_target_nodename); - rc = record_add_uuid(obd, llh, mti->mti_nid, mds_node_uuid); - if (rc) { - CERROR("failed to record log(add uuid) %s: %d\n", - logname, rc); - RETURN(rc); - } - - sprintf(mdc_name, "MDC_%s_%s_MNT_client", - mti->mti_target_nodename, mti->mti_target_name); - sprintf(mdc_uuid, "MDC_%s_UUID", mti->mti_fullfsname); - - rc = record_attach(obd, llh, mdc_name, "mdc", mdc_uuid); - if (rc) { - CERROR("failed to record log(attach) %s: %d\n", - logname, rc); - RETURN(rc); - } - - sprintf(setup_argv[0],"%s_UUID", mti->mti_mds_name); - setup_argv[1] = mds_node_uuid; - rc = record_setup(obd, llh, mdc_name, 2, setup_argv); - if (rc) { - CERROR("failed to record log(setup) %s: %d\n", - logname, rc); - RETURN(rc); - } - - rc = record_mount_point(obd, llh, "client", lov_name, NULL); - if (rc) { - CERROR("failed to record log(mount_point) %s: %d\n", - logname, rc); - RETURN(rc); - } - - rc = mgs_end_record(obd, llh, logname); - if (rc) { - CERROR("failed to record log %s: %d\n", logname, rc); - RETURN(rc); - } - -cleanup: - OBD_FREE(ld, sizeof(*ld)); -out: - llog_free_handle(llh); - return rc; -} -EXPORT_SYMBOL(llog_add_mds); - int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg) { diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index bd2da48..2ca68eb 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -575,6 +575,7 @@ 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) -- 1.8.3.1