From dbaf6928620fc8ee9e6f6bf6413764571524be8a Mon Sep 17 00:00:00 2001
From: anserper <anserper>
Date: Tue, 14 Oct 2008 19:26:50 +0000
Subject: [PATCH] Branch HEAD

b=17152
i=Johann Lombardi
i=Alexey Lyashkov

Take additional references to lov while operating over it
---
 lustre/lov/lov_obd.c | 12 +++++++++---
 lustre/lov/lov_qos.c |  2 --
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
index 37e3e70a35..589df890b3 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 dd8d526cf2..b292fc3678 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;
-- 
GitLab