long old_fail_loc = cfs_fail_loc;
rc = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
- if (old_fail_loc != cfs_fail_loc)
+ if (old_fail_loc != cfs_fail_loc) {
+ cfs_race_state = 1;
wake_up(&cfs_race_waitq);
+ }
return rc;
}
static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
{
int rc;
- struct lu_device_type *ldt = obd->obd_type->typ_lu;
- struct lu_device *d;
+ struct obd_type *type = obd->obd_type;
+ struct lu_device_type *ldt;
- ENTRY;
+ ENTRY;
- if (ldt != NULL) {
- struct lu_context session_ctx;
- struct lu_env env;
- lu_context_init(&session_ctx, LCT_SESSION | LCT_SERVER_SESSION);
- session_ctx.lc_thread = NULL;
- lu_context_enter(&session_ctx);
+ wait_var_event(&type->typ_lu,
+ smp_load_acquire(&type->typ_lu) != OBD_LU_TYPE_SETUP);
+ ldt = type->typ_lu;
+ if (ldt != NULL) {
+ struct lu_context session_ctx;
+ struct lu_env env;
- rc = lu_env_init(&env, ldt->ldt_ctx_tags);
- if (rc == 0) {
- env.le_ses = &session_ctx;
- d = ldt->ldt_ops->ldto_device_alloc(&env, ldt, cfg);
- lu_env_fini(&env);
- if (!IS_ERR(d)) {
- obd->obd_lu_dev = d;
- d->ld_obd = obd;
- rc = 0;
- } else
- rc = PTR_ERR(d);
- }
- lu_context_exit(&session_ctx);
- lu_context_fini(&session_ctx);
+ lu_context_init(&session_ctx, LCT_SESSION | LCT_SERVER_SESSION);
+ session_ctx.lc_thread = NULL;
+ lu_context_enter(&session_ctx);
- } else {
+ rc = lu_env_init(&env, ldt->ldt_ctx_tags);
+ if (rc == 0) {
+ struct lu_device *dev;
+ env.le_ses = &session_ctx;
+ dev = ldt->ldt_ops->ldto_device_alloc(&env, ldt, cfg);
+ lu_env_fini(&env);
+ if (!IS_ERR(dev)) {
+ obd->obd_lu_dev = dev;
+ dev->ld_obd = obd;
+ rc = 0;
+ } else
+ rc = PTR_ERR(dev);
+ }
+ lu_context_exit(&session_ctx);
+ lu_context_fini(&session_ctx);
+ } else {
if (!obd->obd_type->typ_dt_ops->o_setup) {
CERROR("%s: no %s operation\n", obd->obd_name,
__func__);
RETURN(-EOPNOTSUPP);
}
- rc = OBP(obd, setup)(obd, cfg);
- }
- RETURN(rc);
+ rc = OBP(obd, setup)(obd, cfg);
+ }
+ RETURN(rc);
}
static inline int obd_precleanup(struct obd_device *obd)
if (type == NULL)
RETURN(-ENOMEM);
+ type->typ_lu = ldt ? OBD_LU_TYPE_SETUP : NULL;
type->typ_kobj.kset = lustre_kset;
kobject_init(&type->typ_kobj, &class_ktype);
#ifdef HAVE_SERVER_SUPPORT
setup_ldt:
#endif
if (ldt) {
- type->typ_lu = ldt;
rc = lu_device_type_init(ldt);
+ smp_store_release(&type->typ_lu, rc ? NULL : ldt);
+ wake_up_var(&type->typ_lu);
if (rc)
GOTO(failed, rc);
}
}
run_test 125 "check l_tunedisk only tunes OSTs and their slave devices"
+test_126() {
+ [[ "$MDS1_VERSION" -ge $(version_code 2.13.52) ]] ||
+ skip "Need MDS version at least 2.13.52"
+
+ cleanup
+ do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ../libcfs/libcfs/libcfs
+ #define OBD_FAIL_OBD_SETUP 0x60d
+ do_facet mds1 $LCTL set_param fail_loc=0x60d
+ do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules &
+ for i in {1..40}; do
+ do_facet mds1 lsmod | grep -q osd_$mds1_FSTYPE && break
+ sleep 1
+ done
+ clear_failloc $SINGLEMDS 20 &
+ start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
+}
+run_test 126 "mount in parallel shouldn't cause a crash"
+
if ! combined_mgs_mds ; then
stop mgs
fi