]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: memory: make the fault injection code use the OTHER_LOCK label
authorWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 09:09:00 +0000 (11:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 09:26:12 +0000 (11:26 +0200)
The mem_should_fail() function sets a lock while it's building its
messages, and when this was done there was no relevant label available
hence the confusing use of START_LOCK. Now OTHER_LOCK is available for
such use cases, so let's switch to this one instead as START_LOCK is
going to disappear.

src/memory.c

index 140671bc140d0494352bd42d24093d646cc5d043..6555913de6335fc5c52e810d7bb6af37fd006d06 100644 (file)
@@ -594,7 +594,7 @@ int mem_should_fail(const struct pool_head *pool)
                else
                        ret = 0;
        }
-       HA_SPIN_LOCK(START_LOCK, &mem_fail_lock);
+       HA_SPIN_LOCK(OTHER_LOCK, &mem_fail_lock);
        n = snprintf(&mem_fail_str[mem_fail_cur_idx * MEM_FAIL_MAX_CHAR],
            MEM_FAIL_MAX_CHAR - 2,
            "%d %.18s %d %d", mem_fail_cur_idx, pool->name, ret, tid);
@@ -607,7 +607,7 @@ int mem_should_fail(const struct pool_head *pool)
        mem_fail_cur_idx++;
        if (mem_fail_cur_idx == MEM_FAIL_MAX_STR)
                mem_fail_cur_idx = 0;
-       HA_SPIN_UNLOCK(START_LOCK, &mem_fail_lock);
+       HA_SPIN_UNLOCK(OTHER_LOCK, &mem_fail_lock);
        return ret;
 
 }