From: John L. Hammond Date: Thu, 24 Jul 2014 19:59:05 +0000 (-0500) Subject: LU-5410 mdd: return errors from mdo_declare_ref_add() X-Git-Tag: 2.6.51~20 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F11222%2F2;p=fs%2Flustre-release.git LU-5410 mdd: return errors from mdo_declare_ref_add() In mdd_declare_object_initialize() ensure that errors from mdo_declare_ref_add() are returned. Signed-off-by: John L. Hammond Change-Id: I8ae9fa009577f862522f905b15fc6ee71ee00306 Reviewed-on: http://review.whamcloud.com/11222 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- 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); }