Whamcloud - gitweb
Don't allow skipping OSTs if index has been specified.
authorshadow <shadow>
Tue, 5 Feb 2008 11:49:53 +0000 (11:49 +0000)
committershadow <shadow>
Tue, 5 Feb 2008 11:49:53 +0000 (11:49 +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 ad8473c..870d100 100644 (file)
@@ -12,6 +12,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
+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   : enhancement
 Bugzilla   : 14482
 Description: Add rhel5 support to HEAD.
index 1515bab..7ef0ee7 100644 (file)
@@ -1095,7 +1095,7 @@ struct obd_ops {
         int (*o_preallocate)(struct lustre_handle *, obd_count *req,
                              obd_id *ids);
         /* FIXME: add fid capability support for create & destroy! */
-        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 94cd618..8915c2a 100644 (file)
@@ -642,7 +642,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;
@@ -650,7 +650,7 @@ static inline int obd_precreate(struct obd_export *exp, int need_create)
         EXP_CHECK_DT_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 37ce370..c21f8b0 100644 (file)
@@ -566,8 +566,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;
@@ -613,8 +612,8 @@ 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) &&
+                    (i != 0 || speed < 2))
                         continue;
 
                 *idx_pos = ost_idx;
@@ -682,9 +681,9 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
                 GOTO(out_up_write, rc = -EAGAIN);
 
         rc = qos_calc_ppo(exp->exp_obd);
-        if (rc) 
+        if (rc)
                 GOTO(out_up_write, rc);
-        
+
         total_bavail = 0;
         good_osts = 0;
         /* Warn users about zero available space/inode every 30 min */
@@ -693,7 +692,7 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt,
         /* Find all the OSTs that are valid stripe candidates */
         for (i = 0; i < ost_count; i++) {
                 __u64 bavail;
-                
+
                 if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active)
                         continue;
                 bavail = TGT_BAVAIL(i);
@@ -719,7 +718,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 d79be2f..a781b22 100644 (file)
@@ -125,7 +125,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) <=
@@ -181,10 +182,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;
 }
@@ -248,7 +251,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;
@@ -272,13 +275,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 e81d54f..89f341c 100644 (file)
@@ -54,7 +54,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,