Whamcloud - gitweb
- disable not used label in lmv;
authoryury <yury>
Sun, 10 Dec 2006 12:26:33 +0000 (12:26 +0000)
committeryury <yury>
Sun, 10 Dec 2006 12:26:33 +0000 (12:26 +0000)
- fixed two possible races in lov about checking lov_qos.lq_dirty_rr.

lustre/lmv/lmv_obd.c
lustre/lov/lov_qos.c

index 2264e4c..ca7e751 100644 (file)
@@ -743,9 +743,9 @@ static int lmv_nid_policy(struct lmv_obd *lmv)
 {
         struct obd_import *imp = class_exp2cliimp(lmv->tgts[0].ltd_exp);
         __u32 id;
-       /*
-        * XXX Hack: to get nid we assume that underlying obd device is mdc.
-        */
+        /*
+         * XXX Hack: to get nid we assume that underlying obd device is mdc.
+         */
         id = imp->imp_connection->c_self ^ (imp->imp_connection->c_self >> 32);
         return id % lmv->desc.ld_tgt_count;
 }
@@ -831,7 +831,9 @@ static int lmv_placement_policy(struct obd_device *obd,
                 rc = 0;
         }
         EXIT;
+#if 0
 out:
+#endif
         if (rc) {
                 CERROR("Can't choose MDS, err = %d\n", rc);
         } else {
index 616b2b8..5980721 100644 (file)
@@ -341,6 +341,17 @@ static int qos_calc_rr(struct lov_obd *lov)
 
         /* Do actuall allocation. */
         down_write(&lov->lov_qos.lq_rw_sem);
+
+        /*
+         * Check again. While we were sleeping on @lq_rw_sem something could
+         * change.
+         */
+        if (!lov->lov_qos.lq_dirty_rr) {
+                LASSERT(lov->lov_qos.lq_rr_size);
+                up_write(&lov->lov_qos.lq_rw_sem);
+                RETURN(0);
+        }
+
         ost_count = lov->desc.ld_tgt_count;
 
         if (lov->lov_qos.lq_rr_size) 
@@ -593,6 +604,15 @@ static int alloc_qos(struct obd_export *exp, int *idx_arr, int *stripe_cnt)
         
         /* Do actuall allocation, use write lock here. */
         down_write(&lov->lov_qos.lq_rw_sem);
+
+        /* 
+         * Check again, while we were sleeping on @lq_rw_sem things could
+         * change.
+         */
+        if (!lov->lov_qos.lq_dirty) {
+                up_write(&lov->lov_qos.lq_rw_sem);
+                GOTO(out, rc = -EAGAIN);
+        }
         ost_count = lov->desc.ld_tgt_count;
 
         if (lov->desc.ld_active_tgt_count < 2)