ctdb-locking: Pass additional arguments to debug locks script 1. PID of lock helper waiting for lock 2. Scope of lock: "record" or "db" 3. Path to database that lock helper is trying to lock 4. Whether the database uses mutexes: "mutex" or "fcntl" Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
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>
ctdb-daemon: Don't check if lock_ctx->ctdb_db is NULL This can never be NULL. It could probably be NULL in the past when "all database" locks existed. There are paths where is is checked for NULL and then later dereferenced, causing static analysers to produce spurious warnings. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-daemon: Attempt to silence CID 1357985 (Unchecked return value) Yes, the other callers check the return value of ctdb_lockdb_mark(). However, this is called in a void function and ctdb_lockdb_mark() has already printed any error message. All we can do is explicitly ignore the return value. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb-locking: Get tdb open flags from tdb instead of re-calculating Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: If a record could not be locked, log the key Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Mon Jun 19 19:56:22 CEST 2017 on sn-devel-144
ctdb-locking: Reduce logging in case of contention Currently, every lock helper will log a message if it cannot get a lock. This can spam the logs and overwhelm syslog if there are hundreds of lock helpers waiting for contended record. Instead keep track of the record for which we have already logged once with specific timeout interval. If we get timeout interval larger than the previously logged interval, then log again once. This will reduce the amount of logs for contended records to a single log entry per 10 seconds per record. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: There are no ALLDB locks any more Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Explicitly unlock record/db in lock helper BUG: https://bugzilla.samba.org/show_bug.cgi?id=12469 Instead of killing lock helper processes with SIGKILL, send SIGTERM so lock helper processes can explicitly unlock record/db. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Start locking helper using ctdb_vfork_exec This avoids the extra argument of logfd to ctdb_lock_helper. The log messages from lock helper are captured by ctdbd. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-common: Drop CTDB's copy of sys_read() and sys_write() Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Tue Nov 29 11:22:40 CET 2016 on sn-devel-144
ctdb-locking: Restrict lock debugging to once per second Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Log if ctdb is unable to take db locks in INACTIVE state This is useful information if ctdb is unable to freeze any of the databases on banning or stopping. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Remove ctdb_db_prio_iterator function It is not used anymore. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Remove API for locking databases with priority This is not used anymore. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Remove API for locking all databases This has never been used. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Drop code for Samba 3.x compatibility Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb-locking: Avoid real-time in lock helper if nosetsched option is set Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
dlist: remove unneeded type argument from DLIST_ADD_END() Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb-server: Replace ctdb_logging.h with common/logging.h Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>