From 6629a18a69d1aaab6183bd573e085aa777aa26ca Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Tue, 27 Mar 2018 15:30:04 -0700 Subject: [PATCH] modules/kvs: Initialize walk at new time Move where the lookup walk() is initialized, so that it is initialized just before beginning a walk(). --- src/modules/kvs/lookup.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/modules/kvs/lookup.c b/src/modules/kvs/lookup.c index 2179d6d5cfb1..25b3bead35e2 100644 --- a/src/modules/kvs/lookup.c +++ b/src/modules/kvs/lookup.c @@ -104,6 +104,7 @@ struct lookup { LOOKUP_STATE_INIT, LOOKUP_STATE_CHECK_NAMESPACE, LOOKUP_STATE_CHECK_ROOT, + LOOKUP_STATE_WALK_INIT, LOOKUP_STATE_WALK, LOOKUP_STATE_VALUE, LOOKUP_STATE_FINISHED, @@ -840,17 +841,6 @@ lookup_process_t lookup (lookup_t *lh) } } - if (!(lh->root_dirent = treeobj_create_dirref (lh->root_ref))) { - lh->errnum = errno; - goto error; - } - - /* initialize walk - first depth is level 0 */ - if (!walk_levels_push (lh, lh->path, 0)) { - lh->errnum = errno; - goto error; - } - lh->state = LOOKUP_STATE_CHECK_ROOT; /* fallthrough */ case LOOKUP_STATE_CHECK_ROOT: @@ -898,6 +888,21 @@ lookup_process_t lookup (lookup_t *lh) goto done; } + lh->state = LOOKUP_STATE_WALK_INIT; + /* fallthrough */ + case LOOKUP_STATE_WALK_INIT: + /* initialize walk - first depth is level 0 */ + + if (!(lh->root_dirent = treeobj_create_dirref (lh->root_ref))) { + lh->errnum = errno; + goto error; + } + + if (!walk_levels_push (lh, lh->path, 0)) { + lh->errnum = errno; + goto error; + } + lh->state = LOOKUP_STATE_WALK; /* fallthrough */ case LOOKUP_STATE_WALK: