Skip to content

Commit

Permalink
modules/kvs: Add fence checks
Browse files Browse the repository at this point in the history
Previously, fences could be updated with new flags.  Instead,
require users to always specify the same nprocs and flags with
each fence request.  Return error if user does not.

Fixes #1305
  • Loading branch information
chu11 committed Feb 9, 2018
1 parent 04df016 commit d9a984b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/modules/kvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,12 @@ static void relayfence_request_cb (flux_t *h, flux_msg_handler_t *mh,
}
}

if (fence_get_flags (f) != flags
|| fence_get_nprocs (f) != nprocs) {
errno = EINVAL;
goto error;
}

if (fence_add_request_data (f, ops) < 0) {
flux_log_error (h, "%s: fence_add_request_data", __FUNCTION__);
goto error;
Expand Down Expand Up @@ -1792,8 +1798,12 @@ static void fence_request_cb (flux_t *h, flux_msg_handler_t *mh,
goto error;
}
}
else
fence_set_flags (f, fence_get_flags (f) | flags);

if (fence_get_flags (f) != flags
|| fence_get_nprocs (f) != nprocs) {
errno = EINVAL;
goto error;
}

if (fence_add_request_copy (f, msg) < 0)
goto error;
Expand Down

0 comments on commit d9a984b

Please sign in to comment.