diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 2b28571a94b62f6b6bc3618e4d54f91c691f70e8..9e3d7adbe23b05accb7ce22e100e929c4e793081 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -586,6 +586,9 @@ static int __init fid_mod_init(void) static void __exit fid_mod_exit(void) { + llo_local_obj_unregister(&llod_seq_srv); + llo_local_obj_unregister(&llod_seq_ctl); + lu_context_key_degister(&seq_thread_key); if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) { lprocfs_remove(&seq_type_proc_dir); diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index a5809bce5f150d55df9ae7d0b5872fcb966a653b..0f6e7cc1c26886c7c2b1baf56caed7773788fb24 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -101,6 +101,7 @@ static int __init fld_mod_init(void) static void __exit fld_mod_exit(void) { + llo_local_obj_unregister(&llod_fld_index); lu_context_key_degister(&fld_thread_key); if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) { lprocfs_remove(&fld_type_proc_dir); diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 9202385c92ac2ce5512bb2927fe299d2df18c45b..718e3369b453ffe7381c1e8a179275a2daa156f7 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -809,8 +809,10 @@ static inline int mdo_rename_tgt(const struct lu_env *env, struct dt_device; /** * Structure to hold object information. This is used to create object + * \pre llod_dir exist */ struct lu_local_obj_desc { + const char *llod_dir; const char *llod_name; __u32 llod_oid; int llod_is_index; @@ -846,7 +848,8 @@ struct md_object *llo_store_create(const struct lu_env *env, const char *objname, const struct lu_fid *fid); -int llo_local_obj_register(struct lu_local_obj_desc *); +void llo_local_obj_register(struct lu_local_obj_desc *); +void llo_local_obj_unregister(struct lu_local_obj_desc *); int llo_local_objects_setup(const struct lu_env *env, struct md_device * md, diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 3e7f17a206236b925a7d6fdf3a35ba1cceccaee8..76ef1c60b398a887a41d4d43e98ff4284293ff83 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -510,6 +510,10 @@ static int __init mdd_mod_init(void) static void __exit mdd_mod_exit(void) { + llo_local_obj_unregister(&llod_capa_key); + llo_local_obj_unregister(&llod_mdd_orphan); + llo_local_obj_unregister(&llod_mdd_root); + class_unregister_type(LUSTRE_MDD_NAME); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index d9437f7f7cab72f68d5852356f201cba15e4a456..4e8333b303850e9d67270ca3aa3eaa0d6f9c8aab 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5353,6 +5353,7 @@ static int __init mdt_mod_init(void) static void __exit mdt_mod_exit(void) { + llo_local_obj_unregister(&mdt_last_recv); class_unregister_type(LUSTRE_MDT_NAME); } diff --git a/lustre/obdclass/dt_object.c b/lustre/obdclass/dt_object.c index a4bbb9a61e8e609d5901e507b5a55ad23604fea5..79c160ec1873f8fe0334ee17d35e35883279d94c 100644 --- a/lustre/obdclass/dt_object.c +++ b/lustre/obdclass/dt_object.c @@ -313,7 +313,7 @@ static struct dt_object *dt_store_resolve(const struct lu_env *env, struct dt_thread_info *info = lu_context_key_get(&env->le_ctx, &dt_key); struct dt_find_hint *dfh = &info->dti_dfh; - struct dt_object *obj = dfh->dfh_o; + struct dt_object *obj; char *local = info->dti_buf; int result; @@ -331,6 +331,8 @@ static struct dt_object *dt_store_resolve(const struct lu_env *env, result = dt_path_parser(env, local, dt_find_entry, dfh); if (result != 0) obj = ERR_PTR(result); + else + obj = dfh->dfh_o; } } else { obj = ERR_PTR(result); diff --git a/lustre/obdclass/md_local_object.c b/lustre/obdclass/md_local_object.c index 919c2840fd194930bdf4c6206c57a4491e08e78f..7446cd84599a99451c11d16c3eccf66f68e362fc 100644 --- a/lustre/obdclass/md_local_object.c +++ b/lustre/obdclass/md_local_object.c @@ -135,7 +135,7 @@ static int llo_lookup(const struct lu_env *env, spec->sp_feat = NULL; spec->sp_cr_flags = 0; - spec->sp_cr_lookup = 1; + spec->sp_cr_lookup = 0; spec->sp_cr_mode = 0; spec->sp_ck_split = 0; @@ -148,6 +148,10 @@ static int llo_lookup(const struct lu_env *env, /** * Function to look up path component, this is passed to parsing * function. \see llo_store_resolve + * + * \retval rc returns error code for lookup or locate operation + * + * pointer to object is returned in data (lfh->lfh_pobj) */ static int llo_find_entry(const struct lu_env *env, const char *name, void *data) @@ -205,7 +209,7 @@ struct md_object *llo_store_resolve(const struct lu_env *env, struct llo_thread_info *info = llo_env_info(env); struct llo_find_hint *lfh = &info->lti_lfh; char *local = info->lti_buf; - struct md_object *obj = lfh->lfh_pobj; + struct md_object *obj; int result; strncpy(local, path, DT_MAX_PATH); @@ -224,6 +228,8 @@ struct md_object *llo_store_resolve(const struct lu_env *env, result = dt_path_parser(env, local, llo_find_entry, lfh); if (result != 0) obj = ERR_PTR(result); + else + obj = lfh->lfh_pobj; } } else { obj = ERR_PTR(result); @@ -367,19 +373,27 @@ EXPORT_SYMBOL(llo_store_create); /** * Register object for 'create on first mount' facility. + * objects are created in order of registration. */ -int llo_local_obj_register(struct lu_local_obj_desc *llod) +void llo_local_obj_register(struct lu_local_obj_desc *llod) { mutex_lock(&llo_lock); - list_add(&llod->llod_linkage, &llo_lobj_list); + list_add_tail(&llod->llod_linkage, &llo_lobj_list); mutex_unlock(&llo_lock); - - return 0; } EXPORT_SYMBOL(llo_local_obj_register); +void llo_local_obj_unregister(struct lu_local_obj_desc *llod) +{ + mutex_lock(&llo_lock); + list_del(&llod->llod_linkage); + mutex_unlock(&llo_lock); +} + +EXPORT_SYMBOL(llo_local_obj_unregister); + /** * Created registed objects. */ @@ -392,24 +406,26 @@ int llo_local_objects_setup(const struct lu_env *env, struct lu_fid *fid; struct lu_local_obj_desc *scan; struct md_object *mdo; + const char *dir; int rc = 0; fid = &info->lti_cfid; - mutex_lock(&llo_lock); list_for_each_entry(scan, &llo_lobj_list, llod_linkage) { - lu_local_obj_fid(fid, scan->llod_oid); + dir = ""; + if (scan->llod_dir) + dir = scan->llod_dir; if (scan->llod_is_index) mdo = llo_store_create_index(env, md, dt , - "", scan->llod_name, + dir, scan->llod_name, fid, scan->llod_feat); else mdo = llo_store_create(env, md, dt, - "", scan->llod_name, + dir, scan->llod_name, fid); if (IS_ERR(mdo) && PTR_ERR(mdo) != -EEXIST) { rc = PTR_ERR(mdo); @@ -444,4 +460,5 @@ int llo_global_init(void) void llo_global_fini(void) { lu_context_key_degister(&llod_key); + LASSERT(list_empty(&llo_lobj_list)); } diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index ff60505c399072b1cf217697a6e760f530140850..2652d7ea913289fef5ace38beafedfa13062de62 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -3784,6 +3784,7 @@ static int __init osd_mod_init(void) static void __exit osd_mod_exit(void) { + llo_local_obj_unregister(&llod_osd_rem_obj_dir); class_unregister_type(LUSTRE_OSD_NAME); } diff --git a/lustre/osd/osd_oi.c b/lustre/osd/osd_oi.c index ad03c3c93292985a13844c3a4e044fe63d04657a..5a43a544c0010637854ed14253f0f3833b444d2f 100644 --- a/lustre/osd/osd_oi.c +++ b/lustre/osd/osd_oi.c @@ -123,7 +123,7 @@ static int osd_oi_index_create(struct osd_thread_info *info, oi_feat.dif_keysize_max = oi_descr[i].fid_size, mdo = llo_store_create_index(env, mdev, dev, - "/", name, + "", name, oi_fid, &oi_feat); if (IS_ERR(mdo))