X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdd%2Fmdd_dir.c;h=81b7e012cc81f4d68d9360b6e79a0ddcb93a6ef2;hb=3d2a509b1e3c9791a62d9edd0f1a534f4238fe16;hp=49389e013ac4aeb781f84464cc0eea1db39b5892;hpb=7838c76d7c0e57db782016053a590978ec9abdef;p=fs%2Flustre-release.git diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 49389e0..81b7e01 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1823,15 +1823,20 @@ static int mdd_declare_object_initialize(const struct lu_env *env, attr->la_valid &= ~(LA_MODE | LA_TYPE); rc = mdo_declare_attr_set(env, child, attr, handle); attr->la_valid |= LA_MODE | LA_TYPE; - if (rc == 0 && S_ISDIR(attr->la_mode)) { - rc = mdo_declare_index_insert(env, child, mdo2fid(child), - S_IFDIR, dot, handle); - if (rc == 0) - rc = mdo_declare_ref_add(env, child, handle); + if (rc != 0 || !S_ISDIR(attr->la_mode)) + RETURN(rc); - rc = mdo_declare_index_insert(env, child, mdo2fid(parent), - S_IFDIR, dotdot, handle); - } + rc = mdo_declare_index_insert(env, child, mdo2fid(child), S_IFDIR, + dot, handle); + if (rc != 0) + RETURN(rc); + + rc = mdo_declare_ref_add(env, child, handle); + if (rc != 0) + RETURN(rc); + + rc = mdo_declare_index_insert(env, child, mdo2fid(parent), S_IFDIR, + dotdot, handle); RETURN(rc); }