1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

ctdb-daemon: Check for lock count underflow

This is a programming error.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2020-02-17 16:20:25 +11:00 committed by Amitay Isaacs
parent c16da0e8f0
commit c9405aec70

View File

@ -198,6 +198,9 @@ static int ctdb_lock_context_destructor(struct lock_context *lock_ctx)
} else {
DLIST_REMOVE(lock_ctx->ctdb->lock_current, lock_ctx);
}
if (lock_ctx->ctdb_db->lock_num_current == 0) {
ctdb_fatal(NULL, "Lock count is 0 before decrement\n");
}
lock_ctx->ctdb_db->lock_num_current--;
CTDB_DECREMENT_STAT(lock_ctx->ctdb, locks.num_current);
CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_current);