From: Willy Tarreau Date: Mon, 20 May 2019 09:09:00 +0000 (+0200) Subject: CLEANUP: memory: make the fault injection code use the OTHER_LOCK label X-Git-Tag: v2.0-dev4~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64a47b943cd51ba23986663ee80f1884c9f76a2f;p=thirdparty%2Fhaproxy.git CLEANUP: memory: make the fault injection code use the OTHER_LOCK label 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. --- diff --git a/src/memory.c b/src/memory.c index 140671bc14..6555913de6 100644 --- a/src/memory.c +++ b/src/memory.c @@ -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; }