Whamcloud - gitweb
- fix bug with missed object_put() in error case
authortappro <tappro>
Wed, 20 Sep 2006 19:36:32 +0000 (19:36 +0000)
committertappro <tappro>
Wed, 20 Sep 2006 19:36:32 +0000 (19:36 +0000)
- call mdt_handle_last_unlink() after rename only if it was successfull

lustre/mdd/mdd_handler.c
lustre/mdt/mdt_reint.c

index 14ad780..ea5c21b 100644 (file)
@@ -1492,7 +1492,7 @@ static int mdd_rename(const struct lu_context *ctxt, struct md_object *src_pobj,
         struct mdd_device *mdd = mdo2mdd(src_pobj);
         struct mdd_object *mdd_spobj = md2mdd_obj(src_pobj);
         struct mdd_object *mdd_tpobj = md2mdd_obj(tgt_pobj);
-        struct mdd_object *mdd_sobj = mdd_object_find(ctxt, mdd, lf);
+        struct mdd_object *mdd_sobj = NULL;
         struct mdd_object *mdd_tobj = NULL;
         struct lu_attr    *la_copy = &mdd_ctx_info(ctxt)->mti_la_for_fix;
         struct thandle *handle;
@@ -1544,6 +1544,7 @@ static int mdd_rename(const struct lu_context *ctxt, struct md_object *src_pobj,
         if (rc)
                 GOTO(cleanup, rc);
 
+        mdd_sobj = mdd_object_find(ctxt, mdd, lf);
         *la_copy = ma->ma_attr;
         la_copy->la_valid = LA_CTIME;
         if (mdd_sobj) {
index 52d0ae5..f4bec50 100644 (file)
@@ -493,11 +493,10 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info)
         }
 
         /* handle last link of tgt object */
-        if (mtgt)
+        if (rc == 0 && mtgt)
                 mdt_handle_last_unlink(info, mtgt, ma);
 
-        GOTO(out_unlock_tgt, rc);
-
+        EXIT;
 out_unlock_tgt:
         if (mtgt) {
                 mdt_object_unlock_put(info, mtgt, lh_tgt, rc);
@@ -712,7 +711,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info)
                         (mnew ? mdt_object_child(mnew) : NULL), rr->rr_tgt, ma);
         
         /* handle last link of tgt object */
-        if (mnew)
+        if (rc == 0 && mnew)
                 mdt_handle_last_unlink(info, mnew, ma);
 
 out_unlock_new: