Whamcloud - gitweb
Don't allow skipping OSTs if index has been specified.
authorshadow <shadow>
Tue, 5 Feb 2008 11:52:01 +0000 (11:52 +0000)
committershadow <shadow>
Tue, 5 Feb 2008 11:52:01 +0000 (11:52 +0000)
b=13196
i=adilger
i=green

lustre/ChangeLog
lustre/include/obd.h
lustre/include/obd_class.h
lustre/lov/lov_qos.c
lustre/osc/osc_create.c
lustre/osc/osc_internal.h

index a4b0cdd..831cf30 100644 (file)
@@ -17,6 +17,13 @@ tbd  Sun Microsystems, Inc.
        * RHEL 4 and RHEL 5/SLES 10 clients behaves differently on 'cd' to a
         removed cwd "./" (refer to Bugzilla 14399).
 
+Severity   : minor
+Frequency  : rare on shutdown ost
+Bugzilla   : 13196
+Description: Don't allow skipping OSTs if index has been specified.
+Details    : Don't allow skipping OSTs if index has been specified, make locking
+             in internal create lots better.
+
 Severity   : normal
 Bugzilla   : 12228
 Description: LBUG in ptlrpc_check_set() bad phase ebc0de00
index cf80b7a..03a6c78 100644 (file)
@@ -921,7 +921,7 @@ struct obd_ops {
                          struct lov_stripe_md *mem_tgt);
         int (*o_preallocate)(struct lustre_handle *, obd_count *req,
                              obd_id *ids);
-        int (*o_precreate)(struct obd_export *exp, int need_create);
+        int (*o_precreate)(struct obd_export *exp);
         int (*o_create)(struct obd_export *exp,  struct obdo *oa,
                         struct lov_stripe_md **ea, struct obd_trans_info *oti);
         int (*o_destroy)(struct obd_export *exp, struct obdo *oa,
index 08672a9..a6bdb9c 100644 (file)
@@ -487,7 +487,7 @@ static inline int obd_checkmd(struct obd_export *exp,
         RETURN(rc);
 }
 
-static inline int obd_precreate(struct obd_export *exp, int need_create)
+static inline int obd_precreate(struct obd_export *exp)
 {
         int rc;
         ENTRY;
@@ -495,7 +495,7 @@ static inline int obd_precreate(struct obd_export *exp, int need_create)
         EXP_CHECK_OP(exp, precreate);
         OBD_COUNTER_INCREMENT(exp->exp_obd, precreate);
 
-        rc = OBP(exp->exp_obd, precreate)(exp, need_create);
+        rc = OBP(exp->exp_obd, precreate)(exp);
         RETURN(rc);
 }
 
index fd136f3..2bf5761 100644 (file)
@@ -517,7 +517,7 @@ static int alloc_rr(struct lov_obd *lov, int *idx_arr, int *stripe_cnt,
                 /* If we have allocated from all of the OSTs, slowly
                    precess the next start */
                 lov->lov_start_idx %= ost_count;
-                if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt) != 1))
+                if (*stripe_cnt > 1 && (ost_active_count % (*stripe_cnt)) != 1)
                         ++lov->lov_offset_idx;
         }
         down_read(&lov->lov_qos.lq_rw_sem);
@@ -552,8 +552,7 @@ repeat_find :
                         continue;
 
                 /* Drop slow OSCs if we can */
-                if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) >
-                    speed)
+                if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed)
                         continue;
 
                 *idx_pos = ost_idx;
@@ -598,9 +597,9 @@ repeat_find:
                 if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && ost_idx == 0)
                         continue;
 
-                /* Drop slow OSCs if we can */
-                if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp, speed == 0) >
-                    speed)
+                /* Drop slow OSCs if we can, but not for requested start idx */
+                if (obd_precreate(lov->lov_tgts[ost_idx]->ltd_exp) > speed &&
+                    (i != 0 || speed < 2))
                         continue;
 
                 *idx_pos = ost_idx;
@@ -691,7 +690,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                 if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_PRECREATE) && i == 0)
                         continue;
 
-                if (obd_precreate(lov->lov_tgts[i]->ltd_exp, 1) > 2)
+                if (obd_precreate(lov->lov_tgts[i]->ltd_exp) > 2)
                         continue;
 
                 lov->lov_tgts[i]->ltd_qos.ltq_usable = 1;
index 71c8986..c26d2e3 100644 (file)
@@ -130,7 +130,8 @@ static int oscc_internal_create(struct osc_creator *oscc)
         int size[] = { sizeof(struct ptlrpc_body), sizeof(*body) };
         ENTRY;
 
-        spin_lock(&oscc->oscc_lock);
+        LASSERT_SPIN_LOCKED(&oscc->oscc_lock);
+
         if (oscc->oscc_grow_count < OST_MAX_PRECREATE &&
             !(oscc->oscc_flags & (OSCC_FLAG_LOW | OSCC_FLAG_RECOVERING)) &&
             (__s64)(oscc->oscc_last_id - oscc->oscc_next_id) <=
@@ -185,10 +186,12 @@ static int oscc_has_objects(struct osc_creator *oscc, int count)
         int have_objs;
         spin_lock(&oscc->oscc_lock);
         have_objs = ((__s64)(oscc->oscc_last_id - oscc->oscc_next_id) >= count);
-        spin_unlock(&oscc->oscc_lock);
 
-        if (!have_objs)
+        if (!have_objs) {
                 oscc_internal_create(oscc);
+        } else {
+                spin_unlock(&oscc->oscc_lock);
+        }
 
         return have_objs;
 }
@@ -252,7 +255,7 @@ int oscc_recovering(struct osc_creator *oscc)
             a potentially very long time
      1000 : unusable
  */
-int osc_precreate(struct obd_export *exp, int need_create)
+int osc_precreate(struct obd_export *exp)
 {
         struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
         struct obd_import *imp = exp->exp_imp_reverse;
@@ -276,13 +279,11 @@ int osc_precreate(struct obd_export *exp, int need_create)
                         spin_unlock(&oscc->oscc_lock);
                         RETURN(2);
                 }
-                spin_unlock(&oscc->oscc_lock);
-
-                if (oscc->oscc_flags & OSCC_FLAG_CREATING)
-                        RETURN(1);
 
-                if (!need_create)
+                if (oscc->oscc_flags & OSCC_FLAG_CREATING) {
+                        spin_unlock(&oscc->oscc_lock);
                         RETURN(1);
+                }
 
                 oscc_internal_create(oscc);
                 RETURN(1);
index eb9c79d..2f0f41b 100644 (file)
@@ -57,7 +57,7 @@ struct osc_cache_waiter {
 #define OSCC_FLAG_LOW                0x10
 #define OSCC_FLAG_EXITING            0x20
 
-int osc_precreate(struct obd_export *exp, int need_create);
+int osc_precreate(struct obd_export *exp);
 int osc_create(struct obd_export *exp, struct obdo *oa,
               struct lov_stripe_md **ea, struct obd_trans_info *oti);
 int osc_real_create(struct obd_export *exp, struct obdo *oa,