Whamcloud - gitweb
LU-6530 lod: do index_try for sub stripe 21/14621/4
authorwang di <di.wang@intel.com>
Fri, 1 May 2015 14:21:07 +0000 (07:21 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 30 May 2015 02:46:00 +0000 (02:46 +0000)
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 <di.wang@intel.com>
Change-Id: I83b45866f1d048530782262f7502cf9f51491741
Reviewed-on: http://review.whamcloud.com/14621
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_object.c

index a87c4e8..642cda8 100644 (file)
@@ -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;