]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Stop holding the write lock when the SLURM is loaded
authorpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 16:36:04 +0000 (10:36 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 16:36:04 +0000 (10:36 -0600)
There's no need to hold the lock, the SLURM loading action doesn't modify the current DB state; it's altering the new DB state, which will be utilized later to replace the current DB state (and that's where the lock is needed).

src/rtr/db/vrps.c

index be7f3bddc76a0bb631cb992b7c5df6c28a14effe..03ed98eeff2fd3af1c6d93153b03156a79555f62 100644 (file)
@@ -289,14 +289,14 @@ __vrps_update(bool *changed)
        if (error)
                return error;
 
-       rwlock_write_lock(&state_lock);
-
        error = slurm_apply(&new_base, &state.slurm);
        if (error) {
                rwlock_unlock(&state_lock);
                goto revert_base;
        }
 
+       rwlock_write_lock(&state_lock);
+
        if (state.base != NULL) {
                error = compute_deltas(state.base, new_base, &deltas);
                if (error) {