Changes to 'refs/tags/sanlock-3.2.4'
by David Teigland
Changes since the dawn of time:
Antoni S. Puimedon (1):
systemd: prevent sigkill from being sent
Daniel P. Berrange (15):
Fix const-ness of many APIs.
Fix warnings in watchdog module
Fix function prototypes for no-arg methods
Remove use of 'index' as a variable name
Make many functions static
Fix missing include in logging file
Annotate many unused parameters to avoid warnings
Remove redundant redeclaration of 'to' variable
Fix args to execv()
Remove redundant arg to 'run_command'
Rename optarg to optionarg to avoid clashing with getopt.h
Disable the read_request method since it is unused
Add many more compiler warning flags & safety checks
Hard code a sector size of 512 if the lease volume is a regular file
Ensure libsanlock.so is built with debug/warning flags
David Teigland (492):
sync_manager: initial commit
sync_manager: misc updates
sync_manager: misc updates
sync_manager: misc updates
sync_manager: misc updates
sync_manager: add more logging
sync_manager: misc updates
sync_manager: misc updates
sync_manager: num_hosts/MAX_HOSTS stuff
daemon: reworking notions of resource_id/token_name
sync_manager: resource lockfiles
sync_manager: lease arg processing
sync_manager: Began multiple lease support
sync_manager: use first command line arg as action
sync_manager: leader record changes and verify
sync_manager: clean up released leases
sync_manager: move functions around
sync_manager: add more tool actions
sync_manager: naming changes
sync_manager: separate token index and id
sync_manager: fix index usage and other misc
sync_manager: use pthread cond in acquire
sync_manager: write all log entries
sync_manager: simplify polling
sync_manager: fix waitpid use
sync_manager: acquire can fail early
sync_manager: write log entries at exit
sync_manager: add test program
sync_manager: move secondary pid check
sync_manager: fix disk paxos contention
devcount: fix verify checks
sync_manager: add GPL license file
sync_manager: fix leader block offsets
sync_manager: increase COMMAND_MAX
sync_manager: renewal should verify
sync_manager: use sector size from libblkid
sync_manager: use a real checksum function
sync_manager: add libblkid to spec file
sync_manager: print status info
sync_manager: one watchdog file per lease
sync_manager: lease_threads handle watchdog files
sync_manager: fix/add some text/comments
sync_manager: refactor read/write
sync_manager: move disk io functions
sync_manager: remove token arg
sync_manager: rename paxos_disk sync_disk
sync_manager: add aio read/write
sync_manager: make io_timeout_seconds a diskio arg
sync_manager: forgot to add new files
sync_manager: use log thread
sync_manager: client connections
sync_manager: connection processing
sync_manager: send/recv pid
sync_manager: add write_sectors
sync_manager: restructuring
sync_manager: write_sectors code factoring
sync_manager: daemonize
sync_manager: releasing leases
sync_manager: async releasing
sync_manager: release fixes
sync_manager: add direct and indirect acquire/release
sync_manager: reacquire resources
sync_manager: move code
sync_manager: same pid may reacquire resource
sync_manager: lease migration
sync_manager: handle client errors
sync_manager: improve error handling
sync_manager: host_id leases
sync_manager: remove empty files
sync_manager: print initialization info
sync_manager: rename files
sync_manager: clean up header org
sync_manager: delta_lease implementation
sync_manager: accept offset units
sync_manager: fix up init output
sync_manager: put back watchdog calls
sync_manager: fix start_host_id error paths
sync_manager: add log_error's for watchdog file errors
sync_manager: actual timeouts
sync_manager: change timeouts on cmd line
sanlock: create new external api
sanlock: build libsanlock
sanlock: use MAX_LEASES everywhere
sanlock: add libvirt plugin
sanlock plugin: couple minor fixes
sanlock: clean up /var file names
sanlock plugin: fix symbol needed by libvirt
sanlock: add some debug output
sanlock plugin: fix uuid copy
sanlock plugin: fix names
sanlock: add "owner_name"
sanlock: fix renewal checks
sanlock: clean up host_id types
sanlock: set_host_id command
sanlock: fix killing pids
sanlock: add status command
sanlock: set version to 1.0
sanlock: delta_lease cleanup
sanlock: changing num_hosts
sanlock: add dump command
sanlock: renewal timings
sanlock: add direct option
sanlock: check for watchdog file
sanlock: recovery fixes
lock_driver_sanlock: fix compile problems
sanlock: improve command options
sanlock: tidying help text
sanlock: move binary to /usr/sbin
sanlock: add init script
sanlock: fix sigterm shutdown
sanlock: init stop
sanlock: add wdtest command
sanlock.spec: new url
lock_driver_sanlock: remove close
sanlock: introduce lockspaces
lock_driver_sanlock: remove files
sanlock: better logging functions
sanlock: misc log message
sanlock.spec: sbin not libexec
sanlock init: remove watchdog reference
wdmd: watchdog multiplexing daemon
sanlock: add code to use wdmd
sanlock/wdmd: use wdmd in sanlock
sanlock/wdmd: add copyright header to source files
sanlock: rename sanlock source dir
sanlock: move tests dir
move COPYING file
wdmd: use signalfd for signal handling
Fix Makefile comments
wdmd: fix daemon debug option
wdmd: add init script
sanlock.spec: updates
sanlock.spec: src dir
sanlock: build with uninstalled libwdmd
sanlock: version 1.1
sanlock: high priority options
wdmd: high priority options
sanlock: return migration state
sanlock: migration.txt describes libvirt/sanlock steps
libsanlock: include admin functions
sanlock: fix host_id expiration check
sanlock: migration working
devcount: migrate test
sanlock: setowner improvements
sanlock: migrate to target fix
sanlock: fix wdmd stop order
sanlock: various fixes
sanlock: remove wdtest
sanlock: remove migration
sanlock: clean up command return data
sanlock: add resource string conversion functions
sanlock: rework internal structs
devcount: add relock test
sanlock: fix release and inquire
sanlock: add_lockspace EEXIST
sanlock: rework client handling
sanlock: clean up warnings
sanlock: debug message changes
sanlock: add lockspace checks
wdmd: enable test scripts
sanlock: add str_to_lockspace to lib
WIP devcount migrate
devcount: new migrate test
sanlock: read_id and live_id commands
sanlock: check lockspace name and host_id
sanlock: remove remaining cluster_mode
sanlock: add libsanlock_direct
devcountn: start multiple devcount tests
devcount: small changes
sanlock: new return values
sanlock: misc changes and fix
sanlock: log error of full bad block
sanlock: interval between renewal checks
sanlock: renewal changes
sanlock: fix log_dump
sanlock: fix find_client_pid
sanlock: fix host_id reads from paxos_acquire
sanlock: init with one write
devcount: improve output
devcount: new pause/resume
devcount: add expire test
sanlock: correct paxos usage
sanlock: direct read_leader
sanlock: paxos delays
sanlock: use thread pool
sanlock: client status output format changes
sanlock: fix inquire of dead pid
sanlock: use native linux aio
sanlock: i/o changes
sanlock: aio changes
sanlock: reduce paxos acquire read ops
sanlock: quiet error case
sanlock: don't free aio buf until event completes
sanlock: io timeout related changes
sanlock: read dblocks in single aligned io
sanlock: add sanlock_restrict api
sanlock: add sanlock_direct_sector_size api
sanlock: add checksum to dblocks
sanlock: fix init restart
sanlock: don't release tokens in dead lockspace
sanlock: fix adding lockspace
sanlock: official 1MB/8MB alignment
devcount: use aio in init
libsanlock: link with LDFLAGS
sanlock: increase version to 1.3
sanlock/wdmd: shut up warnings
sanlock: fix libwdmd linking
remove spec file
sanlock: use a completed read after renewal timeout
sanlock: use unique host name in delta leases
sanlock: remove sector_size api
sanlock: abort delta wait on shutdown
sanlock: fix add_lockspace failure
sanlk_load: add new test
sanlock: fix recv and inquire
sanlock: initial pid_dead check in acquire
sanlock: release 1.4
sanlock: generate a uuid for host id
sanlock: return -EINPROGRESS from add_lockspace
sanlk_load: periodically kill and replace a pid
sanlock: zero num_hosts uses DEFAULT_MAX_HOSTS
tests: misc changes
sanlock: break paxos_acquire wait loop
sanlock: increase log line to 512 bytes
sanlock: change a log_error to log_debug
sanlock: fail host_id when corrupted
sanlock: release 1.5
sanlock: release 1.6
sanlock: handle colon escaping in path strings
wdmd: add option for high priority
wdmd: use accept4 with SOCK_NONBLOCK
wdmd: tidy sun_addr snprintf
wdmd: pid and sock file changes
wdmd: add man page
wdmd: disable test scripts
sanlock: use accept4 with SOCK_NONBLOCK
sanlock: tidy sun_addr snprintf
sanlock: add explicit -luuid
sanlock: pid and sock file changes
sanlock: add man page
sanlock/wdmd: improve mkdir of run dir
wdmd: new build flags
sanlock: new build flags
sanlock/wdmd: use monotonic time
sanlock: build with pie
sanlock/wdmd: nonblocking listening/accept
sanlock: add missing monotime files
sanlock: update man page
sanlock: man page update
sanlock: update man page and help text
sanlock: print connections limit
release: sanlock 1.7
makefile: install mode for man pages
sanlock: read align_size in renewal
sanlock: check other host_id leases
sanlock: minor fixes and cleanups
sanlock: add request api/cmd
sanlock: crc code tidying
sanlock/wdmd: add license header to files
sanlock: create libsanlock_client
sanlock: move client code
remove COPYING file
sanlock: remove internal header from sanlock_sock
libsanlock_client: use LGPLv2+
libwdmd: use LGPLv2+
sanlock_rv.h: switch to LGPLv2+
README.license: document licenses
sanlock: client align and init
sanlock: write request record
sanlock: request struct magic and version numbers
sanlock: set bitmap for requests
sanlock: examine resource requests
sanlock: update man page
sanlock: remove old comment
sanlock: renaming functions
sanlock: optimize paxos wait
sanlock: use flags in struct resource
sanlock: restructure lockspace checks
sanlock: remove BLOCK_WD force mode
libsanlock: fix function stubs
sanlock: new status and host_status
sanlock: improve status output
sanlock: status output sorting
sanlock: SIGTERM and SIGKILL for REQ_KILL_PID
sanlock: add flag RESTRICT_SIGKILL
sanlock: setup fewer aio events
sanlock: move cmd processing
sanlock: suppress log messages
sanlock: rename source files
sanlock: improve killing pids
sanlock: fix log_dump
version 1.8
sanlock: quick host_id reacquire
sanlock: add force option to shutdown command
simpler copyright line
default to GPLv2+ for our original files
sanlock: improve daemon permission errors
add systemd files
fixing up init stuff
release 1.9
sanlock: setmode
Revert "sanlock: setmode"
sanlock: fix error exit
sanlock: fix debug line
init scripts: fix path to restorecon
sanlock: shared mode for leases
sanlock: fix missing close_disks
sanlock: fix problem in paxos
sanlock: add paxos sanity check
sanlock: fix leaking fd
sanlock: change to paxos algorithm
sanlock: change ondisk version
sanlock: remove log noise
sanlock: ignore SIGTERM if lockspaces exist
sanlock: quiet more error messages
sanlk_load: munging variable names
sanlk_load: add shared locks
sanlock: kill client connection on recv error
sanlk_load: ignore release errors
sanlock: set sector_size in shared tokens
sanlock man page: mention SH
release 2.0
sanlock: clean up warnings
sanlock: fix inquire state string
sanlock: retry transient sh failures
sanlock: status for all shared tokens
sanlock: add a logrotate file
release 2.1
python: fix path strncpy
sanlock: remove physical sector size requirement
sanlock: add sample sysconfig file
sanlock: ASYNC flag for lockspace add and rem
sanlock: UNUSED flag for lockspace rem
release 2.2
sanlock.log: empty file to install from rpm
Revert "sanlock.log: empty file to install from rpm"
sanlock: remove limits.conf
sysconfig: remove user option
init: root user
release 2.3
latest spec file
sanlock.spec: fix exclusive arch
sanlock/wdmd: use /var/log/subsys/file
daemon: skip setup_groups when no -U or -G
sanlock.spec: require useradd and groupadd
sanlock.spec updated
daemon: don't put struct space on stack
daemon: fix add_lockspace that has been removed
daemon: fix inquire lver
daemon: graceful pid handling
Revert "init: make explicit to run sanlock as root"
remove spec file
release 2.4
daemon: include resource.h
daemon: fix lockfile ownership
wdmd: use lockfile mode 644
sanlock: use lockfile mode 644
wdmd: use shm_open to prevent restart
sanlock: remove umask 0
sanlock/wdmd: remove global connection
daemon: extend grace time
wdmd: close device when test fails
wdmd: preemptive close before test fails
wdmd: pet after reopen and use 1 sec interval after failure
sanlock: base kill sig on last renewal
clientn: add tests
tests: add test-recovery script
sanlock: fix paxos acquire host_id check
daemon: use helper for examine request kill
sanlock: show host_status for all lockspaces
sanlock: fix status of lockspaces in add and rem
sanlock: adjustable io timeouts
sanlock: add direct next_free command
sanlock: request force_mode 2 is SIGUSR1
sanlock: print escape chars in path from status
release 2.5
sanlock: configurable mlockall level
sanlock: change log level for startup and io timeouts
sanlock: update man page
sanlock: fix aborted command clearing
sanlock: client add_lockspace with timeout
sanlock: print command output to stdout
wdmd: new script handling
fence_sanlock: new code
fence_sanlock: various fixes and changes
fence_sanlock: variable alignment
fence_sanlockd: use init script
fence_sanlock: add man pages
fence_sanlock: use SIGHUP for shutdown
fence_sanlock: handle two node fence duel
sanlock/wdmd: get version from common file
wdmd: show option values in start message
release 2.6
fix systemd service files
wdmd: use mode 775 for run dir
sanlock: clean up daemon exit error path
sanlock: read and write apis for lockspace and resource
sanlock: new get_lockspaces api
sanlock: get_lockspaces count only
sanlock: make get_lockspaces allocate space for data
wdmd: dynamically select working watchdog device
fence_sanlock: fix man page name of path arg
sanlock: shutdown or rem_lockspace should SIGKILL
sanlock: fix usage output typos
release 2.7
sanlock: add request killpath
sanlock/fence_sanlock: request modes FORCE and GRACEFUL
sanlock: update request types in man page
sanlock: add get_hosts api
sanlock: remove direct read_id and live_id
sanlock: add read_resource_owners
sanlock: add test_resource_owners
sanlock: add flag SANLK_REQUEST_NEXT_LVER
sanlock: improve check of max_hosts and num_hosts
sanlock: add a comment
test: add another test program
sanlock: check for null arg in sanlock_request
release 2.8
sanlock: add lvb feature
sanlock: add SANLK_REL_RENAME
release 3.0.0
sanlock: free hss on error
sanlock: reinit hss in loop
sanlock: fix read_lockspace name comparison
sanlock: initialize owner_id
sanlock: initialize send_len and send_buf
release 3.0.1
sanlock: fix debug status for add/rem lockspace
sanlock: add_lockspace error for conflicting lockspace definitions
sanlock: add some acquire error descriptions
sanlock: use ADD and REM suffix in status output
sanlock: transient timeout handling in acquire and release
sanlock: add convert
sanlock: allow more than 8 resources per client
tests: sanlk_load
sanlock: fix spaces in path names
wdmd: add probe option
release 3.1.0
sanlock: version interface
sanlock: shutdown reply
sanlock: fix get_hosts off by one
sanlock: lockspace host events
sanlock: set_config api
reset: daemon and program for resetting hosts
sanlock: disk endian handling
sanlock: persistent and orphan resource leases
fence_sanlock: use persistent and orphan features
reset: remove DEBUG
init: add service file for sanlk-resetd
init: misc changes
sanlock: log error for invalid set_event args
sanlock: close event fds when lockspace is removed
sanlock: fix missing mutex unlock in previous commit
sanlock: host event struct missing host_id in get_event
reset: add ability to clear all
sanlk-reset: no args should print help
tests: update sanlk_events
reset: add man pages
release 3.2.0
reset: install man pages
sanlock: print better names in direct read -s
sanlock: log bad delta leases and delta lease owners
sanlock: direct write_leader
release 3.2.1
sanlock, reset: coverity fixes
reset: native timeout
release 3.2.2
sanlock: fix checksum endian handling
sanlock: add ORPHAN_ONLY flag for acquire
sanlock: fix adopting shared orphan lock
sanlk_load: comment out killing pid
sanlock: rewrite man page description
sanlock: fix paxos release
sanlock: fix print in previous commit
sanlock: fail acquire with IDLIVE more quickly
sanlock: no error when inquire finds no pid
sanlock: close fd in sanlock_version
sanlock: fix return value in sanlock_version
release 3.2.3
sanlock: add pkgconfig files
sanlock: create pkgconfig dir in install
sanlk-reset: add various compile flags
sanlock: add_lockspace can connect to wdmd earlier
sanlock: remove debug line for write_resource
sanlock: add a config file
sanlock: fix config file setting of uname/gname
sanlock: fix previous commit for uid/uname
sanlock: default to sanlock user and group if it exists
sanlock: remove -U and -G from native systemd unit file
wdmd: default to socket gid of sanlock
wdmd: remove -G from native systemd unit file
release 3.2.4
David Weber (3):
Fix order of linking
Install another symlink to shared library
Replace restrict field name with restricted
Fabio M. Di Nitto (15):
build: sanlock should link with libsanlock
build: install shared lib header files and fix DESTDIR usage
build: drop rpm target
spec file: do first cut for total spec file
build: fix linking with libsanlock and install target
fence_sanlock: add install bits
fence_sanlockd: add missing \n
fence_sanlock: cleanup shell usage
fence_sanlock: don't restart fence_sanlockd if it's already running
fence_sanlock: add basic metadata to integrate with ccs_config_validate
fence_sanlock: improve action_on error checking and report
fence_sanlock: unify code and silence some operations
fence_sanlockd init: cleanup, remove hardcoded paths and use system service
fence_sanlock: fix build to be selfcontained
systemd: add fence_sanlockd service file
Federico Simoncelli (76):
rpm: sync specfile with fedora
rpm: add sanlock_admin.h header
rpm: add the lib package, install the initscripts
python: remove unused python code
python: add python binding
python: release the gil during sanlock operations
python: wrap sanlock extension with a module
rpm: add python binding package
python: pass a lockspace copy to str_to_lockspace
makefile: fix install typo
rpm: add sanlock_direct header
python: add sanlock init functions and exception
direct: close disks after initialization
python: register process only once
daemon: configurable socket permissions
rpm: add sanlock user and group
python: exceptions must contain the errno
rpm: add missing libaio-devel dependency
rpm: add daemon options in the init file
python: add missing aio library
python: add get_alignment function
libs: include libsanlock_direct into libsanlock
python: align num_hosts and max_hosts defaults
python: expose sanlock file descriptor
python: improve error reporting
python: parse lockspaces and resources natively
python: add usage example
python: initial support for sanlock errors
python: document the sanlock module
python: module cleanup
build: fix documentation install path
client: return appropriate errno on failure
python: expose errno in the exception
python: acquire leases for other processes
sanlock: implement the inq_lockspace command
python: add the inq_lockspace command binding
misc: run sanlock daemon as sanlock user
wdmd: use getopt to parse the command line
wdmd: make socket group ownership configurable
python: add shared resource parameter to acquire
python: release leases for other processes
python: ASYNC flag for lockspace add and rem
python: UNUSED flag for lockspace rem
log: add full time and date to the log messages
sanlock: set the supplementary groups at startup
log: add the thread id in the log messages
sanlock: fix an rv check typo in setup_groups
init: add a stop timeout for the sanlock service
build: add a generic rpm spec file
init: make explicit to run sanlock as root
wdmd: load the softdog module when needed
sanlock: WAIT flag for sanlock_inq_lockspace
daemon: drop root privileges and use the helper
init: use checkpid when stopping the services
sanlock: expose sanlock path import and export utils
sanlock: configuring the core dump output
python: fix the tuple parsing for py_add_lockspace
sanlock: use signal handler for all terminating signals
systemd: add wdmd dependency for sanlock
wdmd: trap also SIGINT for a clean exit
wdmd: make the watchdog device configurable
python: fix typo for the offset parameter
python: add write lockspace and resource
python: add read lockspace and resource
wdmd: fix miscellaneous build warnings
misc: add wdmd to gitignore
python: fix multiple issues reported by cpychecker
python: add get_lockspaces
python: use the write commands in example.py
python: add the versioning support to acquire
python: return lease version in read_resource
python: rename SANLK_LSF flags and constants macro
python: improve example with signals and exceptions
python: add the support for the resource request
python: add the get_hosts support
python: add support to read resource owners
Nir Soffer (9):
sanlk-resetd: Allow only privileged user to modify configuration
reset: Use find_ls to remove lockspace by name
python: add support for lockspace events
reset: Require lockspace name for local deamon operations
reset: Add the clear command to the usage
reset: Improve error message when command is missing
reset: Calling with too many lockspaces is a usage error
reset: Normalize exit codes
reset: Reduce logging noise to stderr and syslog
Saggi Mizrahi (25):
Added the begining of the testing and debugging tools
Better handling of max hosts
sync_manager: Updated tests to work with new lease struct
sync_manager: fixed skipping first arg in command
sync_manager: acquire and release actions
sync_manager: minor fixes
sync_manager: renamed stuff
sync_manager: made acquire synchronous again
sync_manager: added set_host_id action
sync_manager: use kill(0) for secondary pid check
sync_manager: make rpm and install
sync_manager: spec file update
sync_manager: Allow longer resource names
sync_manager: allow repeated set_host_id
sync_manager: Added escaping for the leases arg
sync_manager: Created the python bindings for sync_manager
sync_manager: listener socket permissions
sync_manager: Updated python binding and tests
sync_manager: Made 'token' a const in log_level
sync_manager: refactor messaging system
sync_manager: use getsockopt PEERCRED
Fix various build warnings
Tidy up some copy pasted code
Set constness in some places
Add a gitignore file
Sandro Bonazzola (1):
setup: aligned with rpm package
8 years, 9 months
VERSION
by David Teigland
VERSION | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 8a80660906fd8b09f80981687a3c5d5617880675
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 19 11:26:03 2015 -0500
release 3.2.4
diff --git a/VERSION b/VERSION
index b347b11..351227f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.2.3
+3.2.4
8 years, 9 months
4 commits - init.d/sanlock.service.native init.d/wdmd.service.native src/main.c wdmd/main.c
by David Teigland
init.d/sanlock.service.native | 2 +-
init.d/wdmd.service.native | 2 +-
src/main.c | 14 ++++++++++++--
wdmd/main.c | 13 ++++++++++---
4 files changed, 24 insertions(+), 7 deletions(-)
New commits:
commit c570bb9de43567024f3f3242e087de1f331fea0d
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jun 15 12:59:33 2015 -0500
wdmd: remove -G from native systemd unit file
wdmd now tries to use the sanlock group for the
socket gid if it's available, so the command line
option is unnecessary.
diff --git a/init.d/wdmd.service.native b/init.d/wdmd.service.native
index 6596b07..ab0828e 100644
--- a/init.d/wdmd.service.native
+++ b/init.d/wdmd.service.native
@@ -5,7 +5,7 @@ After=syslog.target
[Service]
Type=forking
ExecStartPre=/lib/systemd/systemd-wdmd watchdog-check
-ExecStart=/usr/sbin/wdmd -G sanlock
+ExecStart=/usr/sbin/wdmd
SendSIGKILL=no
[Install]
commit 29e66d3a92cd6ce2f0ac140ecddfb368b643b4af
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jun 15 12:57:32 2015 -0500
wdmd: default to socket gid of sanlock
If the socket group name is not specified on the
command line, and if the sanlock group is available,
use that for the socket gid instead of root.
diff --git a/wdmd/main.c b/wdmd/main.c
index 8a09632..c29667f 100644
--- a/wdmd/main.c
+++ b/wdmd/main.c
@@ -46,6 +46,11 @@
#define DEFAULT_FIRE_TIMEOUT 60
#define DEFAULT_HIGH_PRIORITY 1
+/*
+ * If the group name specified here, or specified on the
+ * command line is not found, then default to gid 0 (root).
+ */
+#define SOCKET_GNAME "sanlock"
#define DEFAULT_SOCKET_GID 0
#define DEFAULT_SOCKET_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
@@ -57,6 +62,7 @@ static int high_priority = DEFAULT_HIGH_PRIORITY;
static int daemon_quit;
static int daemon_debug;
static int socket_gid;
+static char *socket_gname = (char *)SOCKET_GNAME;
static time_t last_keepalive;
static time_t last_closeunclean;
static char lockfile_path[PATH_MAX];
@@ -1462,8 +1468,7 @@ static int group_to_gid(char *arg)
gr = getgrnam(arg);
if (gr == NULL) {
- log_error("group '%s' not found, "
- "using uid: %i", arg, DEFAULT_SOCKET_GID);
+ log_error("group '%s' not found, using socket gid: %i", arg, DEFAULT_SOCKET_GID);
return DEFAULT_SOCKET_GID;
}
@@ -1577,7 +1582,7 @@ int main(int argc, char *argv[])
daemon_debug = 1;
break;
case 'G':
- socket_gid = group_to_gid(optarg);
+ socket_gname = strdup(optarg);
break;
case 'H':
high_priority = atoi(optarg);
@@ -1606,6 +1611,8 @@ int main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
+ socket_gid = group_to_gid(socket_gname);
+
if (!daemon_debug) {
if (daemon(0, 0) < 0) {
fprintf(stderr, "cannot fork daemon\n");
commit 27c9c2582c13d8587087eadae1757eba4f5d63f1
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jun 15 11:51:48 2015 -0500
sanlock: remove -U and -G from native systemd unit file
sanlock now uses the sanlock user and group if it's
available on the system, so setting it from the
command line is unnecessary. To override the
default behavior when using the unit file, set the
desired user and group in sanlock.conf.
diff --git a/init.d/sanlock.service.native b/init.d/sanlock.service.native
index b915e92..11e020d 100644
--- a/init.d/sanlock.service.native
+++ b/init.d/sanlock.service.native
@@ -5,7 +5,7 @@ Wants=wdmd.service
[Service]
Type=forking
-ExecStart=/usr/sbin/sanlock daemon -U sanlock -G sanlock
+ExecStart=/usr/sbin/sanlock daemon
SendSIGKILL=no
[Install]
commit 95ddd92967e1af0a2ec9b67e714fa2793e505598
Author: David Teigland <teigland(a)redhat.com>
Date: Mon Jun 15 11:45:58 2015 -0500
sanlock: default to sanlock user and group if it exists
When the user and group are not specified on the command line
or in the config file, sanlock would previously default to the
"root" user and group. Now, it will check if the "sanlock"
user and group are available on the system, and if so default
to that instead of root.
diff --git a/src/main.c b/src/main.c
index d8a01ab..958b57b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3198,11 +3198,21 @@ int main(int argc, char *argv[])
com.max_worker_threads = DEFAULT_MAX_WORKER_THREADS;
com.io_timeout_arg = DEFAULT_IO_TIMEOUT;
com.aio_arg = DEFAULT_USE_AIO;
- com.uid = DEFAULT_SOCKET_UID;
- com.gid = DEFAULT_SOCKET_GID;
com.pid = -1;
com.sh_retries = DEFAULT_SH_RETRIES;
+ if (getgrnam("sanlock") && getpwnam("sanlock")) {
+ com.uname = (char *)"sanlock";
+ com.gname = (char *)"sanlock";
+ com.uid = user_to_uid(com.uname);
+ com.gid = group_to_gid(com.uname);
+ } else {
+ com.uname = NULL;
+ com.gname = NULL;
+ com.uid = DEFAULT_SOCKET_UID;
+ com.gid = DEFAULT_SOCKET_GID;
+ }
+
memset(&main_task, 0, sizeof(main_task));
/*
8 years, 9 months
src/main.c
by David Teigland
src/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 4a978a5cfb04f221421ef367ddfb32966e4d5fc6
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 12 16:29:48 2015 -0500
sanlock: fix previous commit for uid/uname
diff --git a/src/main.c b/src/main.c
index c27e4e7..d8a01ab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2332,6 +2332,7 @@ static void read_config_file(void)
} else if (!strcmp(str, "uname")) {
memset(str, 0, sizeof(str));
get_val_str(line, str);
+ com.uname = strdup(str);
com.uid = user_to_uid(str);
} else if (!strcmp(str, "gname")) {
@@ -2343,7 +2344,6 @@ static void read_config_file(void)
} else if (!strcmp(str, "our_host_name")) {
memset(str, 0, sizeof(str));
get_val_str(line, str);
- com.uname = strdup(str);
strncpy(com.our_host_name, str, NAME_ID_SIZE);
}
}
8 years, 9 months
src/main.c
by David Teigland
src/main.c | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit 911a9d9cedd81a92dd23d0acf55ae6c516602485
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 12 15:55:02 2015 -0500
sanlock: fix config file setting of uname/gname
The -U/-G options set both uname/gname and uid/gid.
diff --git a/src/main.c b/src/main.c
index 8a2fc7a..c27e4e7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2337,11 +2337,13 @@ static void read_config_file(void)
} else if (!strcmp(str, "gname")) {
memset(str, 0, sizeof(str));
get_val_str(line, str);
+ com.gname = strdup(str);
com.gid = group_to_gid(str);
} else if (!strcmp(str, "our_host_name")) {
memset(str, 0, sizeof(str));
get_val_str(line, str);
+ com.uname = strdup(str);
strncpy(com.our_host_name, str, NAME_ID_SIZE);
}
}
8 years, 9 months
src/cmd.c src/main.c src/sanlock.conf src/sanlock_internal.h
by David Teigland
src/cmd.c | 16 ++++++
src/main.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++
src/sanlock.conf | 40 +++++++++++++++
src/sanlock_internal.h | 1
4 files changed, 184 insertions(+)
New commits:
commit 055825d7fe7feb51aa3e9fcf6ccd0c57a9d800ce
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 12 15:42:35 2015 -0500
sanlock: add a config file
sanlock will now read settings from /etc/sanlock/sanlock.conf
when started. These settings are overriden by the same thing
set on the command line.
Also, display more daemon settings from 'sanlock status -D'
diff --git a/src/cmd.c b/src/cmd.c
index d61937c..93387c0 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2055,6 +2055,14 @@ static int print_state_daemon(char *str)
snprintf(str, SANLK_STATE_MAXSTR-1,
"our_host_name=%s "
+ "use_watchdog=%d "
+ "high_priority=%d "
+ "mlock_level=%d "
+ "quiet_fail=%d "
+ "debug_renew=%d "
+ "gid=%d "
+ "uid=%d "
+ "sh_retries=%d "
"use_aio=%d "
"kill_grace_seconds=%d "
"helper_pid=%d "
@@ -2067,6 +2075,14 @@ static int print_state_daemon(char *str)
"version_hex=%08x "
"smproto_hex=%08x",
our_host_name_global,
+ com.use_watchdog,
+ com.high_priority,
+ com.mlock_level,
+ com.quiet_fail,
+ com.debug_renew,
+ com.gid,
+ com.uid,
+ com.sh_retries,
main_task.use_aio,
kill_grace_seconds,
helper_pid,
diff --git a/src/main.c b/src/main.c
index 4e203eb..8a2fc7a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2229,6 +2229,126 @@ static int read_command_line(int argc, char *argv[])
return 0;
}
+#define MAX_CONF_LINE 128
+
+static void get_val_int(char *line, int *val_out)
+{
+ char key[MAX_CONF_LINE];
+ char val[MAX_CONF_LINE];
+ int rv;
+
+ rv = sscanf(line, "%[^=]=%s", key, val);
+ if (rv != 2)
+ return;
+
+ *val_out = atoi(val);
+}
+
+static void get_val_str(char *line, char *val_out)
+{
+ char key[MAX_CONF_LINE];
+ char val[MAX_CONF_LINE];
+ int rv;
+
+ rv = sscanf(line, "%[^=]=%s", key, val);
+ if (rv != 2)
+ return;
+
+ strcpy(val_out, val);
+}
+
+static void read_config_file(void)
+{
+ FILE *file;
+ struct stat buf;
+ char line[MAX_CONF_LINE];
+ char str[MAX_CONF_LINE];
+ int i, val;
+
+ if (stat(SANLK_CONF_PATH, &buf) < 0) {
+ if (errno != ENOENT)
+ log_error("%s stat failed: %d", SANLK_CONF_PATH, errno);
+ return;
+ }
+
+ file = fopen(SANLK_CONF_PATH, "r");
+ if (!file)
+ return;
+
+ while (fgets(line, MAX_CONF_LINE, file)) {
+ if (line[0] == '#')
+ continue;
+ if (line[0] == '\n')
+ continue;
+
+ memset(str, 0, sizeof(str));
+
+ for (i = 0; i < MAX_CONF_LINE; i++) {
+ if (line[i] == ' ')
+ break;
+ if (line[i] == '=')
+ break;
+ if (line[i] == '\0')
+ break;
+ if (line[i] == '\n')
+ break;
+ if (line[i] == '\t')
+ break;
+ str[i] = line[i];
+ }
+
+ if (!strcmp(str, "quiet_fail")) {
+ get_val_int(line, &val);
+ com.quiet_fail = val;
+
+ } else if (!strcmp(str, "debug_renew")) {
+ get_val_int(line, &val);
+ com.debug_renew = val;
+
+ } else if (!strcmp(str, "logfile_priority")) {
+ get_val_int(line, &val);
+ log_logfile_priority = val;
+
+ } else if (!strcmp(str, "syslog_priority")) {
+ get_val_int(line, &val);
+ log_syslog_priority = val;
+
+ } else if (!strcmp(str, "use_watchdog")) {
+ get_val_int(line, &val);
+ com.use_watchdog = val;
+
+ } else if (!strcmp(str, "high_priority")) {
+ get_val_int(line, &val);
+ com.high_priority = val;
+
+ } else if (!strcmp(str, "mlock_level")) {
+ get_val_int(line, &val);
+ com.mlock_level = val;
+
+ } else if (!strcmp(str, "sh_retries")) {
+ get_val_int(line, &val);
+ com.sh_retries = val;
+
+ } else if (!strcmp(str, "uname")) {
+ memset(str, 0, sizeof(str));
+ get_val_str(line, str);
+ com.uid = user_to_uid(str);
+
+ } else if (!strcmp(str, "gname")) {
+ memset(str, 0, sizeof(str));
+ get_val_str(line, str);
+ com.gid = group_to_gid(str);
+
+ } else if (!strcmp(str, "our_host_name")) {
+ memset(str, 0, sizeof(str));
+ get_val_str(line, str);
+ strncpy(com.our_host_name, str, NAME_ID_SIZE);
+ }
+ }
+
+ fclose(file);
+}
+
/* only used by do_client */
static char *lsf_to_str(uint32_t flags)
{
@@ -3083,6 +3203,13 @@ int main(int argc, char *argv[])
memset(&main_task, 0, sizeof(main_task));
+ /*
+ * read_config_file() overrides com default settings,
+ * read_command_line() overrides com default settings and
+ * config file settings.
+ */
+ read_config_file();
+
rv = read_command_line(argc, argv);
if (rv < 0)
goto out;
diff --git a/src/sanlock.conf b/src/sanlock.conf
new file mode 100644
index 0000000..06b8647
--- /dev/null
+++ b/src/sanlock.conf
@@ -0,0 +1,40 @@
+# sanlock config file
+#
+# Values set here can be overriden on the command line.
+# See 'man sanlock' and 'sanlock -h' for more information.
+#
+# Example settings:
+#
+# quiet_fail = 0
+# command line: -Q 0|1
+#
+# debug_renew = 0
+# command line: -R 0|1
+#
+# logfile_priority = 3
+# command line: -L 3
+#
+# syslog_priority = 3
+# command line: -S 3
+#
+# use_watchdog = 1
+# command line: -w 1
+#
+# high_priority = 1
+# command line: -h 1
+#
+# mlock_level = 1
+# command line: -l 1
+#
+# sh_retries = 8
+# command line: n/a
+#
+# uname = sanlock
+# command line: -U <name>
+#
+# gname = sanlock
+# command line: -G <name>
+#
+# our_host_name = <str>
+# command line: -e <str>
+
diff --git a/src/sanlock_internal.h b/src/sanlock_internal.h
index 475af18..9df82f3 100644
--- a/src/sanlock_internal.h
+++ b/src/sanlock_internal.h
@@ -46,6 +46,7 @@
#define SANLK_LOG_DIR "/var/log"
#define SANLK_LOGFILE_NAME "sanlock.log"
#define SANLK_LOCKFILE_NAME "sanlock.pid"
+#define SANLK_CONF_PATH "/etc/sanlock/sanlock.conf"
#define DAEMON_NAME "sanlock"
8 years, 9 months
src/cmd.c
by David Teigland
src/cmd.c | 1 -
1 file changed, 1 deletion(-)
New commits:
commit e6b717318e7da107e2f40672ba376626f8d6187c
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 12 14:06:58 2015 -0500
sanlock: remove debug line for write_resource
Each write_resource request causes two debug lines:
cmd_write_resource 4,11 lvm_dd:#unused:/dev/mapper/dd-lvmlock:113246208
cmd_write_resource 4,11 done 0
This removes the second to reduce the amount of logging.
diff --git a/src/cmd.c b/src/cmd.c
index 6bde363..d61937c 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1863,7 +1863,6 @@ static void cmd_write_resource(struct task *task, struct cmd_args *ca)
reply:
if (token)
free(token);
- log_debug("cmd_write_resource %d,%d done %d", ca->ci_in, fd, result);
send_result(fd, &ca->header, result);
client_resume(ca->ci_in);
8 years, 9 months
src/cmd.c src/lockspace.c src/main.c src/watchdog.c src/watchdog.h
by David Teigland
src/cmd.c | 2 +-
src/lockspace.c | 23 ++++++++++++++++++-----
src/main.c | 2 +-
src/watchdog.c | 37 +++++++++++++++++++++++--------------
src/watchdog.h | 13 +++++++------
5 files changed, 50 insertions(+), 27 deletions(-)
New commits:
commit 9841a4c55497631c94c0ed1f063caa4e1cfb2701
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 12 13:59:05 2015 -0500
sanlock: add_lockspace can connect to wdmd earlier
Currently, add_lockspace will finish acquiring the
delta lease, then connect to wdmd and activate the
wdmd connection for the lockspace. If wdmd was
not running, the connect fails, and add_lockspace
fails. If we connect to wdmd before acquiring the
delta lease, we can fail before the lengthy delta
lease delay.
diff --git a/src/cmd.c b/src/cmd.c
index 648ea7c..6bde363 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1360,7 +1360,7 @@ static void cmd_inq_lockspace(struct cmd_args *ca)
*
* if (sp->killing_pids && all_pids_dead(sp) && all_tokens_released(sp)) {
* sp->thread_stop = 1;
- * unlink_watchdog_file(sp);
+ * deactivate_watchdog(sp);
* list_move(spaces_rem);
* }
*
diff --git a/src/lockspace.c b/src/lockspace.c
index 9322861..24f75d6 100644
--- a/src/lockspace.c
+++ b/src/lockspace.c
@@ -552,6 +552,7 @@ static void *lockspace_thread(void *arg_in)
int acquire_result, delta_result, read_result;
int opened = 0;
int stop = 0;
+ int wd_con;
sp = (struct space *)arg_in;
@@ -588,6 +589,15 @@ static void *lockspace_thread(void *arg_in)
goto set_status;
}
+ /* Connect first so we can fail quickly if wdmd is not running. */
+ wd_con = connect_watchdog(sp);
+ if (wd_con < 0) {
+ log_erros(sp, "connect_watchdog failed %d", wd_con);
+ acquire_result = SANLK_WD_ERROR;
+ delta_result = -1;
+ goto set_status;
+ }
+
/*
* acquire the delta lease
*/
@@ -608,11 +618,14 @@ static void *lockspace_thread(void *arg_in)
before we allow any pid's to begin running */
if (delta_result == SANLK_OK) {
- rv = create_watchdog_file(sp, last_success, id_renewal_fail_seconds);
+ rv = activate_watchdog(sp, last_success, id_renewal_fail_seconds, wd_con);
if (rv < 0) {
- log_erros(sp, "create_watchdog failed %d", rv);
+ log_erros(sp, "activate_watchdog failed %d", rv);
acquire_result = SANLK_WD_ERROR;
}
+ } else {
+ if (com.use_watchdog)
+ close(wd_con);
}
set_status:
@@ -704,7 +717,7 @@ static void *lockspace_thread(void *arg_in)
*/
if (delta_result == SANLK_OK && !sp->thread_stop)
- update_watchdog_file(sp, last_success, id_renewal_fail_seconds);
+ update_watchdog(sp, last_success, id_renewal_fail_seconds);
pthread_mutex_unlock(&sp->mutex);
@@ -728,7 +741,7 @@ static void *lockspace_thread(void *arg_in)
/* watchdog unlink was done in main_loop when thread_stop was set, to
get it done as quickly as possible in case the wd is about to fire. */
- close_watchdog_file(sp);
+ close_watchdog(sp);
out:
if (delta_result == SANLK_OK)
delta_lease_release(&task, sp, &sp->host_id_disk,
@@ -936,7 +949,7 @@ int add_lockspace_wait(struct space *sp)
pthread_mutex_lock(&sp->mutex);
sp->thread_stop = 1;
- unlink_watchdog_file(sp);
+ deactivate_watchdog(sp);
pthread_mutex_unlock(&sp->mutex);
pthread_join(sp->thread, NULL);
rv = -1;
diff --git a/src/main.c b/src/main.c
index 4f7ea84..4e203eb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -791,7 +791,7 @@ static int main_loop(void)
log_space(sp, "set thread_stop");
pthread_mutex_lock(&sp->mutex);
sp->thread_stop = 1;
- unlink_watchdog_file(sp);
+ deactivate_watchdog(sp);
pthread_mutex_unlock(&sp->mutex);
list_move(&sp->list, &spaces_rem);
continue;
diff --git a/src/watchdog.c b/src/watchdog.c
index a879880..2c6c5b8 100644
--- a/src/watchdog.c
+++ b/src/watchdog.c
@@ -39,8 +39,8 @@
#include "../wdmd/wdmd.h"
-void update_watchdog_file(struct space *sp, uint64_t timestamp,
- int id_renewal_fail_seconds)
+void update_watchdog(struct space *sp, uint64_t timestamp,
+ int id_renewal_fail_seconds)
{
int rv;
@@ -53,13 +53,9 @@ void update_watchdog_file(struct space *sp, uint64_t timestamp,
(unsigned long long)timestamp, rv);
}
-int create_watchdog_file(struct space *sp, uint64_t timestamp,
- int id_renewal_fail_seconds)
+int connect_watchdog(struct space *sp)
{
- char name[WDMD_NAME_SIZE];
- int test_interval, fire_timeout;
- uint64_t last_keepalive;
- int con, rv;
+ int con;
if (!com.use_watchdog)
return 0;
@@ -67,9 +63,23 @@ int create_watchdog_file(struct space *sp, uint64_t timestamp,
con = wdmd_connect();
if (con < 0) {
log_erros(sp, "wdmd_connect failed %d", con);
- goto fail;
+ return -1;
}
+ return con;
+}
+
+int activate_watchdog(struct space *sp, uint64_t timestamp,
+ int id_renewal_fail_seconds, int con)
+{
+ char name[WDMD_NAME_SIZE];
+ int test_interval, fire_timeout;
+ uint64_t last_keepalive;
+ int rv;
+
+ if (!com.use_watchdog)
+ return 0;
+
memset(name, 0, sizeof(name));
snprintf(name, WDMD_NAME_SIZE - 1, "sanlock_%s:%llu",
@@ -114,11 +124,10 @@ int create_watchdog_file(struct space *sp, uint64_t timestamp,
wdmd_refcount_clear(con);
fail_close:
close(con);
- fail:
return -1;
}
-void unlink_watchdog_file(struct space *sp)
+void deactivate_watchdog(struct space *sp)
{
int rv;
@@ -129,7 +138,7 @@ void unlink_watchdog_file(struct space *sp)
rv = wdmd_test_live(sp->wd_fd, 0, 0);
if (rv < 0) {
- log_erros(sp, "wdmd_test_live in unlink failed %d", rv);
+ log_erros(sp, "wdmd_test_live in deactivate failed %d", rv);
/* We really want this to succeed to avoid a reset, so retry
after a short delay in case the problem was transient... */
@@ -138,13 +147,13 @@ void unlink_watchdog_file(struct space *sp)
rv = wdmd_test_live(sp->wd_fd, 0, 0);
if (rv < 0)
- log_erros(sp, "wdmd_test_live in unlink 2 failed %d", rv);
+ log_erros(sp, "wdmd_test_live in deactivate 2 failed %d", rv);
}
wdmd_refcount_clear(sp->wd_fd);
}
-void close_watchdog_file(struct space *sp)
+void close_watchdog(struct space *sp)
{
if (!com.use_watchdog)
return;
diff --git a/src/watchdog.h b/src/watchdog.h
index 90e82eb..a462559 100644
--- a/src/watchdog.h
+++ b/src/watchdog.h
@@ -9,11 +9,12 @@
#ifndef __WATCHDOG_H__
#define __WATCHDOG_H__
-void update_watchdog_file(struct space *sp, uint64_t timestamp,
- int id_renewal_fail_seconds);
-int create_watchdog_file(struct space *sp, uint64_t timestamp,
- int id_renewal_fail_seconds);
-void unlink_watchdog_file(struct space *sp);
-void close_watchdog_file(struct space *sp);
+void update_watchdog(struct space *sp, uint64_t timestamp,
+ int id_renewal_fail_seconds);
+int connect_watchdog(struct space *sp);
+int activate_watchdog(struct space *sp, uint64_t timestamp,
+ int id_renewal_fail_seconds, int con);
+void deactivate_watchdog(struct space *sp);
+void close_watchdog(struct space *sp);
#endif
8 years, 9 months