Whamcloud - gitweb
proper locking for the mod_count, remove assert for transaction while write_lock
authortappro <tappro>
Mon, 4 Sep 2006 08:50:25 +0000 (08:50 +0000)
committertappro <tappro>
Mon, 4 Sep 2006 08:50:25 +0000 (08:50 +0000)
lustre/mdd/mdd_handler.c
lustre/mdd/mdd_orphans.c
lustre/osd/osd_handler.c

index 00098c7..8da7e1d 100644 (file)
@@ -1149,7 +1149,7 @@ int __mdd_object_kill(const struct lu_context *ctxt,
         }
         return rc;
 }
-
+/* caller should take a lock before calling */
 static int __mdd_finish_unlink(const struct lu_context *ctxt,
                                struct mdd_object *obj, struct md_attr *ma,
                                struct thandle *th)
@@ -2035,7 +2035,7 @@ static int mdd_open(const struct lu_context *ctxt, struct md_object *obj,
         int mode = accmode(md2mdd_obj(obj), flags);
         int rc = 0;
 
-        mdd_read_lock(ctxt, md2mdd_obj(obj));
+        mdd_write_lock(ctxt, md2mdd_obj(obj));
 
         if (mode & MAY_WRITE) {
                 if (mdd_is_immutable(md2mdd_obj(obj)))
@@ -2045,7 +2045,7 @@ static int mdd_open(const struct lu_context *ctxt, struct md_object *obj,
         if (rc == 0)
                 md2mdd_obj(obj)->mod_count ++;
 
-        mdd_read_unlock(ctxt, md2mdd_obj(obj));
+        mdd_write_unlock(ctxt, md2mdd_obj(obj));
         return rc;
 }
 
index 6adce75..4f35c92 100644 (file)
@@ -118,6 +118,7 @@ static void orph_key_test_and_del(const struct lu_context *ctx,
         if (IS_ERR(mdo))
                 CERROR("Invalid orphan!\n");
         else {
+                mdd_write_lock(ctx, mdo);
                 if (mdo->mod_count == 0) {
                         /* non-opened orphan, let's delete it */
                         struct md_attr *ma = &mdd_ctx_info(ctx)->mti_ma;
@@ -126,6 +127,7 @@ static void orph_key_test_and_del(const struct lu_context *ctx,
                         //mdd_ost_objects_destroy(ctx, ma);
                         /* TODO: destroy index entry */
                 }
+                mdd_write_unlock(ctx, mdo);
                 mdd_object_put(ctx, mdo);
         }        
 }
index 24cd390..238596a 100644 (file)
@@ -638,7 +638,9 @@ static void osd_object_write_lock(const struct lu_context *ctx,
         /*
          * Write lock assumes transaction.
          */
-        LASSERT(oti->oti_txns > 0);
+        /* open need it without transaction
+         * LASSERT(oti->oti_txns > 0);
+        */
         obj->oo_owner = ctx;
         oti->oti_w_locks++;
 }