From: tappro Date: Tue, 18 Jul 2006 11:05:13 +0000 (+0000) Subject: increase nlink if dir is created X-Git-Tag: v1_8_0_110~486^2~1395 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=86ff8446e08ba05862c610423787870edb356340;p=fs%2Flustre-release.git increase nlink if dir is created --- diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index 55ad6ed..f59ee72 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -383,6 +383,9 @@ static int __mdd_object_create(const struct lu_context *ctxt, rc = -EEXIST; LASSERT(ergo(rc == 0, lu_object_exists(ctxt, &obj->mod_obj.mo_lu))); + /* increase the nlink for directory */ + if (rc == 0 && dt_is_dir(ctxt, mdd_object_child(obj))) + rc = __mdd_ref_add(ctxt, obj, handle); /*XXX increase the refcount of the object or not?*/ RETURN(rc); } @@ -749,7 +752,7 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj, if (rc) RETURN(rc); } - + mdd_txn_param_build(ctxt, &MDD_TXN_MKDIR); handle = mdd_trans_start(ctxt, mdd); if (IS_ERR(handle)) @@ -800,6 +803,7 @@ static int mdd_create(const struct lu_context *ctxt, struct md_object *pobj, GOTO(cleanup, rc); created = 1; + rc = __mdd_index_insert(ctxt, mdo, lu_object_fid(&child->mo_lu), name, handle);