From a6e2846b605f07bf1561434a52c4347bc0771ac2 Mon Sep 17 00:00:00 2001 From: tappro Date: Wed, 20 Sep 2006 19:36:32 +0000 Subject: [PATCH] - fix bug with missed object_put() in error case - call mdt_handle_last_unlink() after rename only if it was successfull --- lustre/mdd/mdd_handler.c | 3 ++- lustre/mdt/mdt_reint.c | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index 14ad780..ea5c21b 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -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) { diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 52d0ae5..f4bec50 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -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: -- 1.8.3.1