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.
This commit is contained in:
Willy Tarreau 2019-05-20 11:09:00 +02:00
parent 619a95f5ad
commit 64a47b943c

View File

@ -594,7 +594,7 @@ int mem_should_fail(const struct pool_head *pool)
else else
ret = 0; 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], n = snprintf(&mem_fail_str[mem_fail_cur_idx * MEM_FAIL_MAX_CHAR],
MEM_FAIL_MAX_CHAR - 2, MEM_FAIL_MAX_CHAR - 2,
"%d %.18s %d %d", mem_fail_cur_idx, pool->name, ret, tid); "%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++; mem_fail_cur_idx++;
if (mem_fail_cur_idx == MEM_FAIL_MAX_STR) if (mem_fail_cur_idx == MEM_FAIL_MAX_STR)
mem_fail_cur_idx = 0; mem_fail_cur_idx = 0;
HA_SPIN_UNLOCK(START_LOCK, &mem_fail_lock); HA_SPIN_UNLOCK(OTHER_LOCK, &mem_fail_lock);
return ret; return ret;
} }