From: wang di Date: Fri, 1 May 2015 14:21:07 +0000 (-0700) Subject: LU-6530 lod: do index_try for sub stripe X-Git-Tag: 2.7.55~35 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ef4a8c9e0993041aca3cd4d5b24948def1a9a47c;p=fs%2Flustre-release.git LU-6530 lod: do index_try for sub stripe In lod_striped_it_next(), for each sub_stripe, it should call index_try to initialize index operation, then access it. Set lit_it to NULL in lod_striped_it_next(), so once failure happens, lod_striped_it_fini will not finish the sub_it twice. see (LU-5337). Signed-off-by: wang di Change-Id: I83b45866f1d048530782262f7502cf9f51491741 Reviewed-on: http://review.whamcloud.com/14621 Tested-by: Jenkins Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index a87c4e8..642cda8 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -439,13 +439,17 @@ static void lod_striped_it_fini(const struct lu_env *env, struct dt_it *di) struct lod_object *lo = lod_dt_obj(it->lit_obj); struct dt_object *next; - LOD_CHECK_STRIPED_IT(env, it, lo); + /* If lit_it == NULL, then it means the sub_it has been finished, + * which only happens in failure cases, see lod_striped_it_next() */ + if (it->lit_it != NULL) { + LOD_CHECK_STRIPED_IT(env, it, lo); - next = lo->ldo_stripe[it->lit_stripe_index]; - LASSERT(next != NULL); - LASSERT(next->do_index_ops != NULL); + next = lo->ldo_stripe[it->lit_stripe_index]; + LASSERT(next != NULL); + LASSERT(next->do_index_ops != NULL); - next->do_index_ops->dio_it.fini(env, it->lit_it); + next->do_index_ops->dio_it.fini(env, it->lit_it); + } /* the iterator not in use any more */ it->lit_obj = NULL; @@ -562,15 +566,16 @@ again: next->do_index_ops->dio_it.put(env, it->lit_it); next->do_index_ops->dio_it.fini(env, it->lit_it); - - rc = next->do_ops->do_index_try(env, next, &dt_directory_features); - if (rc != 0) - RETURN(rc); + it->lit_it = NULL; next = lo->ldo_stripe[it->lit_stripe_index]; LASSERT(next != NULL); LASSERT(next->do_index_ops != NULL); + rc = next->do_ops->do_index_try(env, next, &dt_directory_features); + if (rc != 0) + RETURN(rc); + it_next = next->do_index_ops->dio_it.init(env, next, it->lit_attr); if (!IS_ERR(it_next)) { it->lit_it = it_next;