X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flfsck%2Flfsck_lib.c;h=64da23836615eebebfbece6687d931d53da5c00a;hb=1ebc9ed460922e6fcf2432f70f2f6412974e963a;hp=7e36a18f8d1513e11eaec2475d6dd871402184e8;hpb=40daa59ac41f450b60b42eb2bb0ff42ebd3c998b;p=fs%2Flustre-release.git diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index 7e36a18..64da238 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -697,7 +697,7 @@ static int lfsck_create_lpf_local(const struct lu_env *env, if (rc != 0) GOTO(stop, rc); - if (!dt_try_as_dir(env, child)) + if (!dt_try_as_dir(env, child, false)) GOTO(stop, rc = -ENOTDIR); /* 2a. increase child nlink */ @@ -875,7 +875,7 @@ static int lfsck_create_lpf_remote(const struct lu_env *env, if (rc != 0) GOTO(stop, rc); - if (!dt_try_as_dir(env, child)) + if (!dt_try_as_dir(env, child, false)) GOTO(stop, rc = -ENOTDIR); /* 2a. increase child nlink */ @@ -1077,8 +1077,8 @@ static int lfsck_create_lpf(const struct lu_env *env, if (IS_ERR(child)) GOTO(unlock, rc = PTR_ERR(child)); - if (dt_object_exists(child) != 0) { - if (unlikely(!dt_try_as_dir(env, child))) + if (dt_object_exists(child)) { + if (unlikely(!dt_try_as_dir(env, child, true))) rc = -ENOTDIR; else lfsck->li_lpf_obj = child; @@ -1293,13 +1293,7 @@ static int lfsck_verify_lpf_pairs(const struct lu_env *env, if (IS_ERR(parent2)) GOTO(linkea, parent2); - if (!dt_object_exists(parent2)) { - lfsck_object_put(env, parent2); - - GOTO(linkea, parent2 = ERR_PTR(-ENOENT)); - } - - if (!dt_try_as_dir(env, parent2)) { + if (!dt_try_as_dir(env, parent2, true)) { lfsck_object_put(env, parent2); GOTO(linkea, parent2 = ERR_PTR(-ENOTDIR)); @@ -1450,7 +1444,7 @@ int lfsck_verify_lpf(const struct lu_env *env, struct lfsck_instance *lfsck) LASSERT(dt_object_exists(parent)); - if (unlikely(!dt_try_as_dir(env, parent))) { + if (unlikely(!dt_try_as_dir(env, parent, true))) { lfsck_object_put(env, parent); GOTO(put, rc = -ENOTDIR); @@ -1499,7 +1493,7 @@ int lfsck_verify_lpf(const struct lu_env *env, struct lfsck_instance *lfsck) goto find_child1; } - if (unlikely(!dt_try_as_dir(env, child2))) + if (unlikely(!dt_try_as_dir(env, child2, true))) GOTO(put, rc = -ENOTDIR); find_child1: @@ -1562,7 +1556,7 @@ find_child1: goto check_child2; } - if (unlikely(!dt_try_as_dir(env, child1))) { + if (unlikely(!dt_try_as_dir(env, child1, true))) { lfsck_object_put(env, child1); child1 = NULL; rc = -ENOTDIR; @@ -1583,7 +1577,7 @@ check_child2: put: if (lfsck->li_lpf_obj != NULL) { - if (unlikely(!dt_try_as_dir(env, lfsck->li_lpf_obj))) { + if (unlikely(!dt_try_as_dir(env, lfsck->li_lpf_obj, true))) { lfsck_object_put(env, lfsck->li_lpf_obj); lfsck->li_lpf_obj = NULL; rc = -ENOTDIR; @@ -2021,7 +2015,7 @@ lfsck_assistant_object_load(const struct lu_env *env, return ERR_PTR(-ENOENT); } - if (lso->lso_is_dir && unlikely(!dt_try_as_dir(env, obj))) { + if (lso->lso_is_dir && unlikely(!dt_try_as_dir(env, obj, true))) { lfsck_object_put(env, obj); return ERR_PTR(-ENOTDIR); @@ -3738,9 +3732,6 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key, if (rc != 0) GOTO(out, rc); - if (unlikely(!dt_try_as_dir(env, obj))) - GOTO(out, rc = -ENOTDIR); - *pfid = *fid; rc = dt_lookup_dir(env, obj, lostfound, fid); if (rc != 0)