diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 37e3e70a35155bbeeddee40ce01ac976e45a0bbd..589df890b3a57d185e2a43d5497c17503fb36e6d 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1208,11 +1208,12 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa, if (!lov->desc.ld_active_tgt_count) RETURN(-EIO); + lov_getref(exp->exp_obd); /* Recreate a specific object id at the given OST index */ if ((src_oa->o_valid & OBD_MD_FLFLAGS) && (src_oa->o_flags & OBD_FL_RECREATE_OBJS)) { rc = lov_recreate(exp, src_oa, ea, oti); - RETURN(rc); + GOTO(out, rc); } maxage = cfs_time_shift_64(-lov->desc.ld_qos_maxage); @@ -1220,7 +1221,7 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa, rc = lov_prep_create_set(exp, &oinfo, ea, src_oa, oti, &set); if (rc) - RETURN(rc); + GOTO(out, rc); list_for_each_entry(req, &set->set_list, rq_link) { /* XXX: LOV STACKING: use real "obj_mdp" sub-data */ @@ -1229,6 +1230,8 @@ static int lov_create(struct obd_export *exp, struct obdo *src_oa, lov_update_create_set(set, req, rc); } rc = lov_fini_create_set(set, ea); +out: + lov_putref(exp->exp_obd); RETURN(rc); } @@ -1264,9 +1267,10 @@ static int lov_destroy(struct obd_export *exp, struct obdo *oa, } lov = &exp->exp_obd->u.lov; + lov_getref(exp->exp_obd); rc = lov_prep_destroy_set(exp, &oinfo, oa, lsm, oti, &set); if (rc) - RETURN(rc); + GOTO(out, rc); list_for_each (pos, &set->set_list) { int err; @@ -1293,6 +1297,8 @@ static int lov_destroy(struct obd_export *exp, struct obdo *oa, rc = lsm_op_find(lsm->lsm_magic)->lsm_destroy(lsm, oa, md_exp); } err = lov_fini_destroy_set(set); +out: + lov_putref(exp->exp_obd); RETURN(rc ? rc : err); } diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index dd8d526cf24465c1a3934f1265e972428de199ef..b292fc367868c8d4c5a74efbbab6d413a4d3f1b4 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -965,7 +965,6 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set) /* Find a small number of stripes we can use (up to # of active osts). */ stripes = 1; - lov_getref(exp->exp_obd); for (i = 0; i < lov->desc.ld_tgt_count; i++) { if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active) @@ -975,7 +974,6 @@ int qos_prep_create(struct obd_export *exp, struct lov_request_set *set) break; stripes++; } - lov_putref(exp->exp_obd); if (stripes < stripes_def) stripes = stripes_def;