Skip to content

Commit f13e2e6

Browse files
committed
kvs: do not pass lookup handle to getroot()
Problem: A lookup handle is passed to getroot() only because it has to be passed to getroot_request_send() in case the getroot() call will stall. This is legacy behavior from when flux_msg_copy() had to be used instead of flux_msg_incref(). Solution: Set the lookup handle as aux data in the message if we are stalling in lookup_common(). Remove the need to pass the handle as a parameter to getroot().
1 parent ea0cdbc commit f13e2e6

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/modules/kvs/kvs.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,7 @@ static void getroot_completion (flux_future_t *f, void *arg)
399399
static int getroot_request_send (struct kvs_ctx *ctx,
400400
const char *ns,
401401
flux_msg_handler_t *mh,
402-
const flux_msg_t *msg,
403-
lookup_t *lh)
402+
const flux_msg_t *msg)
404403
{
405404
flux_future_t *f = NULL;
406405
int saved_errno;
@@ -422,12 +421,6 @@ static int getroot_request_send (struct kvs_ctx *ctx,
422421
goto error;
423422
}
424423

425-
if (lh
426-
&& flux_msg_aux_set (msg, "lookup_handle", lh, NULL) < 0) {
427-
flux_log_error (ctx->h, "%s: flux_msg_aux_set", __FUNCTION__);
428-
goto error;
429-
}
430-
431424
if (flux_future_then (f, -1., getroot_completion, ctx) < 0)
432425
goto error;
433426

@@ -443,7 +436,6 @@ static struct kvsroot *getroot (struct kvs_ctx *ctx,
443436
const char *ns,
444437
flux_msg_handler_t *mh,
445438
const flux_msg_t *msg,
446-
lookup_t *lh,
447439
bool *stall)
448440
{
449441
struct kvsroot *root;
@@ -456,7 +448,7 @@ static struct kvsroot *getroot (struct kvs_ctx *ctx,
456448
return NULL;
457449
}
458450
else {
459-
if (getroot_request_send (ctx, ns, mh, msg, lh) < 0) {
451+
if (getroot_request_send (ctx, ns, mh, msg) < 0) {
460452
flux_log_error (ctx->h, "getroot_request_send");
461453
return NULL;
462454
}
@@ -1424,11 +1416,16 @@ static lookup_t *lookup_common (flux_t *h,
14241416
ns = lookup_missing_namespace (lh);
14251417
assert (ns);
14261418

1427-
root = getroot (ctx, ns, mh, msg, lh, &stall);
1419+
root = getroot (ctx, ns, mh, msg, &stall);
14281420
assert (!root);
14291421

1430-
if (stall)
1422+
if (stall) {
1423+
if (flux_msg_aux_set (msg, "lookup_handle", lh, NULL) < 0) {
1424+
flux_log_error (ctx->h, "%s: flux_msg_aux_set", __FUNCTION__);
1425+
goto done;
1426+
}
14311427
goto stall;
1428+
}
14321429
goto done;
14331430
}
14341431
else if (lret == LOOKUP_PROCESS_LOAD_MISSING_REFS) {
@@ -1752,7 +1749,7 @@ static void commit_request_cb (flux_t *h,
17521749
goto error;
17531750
}
17541751

1755-
if (!(root = getroot (ctx, ns, mh, msg, NULL, &stall))) {
1752+
if (!(root = getroot (ctx, ns, mh, msg, &stall))) {
17561753
if (stall) {
17571754
request_tracking_add (ctx, msg);
17581755
return;
@@ -1840,7 +1837,7 @@ static void wait_version_request_cb (flux_t *h,
18401837
goto error;
18411838
}
18421839

1843-
if (!(root = getroot (ctx, ns, mh, msg, NULL, &stall))) {
1840+
if (!(root = getroot (ctx, ns, mh, msg, &stall))) {
18441841
if (stall) {
18451842
request_tracking_add (ctx, msg);
18461843
return;
@@ -1906,7 +1903,7 @@ static void getroot_request_cb (flux_t *h, flux_msg_handler_t *mh,
19061903
* first.
19071904
*/
19081905
bool stall = false;
1909-
if (!(root = getroot (ctx, ns, mh, msg, NULL, &stall))) {
1906+
if (!(root = getroot (ctx, ns, mh, msg, &stall))) {
19101907
if (stall) {
19111908
request_tracking_add (ctx, msg);
19121909
return;
@@ -2531,7 +2528,7 @@ static void setroot_pause_request_cb (flux_t *h,
25312528
goto error;
25322529
}
25332530

2534-
if (!(root = getroot (ctx, ns, mh, msg, NULL, &stall))) {
2531+
if (!(root = getroot (ctx, ns, mh, msg, &stall))) {
25352532
if (stall)
25362533
return;
25372534
goto error;
@@ -2596,7 +2593,7 @@ static void setroot_unpause_request_cb (flux_t *h,
25962593
goto error;
25972594
}
25982595

2599-
if (!(root = getroot (ctx, ns, mh, msg, NULL, &stall))) {
2596+
if (!(root = getroot (ctx, ns, mh, msg, &stall))) {
26002597
if (stall)
26012598
return;
26022599
goto error;

0 commit comments

Comments
 (0)