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: