Whamcloud - gitweb
- fix invalid conditon during check that fid2 is valid
authortappro <tappro>
Thu, 24 Aug 2006 22:42:53 +0000 (22:42 +0000)
committertappro <tappro>
Thu, 24 Aug 2006 22:42:53 +0000 (22:42 +0000)
- do lock_decref only if rc != 0
- set special policy for mkdir to test croff-ref cases

lustre/lmv/lmv_intent.c
lustre/lmv/lmv_obd.c

index bdb7be4..97edb0e 100644 (file)
@@ -130,7 +130,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm,
         OBD_FREE_PTR(op_data);
         EXIT;
 out:
-        if (pmode)
+        if (rc && pmode)
                 ldlm_lock_decref(&plock, pmode);
 
         ptlrpc_req_finished(*reqp);
@@ -707,7 +707,6 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                     int extra_lock_flags)
 {
         struct obd_device *obd = exp->exp_obd;
-        struct lmv_obd *lmv = &obd->u.lmv;
         const char *name = op_data->name;
         int len = op_data->namelen;
         struct lu_fid *pid, *cid;
@@ -719,8 +718,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
         
         pid = &op_data->fid1;
         
-        cid = !fid_is_sane(&op_data->fid2) ?
-                &op_data->fid2 : NULL;
+        cid = fid_is_sane(&op_data->fid2) ? &op_data->fid2 : NULL;
 
         CDEBUG(D_OTHER, "INTENT LOCK '%s' for '%*s' on "DFID"\n",
                LL_IT2STR(it), len, name, PFID(pid));
index c71381f..901fdb4 100644 (file)
@@ -675,9 +675,17 @@ static int lmv_placement_policy(struct obd_device *obd,
                  * balanced, that is all sequences have more or less equal
                  * number of objects created. */
                 if (hint->ph_cname && (hint->ph_opc == LUSTRE_OPC_MKDIR)) {
+#if 0
                         *mds = lmv_all_chars_policy(lmv->desc.ld_tgt_count,
                                                     hint->ph_cname);
                         rc = 0;
+#else
+                        /* stress policy for tests - to use non-parent MDS */
+                        LASSERT(fid_is_sane(hint->ph_pfid));
+                        rc = lmv_fld_lookup(lmv, hint->ph_pfid, mds);
+                        *mds = (int)(*mds + 1) % lmv->desc.ld_tgt_count;
+
+#endif
                 } else {
                         /* default policy is to use parent MDS */
                         LASSERT(fid_is_sane(hint->ph_pfid));
@@ -1963,10 +1971,10 @@ static int lmv_unlink(struct obd_export *exp, struct md_op_data *op_data,
                                          op_data->name, op_data->namelen);
                         op_data->fid1 = obj->lo_inodes[i].li_fid;
                         lmv_obj_put(obj);
+                        CDEBUG(D_OTHER, "unlink '%*s' in "DFID" -> %u\n",
+                               op_data->namelen, op_data->name,
+                               PFID(&op_data->fid1), i);
                 }
-                CDEBUG(D_OTHER, "unlink '%*s' in "DFID" -> %u\n",
-                       op_data->namelen, op_data->name, PFID(&op_data->fid1),
-                       i);
         } else {
                 CDEBUG(D_OTHER, "drop i_nlink on "DFID"\n",
                        PFID(&op_data->fid1));