Changes to 'refs/tags/sanlock-3.4.0'
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 (512):
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
fence_sanlock: add flags for build
python: add compile flags
sanlock: add acquire flag to avoid waiting
wdmd: prevent probe while watchdog is used
sanlock: don't clear the shared flag on disk
sanlock: add man page section about internals
sanlock: fix release clearing of host block
sanlock: fix syntax errors
sanlock: change quiet_fail default to 1
sanlock: fix convert sh to ex
sanlock: fix sanlock_convert on registered fd
sanlock: improve lvb logging and error checks
sanlock: use io_destroy to clear outstanding aio
sanlock: improve logging for renewals
sanlock: tolerate longer read delays in renewal
sanlock: man page reference to sanlock.conf
release 3.3.0
libsanlock: ignore EINTR
sanlock: renewal history
release 3.4.0
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
Jonathan Davies (1):
sanlock: process commands arriving during poll() promptly
Nir Soffer (11):
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
sanlock: setup supplementary groups before daemonizing
sanlock: clear helper process supplementary groups
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
7 years, 9 months
VERSION
by David Teigland
VERSION | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit cf37f526de8b74ae41695f1d5f68b208ddac3a89
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 10 11:28:49 2016 -0500
release 3.4.0
diff --git a/VERSION b/VERSION
index 15a2799..1809198 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.3.0
+3.4.0
7 years, 9 months
src/client_cmd.c src/client_cmd.h src/cmd.c src/delta_lease.c
src/delta_lease.h src/direct.c src/diskio.c src/diskio.h
src/lockspace.c src/main.c src/monotime.c src/monotime.h
src/ondisk.c src/paxos_lease.c src/resource.c src/sanlock.8
src/sanlock_internal.h src/sanlock_sock.h
by David Teigland
src/client_cmd.c | 54 +++++++++++++++++++
src/client_cmd.h | 1
src/cmd.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++
src/delta_lease.c | 22 ++++++-
src/delta_lease.h | 3 -
src/direct.c | 4 +
src/diskio.c | 32 +++++++----
src/diskio.h | 4 -
src/lockspace.c | 54 ++++++++++++++++++-
src/main.c | 17 ++++++
src/monotime.c | 11 +++
src/monotime.h | 1
src/ondisk.c | 1
src/paxos_lease.c | 12 ++--
src/resource.c | 8 +-
src/sanlock.8 | 4 +
src/sanlock_internal.h | 15 +++++
src/sanlock_sock.h | 2
18 files changed, 349 insertions(+), 32 deletions(-)
New commits:
commit 6313c709722b3ba63234a75d1651a160bf1728ee
Author: David Teigland <teigland(a)redhat.com>
Date: Wed Mar 9 11:58:21 2016 -0600
sanlock: renewal history
Keep a history of read and write latencies for a lockspace.
The times are measured for io in delta lease renewal
(each delta lease renewal includes one read and one write).
For each successful renewal, a record is saved that includes:
- the timestamp written in the delta lease by the renewal
- the time in milliseconds taken by the delta lease read
- the time in milliseconds taken by the delta lease write
Also counted and recorded are the number io timeouts and
other io errors that occur between successful renewals.
Two consecutive successful renewals would be recorded as:
timestamp=5332 read_ms=482 write_ms=5525 next_timeouts=0 next_errors=0
timestamp=5353 read_ms=99 write_ms=3161 next_timeouts=0 next_errors=0
timestamp is the value written into the delta lease during
that renewal.
read_ms/write_ms are the milliseconds taken for the renewal
read/write ios.
next_timeouts are the number of io timeouts that occured
after the renewal recorded on that line and before the next
successful renewal on the following line.
next_errors are the number of io errors (not timeouts) that
occured after renewal recorded on that line and before the
next successful renewal on the following line.
The command 'sanlock client renewal -s lockspace_name' reports
the full history of renewals saved by sanlock, which by default
is 180 records, about 1 hour of history when using a 20 second
renewal interval for a 10 second io timeout.
(A --summary option could be added to calculate and report
averages over a selected period of the history.)
diff --git a/src/client_cmd.c b/src/client_cmd.c
index 4d457be..fb22435 100644
--- a/src/client_cmd.c
+++ b/src/client_cmd.c
@@ -585,6 +585,60 @@ int sanlock_host_status(int debug, char *lockspace_name)
return 0;
}
+int sanlock_renewal(char *lockspace_name)
+{
+ struct sm_header h;
+ struct sanlk_state st;
+ struct sanlk_lockspace lockspace;
+ char str[SANLK_STATE_MAXSTR];
+ int fd, rv;
+
+ if (!lockspace_name || !lockspace_name[0])
+ return -1;
+
+ fd = send_command(SM_CMD_RENEWAL, 0);
+ if (fd < 0)
+ return fd;
+
+ memset(&lockspace, 0, sizeof(lockspace));
+ snprintf(lockspace.name, SANLK_NAME_LEN, "%s", lockspace_name);
+
+ rv = send(fd, &lockspace, sizeof(lockspace), 0);
+ if (rv < 0)
+ goto out;
+
+ rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ if (rv < 0) {
+ rv = -errno;
+ goto out;
+ }
+ if (rv != sizeof(h)) {
+ rv = -1;
+ goto out;
+ }
+
+ while (1) {
+ rv = recv(fd, &st, sizeof(st), MSG_WAITALL);
+ if (!rv)
+ break;
+ if (rv != sizeof(st))
+ break;
+
+ if (st.str_len) {
+ rv = recv(fd, str, st.str_len, MSG_WAITALL);
+ if (rv != st.str_len)
+ break;
+ }
+
+ printf("%s\n", str);
+ }
+
+ rv = h.data;
+ out:
+ close(fd);
+ return rv;
+}
+
int sanlock_log_dump(int max_size)
{
struct sm_header h;
diff --git a/src/client_cmd.h b/src/client_cmd.h
index f7c69c1..4632f5d 100644
--- a/src/client_cmd.h
+++ b/src/client_cmd.h
@@ -11,6 +11,7 @@
int sanlock_status(int debug, char sort_arg);
int sanlock_host_status(int debug, char *lockspace_name);
+int sanlock_renewal(char *lockspace_name);
int sanlock_log_dump(int max_size);
int sanlock_shutdown(uint32_t force, int wait_result);
diff --git a/src/cmd.c b/src/cmd.c
index 997ec21..abf0af4 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2079,6 +2079,7 @@ static int print_state_daemon(char *str)
"mlock_level=%d "
"quiet_fail=%d "
"debug_renew=%d "
+ "renewal_history_size=%d "
"gid=%d "
"uid=%d "
"sh_retries=%d "
@@ -2099,6 +2100,7 @@ static int print_state_daemon(char *str)
com.mlock_level,
com.quiet_fail,
com.debug_renew,
+ com.renewal_history_size,
com.gid,
com.uid,
com.sh_retries,
@@ -2240,6 +2242,25 @@ static int print_state_host(struct host_status *hs, char *str)
return strlen(str) + 1;
}
+static int print_state_renewal(struct renewal_history *hi, char *str)
+{
+ memset(str, 0, SANLK_STATE_MAXSTR);
+
+ snprintf(str, SANLK_STATE_MAXSTR-1,
+ "timestamp=%llu "
+ "read_ms=%d "
+ "write_ms=%d "
+ "next_timeouts=%d "
+ "next_errors=%d",
+ (unsigned long long)hi->timestamp,
+ hi->read_ms,
+ hi->write_ms,
+ hi->next_timeouts,
+ hi->next_errors);
+
+ return strlen(str) + 1;
+}
+
static void send_state_daemon(int fd)
{
struct sanlk_state st;
@@ -2364,6 +2385,26 @@ static void send_state_host(int fd, struct host_status *hs, int host_id)
send(fd, str, str_len, MSG_NOSIGNAL);
}
+static void send_state_renewal(int fd, struct renewal_history *hi)
+{
+ struct sanlk_state st;
+ char str[SANLK_STATE_MAXSTR];
+ int str_len;
+
+ memset(&st, 0, sizeof(st));
+
+ st.type = SANLK_STATE_RENEWAL;
+ st.data64 = hi->timestamp;
+
+ str_len = print_state_renewal(hi, str);
+
+ st.str_len = str_len;
+
+ send(fd, &st, sizeof(st), MSG_NOSIGNAL);
+ if (str_len)
+ send(fd, str, str_len, MSG_NOSIGNAL);
+}
+
static void cmd_status(int fd, struct sm_header *h_recv, int client_maxi)
{
struct sm_header h;
@@ -2475,6 +2516,97 @@ static void cmd_host_status(int fd, struct sm_header *h_recv)
free(status);
}
+static void cmd_renewal(int fd, struct sm_header *h_recv)
+{
+ struct sm_header h;
+ struct sanlk_lockspace lockspace;
+ struct space *sp;
+ uint32_t io_timeout = 0;
+ struct renewal_history *history = NULL;
+ struct renewal_history *hi;
+ int history_size, history_prev, history_next;
+ int i, rv, len;
+
+ memset(&h, 0, sizeof(h));
+ memcpy(&h, h_recv, sizeof(struct sm_header));
+ h.version = SM_PROTO;
+ h.length = sizeof(h);
+ h.data = 0;
+
+ if (!com.renewal_history_size)
+ goto fail;
+
+ len = sizeof(struct renewal_history) * com.renewal_history_size;
+
+ history = malloc(len);
+ if (!history) {
+ h.data = -ENOMEM;
+ goto fail;
+ }
+
+ rv = recv(fd, &lockspace, sizeof(struct sanlk_lockspace), MSG_WAITALL);
+ if (rv != sizeof(struct sanlk_lockspace)) {
+ h.data = -ENOTCONN;
+ goto fail;
+ }
+
+ pthread_mutex_lock(&spaces_mutex);
+ sp = find_lockspace(lockspace.name);
+ if (sp) {
+ history_size = sp->renewal_history_size;
+ history_prev = sp->renewal_history_prev;
+ history_next = sp->renewal_history_next;
+ io_timeout = sp->io_timeout;
+
+ if (history_size != com.renewal_history_size) {
+ log_error("mismatch history size");
+ history_size = 0;
+ history_prev = 0;
+ history_next = 0;
+ } else {
+ memcpy(history, sp->renewal_history, len);
+ }
+ }
+ pthread_mutex_unlock(&spaces_mutex);
+
+ if (!sp) {
+ h.data = -ENOSPC;
+ goto fail;
+ }
+
+ if (!history_size || (!history_prev && !history_next))
+ goto fail;
+
+ h.data2 = io_timeout;
+
+ send(fd, &h, sizeof(h), MSG_NOSIGNAL);
+
+ /* If next slot is non-zero, then we've wrapped and
+ should begin sending history from next to end
+ before sending from 0 to prev. */
+
+ if (history[history_next].timestamp) {
+ for (i = history_next; i < history_size; i++) {
+ hi = &history[i];
+ send_state_renewal(fd, hi);
+ }
+
+ }
+ for (i = 0; i < history_next; i++) {
+ hi = &history[i];
+ send_state_renewal(fd, hi);
+ }
+
+ if (history)
+ free(history);
+ return;
+ fail:
+ send(fd, &h, sizeof(h), MSG_NOSIGNAL);
+
+ if (history)
+ free(history);
+}
+
static char send_data_buf[LOG_DUMP_SIZE];
static void cmd_log_dump(int fd, struct sm_header *h_recv)
@@ -2715,6 +2847,10 @@ void call_cmd_daemon(int ci, struct sm_header *h_recv, int client_maxi)
strcpy(client[ci].owner_name, "host_status");
cmd_host_status(fd, h_recv);
break;
+ case SM_CMD_RENEWAL:
+ strcpy(client[ci].owner_name, "renewal");
+ cmd_renewal(fd, h_recv);
+ break;
case SM_CMD_LOG_DUMP:
strcpy(client[ci].owner_name, "log_dump");
cmd_log_dump(fd, h_recv);
diff --git a/src/delta_lease.c b/src/delta_lease.c
index 3cf98fb..93aa418 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -466,13 +466,15 @@ int delta_lease_renew(struct task *task,
int *read_result,
int log_renewal_level,
struct leader_record *leader_last,
- struct leader_record *leader_ret)
+ struct leader_record *leader_ret,
+ int *rd_ms, int *wr_ms)
{
struct leader_record leader;
struct leader_record leader_end;
char **p_iobuf;
char **p_wbuf;
char *wbuf;
+ struct timespec begin, end, diff;
uint32_t checksum;
uint32_t reap_timeout_msec;
uint64_t host_id, id_offset, new_ts, now;
@@ -483,6 +485,9 @@ int delta_lease_renew(struct task *task,
return -EINVAL;
}
+ *rd_ms = -1;
+ *wr_ms = -1;
+
*read_result = SANLK_ERROR;
host_id = leader_last->owner_id;
@@ -527,12 +532,19 @@ int delta_lease_renew(struct task *task,
reap_timeout_msec = sp->renewal_read_extend_sec * 1000;
}
+ clock_gettime(CLOCK_MONOTONIC_RAW, &begin);
+
rv = read_iobuf_reap(disk->fd, disk->offset,
task->iobuf, iobuf_len, task, reap_timeout_msec);
log_space(sp, "delta_renew reap %d", rv);
if (!rv) {
+ /* read time for this renewal is the io_timeout length
+ for the previous read plus the time spent in reap. */
+ clock_gettime(CLOCK_MONOTONIC_RAW, &end);
+ ts_diff(&begin, &end, &diff);
+ *rd_ms = (diff.tv_sec * 1000) + (diff.tv_nsec / 1000000) + (sp->io_timeout * 1000);
task->read_iobuf_timeout_aicb = NULL;
goto read_done;
}
@@ -583,7 +595,7 @@ int delta_lease_renew(struct task *task,
if (log_renewal_level != -1)
log_level(sp->space_id, 0, NULL, log_renewal_level, "delta_renew begin read");
- rv = read_iobuf(disk->fd, disk->offset, task->iobuf, iobuf_len, task, sp->io_timeout);
+ rv = read_iobuf(disk->fd, disk->offset, task->iobuf, iobuf_len, task, sp->io_timeout, rd_ms);
if (rv) {
/* the next time delta_lease_renew() is called, prev_result
will be this rv. If this rv is SANLK_AIO_TIMEOUT, we'll
@@ -685,7 +697,7 @@ int delta_lease_renew(struct task *task,
retrying unnecessarily would probably be counter productive. */
rv = write_iobuf(disk->fd, disk->offset+id_offset, wbuf, sector_size, task,
- calc_host_dead_seconds(sp->io_timeout));
+ calc_host_dead_seconds(sp->io_timeout), wr_ms);
if (rv != SANLK_AIO_TIMEOUT)
free(wbuf);
@@ -835,7 +847,7 @@ int delta_lease_init(struct task *task,
memcpy(iobuf + (i * disk->sector_size), &leader_end, sizeof(struct leader_record));
}
- rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, io_timeout);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, io_timeout, NULL);
if (rv < 0)
goto out;
@@ -855,7 +867,7 @@ int delta_lease_init(struct task *task,
memcpy(iobuf, &leader_end, sizeof(struct leader_record));
- rv = write_iobuf(disk->fd, disk->offset, iobuf, disk->sector_size, task, io_timeout);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, disk->sector_size, task, io_timeout, NULL);
out:
if (rv != SANLK_AIO_TIMEOUT)
free(iobuf);
diff --git a/src/delta_lease.h b/src/delta_lease.h
index 38c469a..0cfca29 100644
--- a/src/delta_lease.h
+++ b/src/delta_lease.h
@@ -35,7 +35,8 @@ int delta_lease_renew(struct task *task,
int *read_result,
int log_renewal_level,
struct leader_record *leader_last,
- struct leader_record *leader_ret);
+ struct leader_record *leader_ret,
+ int *rd_ms, int *wr_ms);
int delta_lease_release(struct task *task,
struct space *sp,
diff --git a/src/direct.c b/src/direct.c
index c39988c..8fd6e10 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -201,6 +201,7 @@ static int do_delta_action(int action,
struct space space;
char bitmap[HOSTID_BITMAP_SIZE];
int read_result, rv;
+ int rd_ms, wr_ms;
memset(bitmap, 0, sizeof(bitmap));
@@ -253,7 +254,8 @@ static int do_delta_action(int action,
&read_result,
0,
&leader,
- &leader);
+ &leader,
+ &rd_ms, &wr_ms);
break;
case ACT_RELEASE_ID:
rv = delta_lease_leader_read(task, io_timeout, &sd,
diff --git a/src/diskio.c b/src/diskio.c
index d5f06f2..4025f94 100644
--- a/src/diskio.c
+++ b/src/diskio.c
@@ -375,12 +375,13 @@ static struct aicb *find_callback_slot(struct task *task, int ioto)
*/
static int do_linux_aio(int fd, uint64_t offset, char *buf, int len,
- struct task *task, int ioto, int cmd)
+ struct task *task, int ioto, int cmd, int *ms)
{
struct timespec ts;
struct aicb *aicb;
struct iocb *iocb;
struct io_event event;
+ struct timespec begin, end, diff;
const char *op_str;
int rv;
@@ -404,6 +405,9 @@ static int do_linux_aio(int fd, uint64_t offset, char *buf, int len,
iocb->u.c.nbytes = len;
iocb->u.c.offset = offset;
+ if (ms)
+ clock_gettime(CLOCK_MONOTONIC_RAW, &begin);
+
rv = io_submit(task->aio_ctx, 1, &iocb);
if (rv < 0) {
log_taske(task, "aio submit %d %p:%p:%p rv %d fd %d",
@@ -435,6 +439,12 @@ static int do_linux_aio(int fd, uint64_t offset, char *buf, int len,
struct aicb *ev_aicb = container_of(ev_iocb, struct aicb, iocb);
int op = ev_iocb ? ev_iocb->aio_lio_opcode : -1;
+ if (ms) {
+ clock_gettime(CLOCK_MONOTONIC_RAW, &end);
+ ts_diff(&begin, &end, &diff);
+ *ms = (diff.tv_sec * 1000) + (diff.tv_nsec / 1000000);
+ }
+
if (op == IO_CMD_PREAD)
op_str = "RD";
else if (op == IO_CMD_PWRITE)
@@ -508,15 +518,15 @@ static int do_linux_aio(int fd, uint64_t offset, char *buf, int len,
}
static int do_write_aio_linux(int fd, uint64_t offset, char *buf, int len,
- struct task *task, int ioto)
+ struct task *task, int ioto, int *wr_ms)
{
- return do_linux_aio(fd, offset, buf, len, task, ioto, IO_CMD_PWRITE);
+ return do_linux_aio(fd, offset, buf, len, task, ioto, IO_CMD_PWRITE, wr_ms);
}
static int do_read_aio_linux(int fd, uint64_t offset, char *buf, int len,
- struct task *task, int ioto)
+ struct task *task, int ioto, int *rd_ms)
{
- return do_linux_aio(fd, offset, buf, len, task, ioto, IO_CMD_PREAD);
+ return do_linux_aio(fd, offset, buf, len, task, ioto, IO_CMD_PREAD, rd_ms);
}
static int do_write_aio_posix(int fd, uint64_t offset, char *buf, int len,
@@ -621,10 +631,10 @@ static int do_read_aio_posix(int fd, uint64_t offset, char *buf, int len,
/* write aligned io buffer */
int write_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto)
+ struct task *task, int ioto, int *wr_ms)
{
if (task && task->use_aio == 1)
- return do_write_aio_linux(fd, offset, iobuf, iobuf_len, task, ioto);
+ return do_write_aio_linux(fd, offset, iobuf, iobuf_len, task, ioto, wr_ms);
else if (task && task->use_aio == 2)
return do_write_aio_posix(fd, offset, iobuf, iobuf_len, task, ioto);
else
@@ -659,7 +669,7 @@ static int _write_sectors(const struct sync_disk *disk, uint64_t sector_nr,
memset(iobuf, 0, iobuf_len);
memcpy(iobuf, data, data_len);
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, ioto);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, ioto, NULL);
if (rv < 0) {
log_error("write_sectors %s offset %llu rv %d %s",
blktype, (unsigned long long)offset, rv, disk->path);
@@ -715,10 +725,10 @@ int write_sectors(const struct sync_disk *disk, uint64_t sector_nr,
/* read aligned io buffer */
int read_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto)
+ struct task *task, int ioto, int *rd_ms)
{
if (task && task->use_aio == 1)
- return do_read_aio_linux(fd, offset, iobuf, iobuf_len, task, ioto);
+ return do_read_aio_linux(fd, offset, iobuf, iobuf_len, task, ioto, rd_ms);
else if (task && task->use_aio == 2)
return do_read_aio_posix(fd, offset, iobuf, iobuf_len, task, ioto);
else
@@ -761,7 +771,7 @@ int read_sectors(const struct sync_disk *disk, uint64_t sector_nr,
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, ioto);
+ rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, ioto, NULL);
if (!rv) {
memcpy(data, iobuf, data_len);
} else {
diff --git a/src/diskio.h b/src/diskio.h
index d2c5be1..6cb1b4f 100644
--- a/src/diskio.h
+++ b/src/diskio.h
@@ -21,10 +21,10 @@ int majority_disks(int num_disks, int num);
*/
int write_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto);
+ struct task *task, int ioto, int *wr_ms);
int read_iobuf(int fd, uint64_t offset, char *iobuf, int iobuf_len,
- struct task *task, int ioto);
+ struct task *task, int ioto, int *rd_ms);
int read_iobuf_reap(int fd, uint64_t offset, char *iobuf, int iobuf_len,
struct task *task, uint32_t ioto_msec);
diff --git a/src/lockspace.c b/src/lockspace.c
index b7f2e9c..e9bba20 100644
--- a/src/lockspace.c
+++ b/src/lockspace.c
@@ -532,6 +532,44 @@ static void close_event_fds(struct space *sp)
}
/*
+ * if delta_result is success:
+ * new record saving last_success (timestamp in renewal), rd_ms, wr_ms
+ * if delta_result is timeout:
+ * increment next_timeouts in prev record
+ * if delta_result is failure:
+ * increment next_errors in prev record
+ */
+
+static void save_renewal_history(struct space *sp, int delta_result,
+ uint64_t last_success, int rd_ms, int wr_ms)
+{
+ struct renewal_history *hi;
+
+ if (!sp->renewal_history_size || !sp->renewal_history)
+ return;
+
+ if (delta_result == SANLK_OK) {
+ hi = &sp->renewal_history[sp->renewal_history_next];
+
+ hi->timestamp = last_success;
+ hi->read_ms = rd_ms;
+ hi->write_ms = wr_ms;
+
+ sp->renewal_history_prev = sp->renewal_history_next;
+ sp->renewal_history_next++;
+ if (sp->renewal_history_next >= sp->renewal_history_size)
+ sp->renewal_history_next = 0;
+ } else {
+ hi = &sp->renewal_history[sp->renewal_history_prev];
+
+ if (delta_result == SANLK_AIO_TIMEOUT)
+ hi->next_timeouts++;
+ else
+ hi->next_errors++;
+ }
+}
+
+/*
* This thread must not be stopped unless all pids that may be using any
* resources in it are dead/gone. (The USED flag in the lockspace represents
* pids using resources in the lockspace, when those pids are not using actual
@@ -551,6 +589,7 @@ static void *lockspace_thread(void *arg_in)
int rv, delta_length, renewal_interval = 0;
int id_renewal_seconds, id_renewal_fail_seconds;
int acquire_result, delta_result, read_result;
+ int rd_ms, wr_ms;
int opened = 0;
int stop = 0;
int wd_con;
@@ -642,6 +681,8 @@ static void *lockspace_thread(void *arg_in)
sp->lease_status.renewal_last_attempt = delta_begin;
if (delta_result == SANLK_OK)
sp->lease_status.renewal_last_success = last_success;
+ /* First renewal entry shows the acquire time with 0 latencies. */
+ save_renewal_history(sp, delta_result, last_success, 0, 0);
pthread_mutex_unlock(&sp->mutex);
if (acquire_result < 0)
@@ -685,7 +726,8 @@ static void *lockspace_thread(void *arg_in)
sp->space_name, bitmap, &extra,
delta_result, &read_result,
log_renewal_level,
- &leader, &leader);
+ &leader, &leader,
+ &rd_ms, &wr_ms);
delta_length = monotime() - delta_begin;
if (delta_result == SANLK_OK) {
@@ -714,7 +756,6 @@ static void *lockspace_thread(void *arg_in)
sp->lease_status.renewal_read_count++;
}
-
/*
* pet the watchdog
* (don't update on thread_stop because it's probably unlinked)
@@ -723,6 +764,7 @@ static void *lockspace_thread(void *arg_in)
if (delta_result == SANLK_OK && !sp->thread_stop)
update_watchdog(sp, last_success, id_renewal_fail_seconds);
+ save_renewal_history(sp, delta_result, last_success, rd_ms, wr_ms);
pthread_mutex_unlock(&sp->mutex);
@@ -819,6 +861,14 @@ int add_lockspace_start(struct sanlk_lockspace *ls, uint32_t io_timeout, struct
for (i = 0; i < MAX_EVENT_FDS; i++)
sp->event_fds[i] = -1;
+ if (com.renewal_history_size) {
+ sp->renewal_history = malloc(sizeof(struct renewal_history) * com.renewal_history_size);
+ if (sp->renewal_history) {
+ sp->renewal_history_size = com.renewal_history_size;
+ memset(sp->renewal_history, 0, sizeof(struct renewal_history) * com.renewal_history_size);
+ }
+ }
+
pthread_mutex_lock(&spaces_mutex);
/* search all lists for an identical lockspace */
diff --git a/src/main.c b/src/main.c
index af7c57c..ebc1e06 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1218,6 +1218,7 @@ static void process_connection(int ci)
case SM_CMD_SHUTDOWN:
case SM_CMD_STATUS:
case SM_CMD_HOST_STATUS:
+ case SM_CMD_RENEWAL:
case SM_CMD_LOG_DUMP:
case SM_CMD_GET_LOCKSPACES:
case SM_CMD_GET_HOSTS:
@@ -1807,6 +1808,7 @@ static void print_usage(void)
printf(" -D no fork and print all logging to stderr\n");
printf(" -Q 0|1 quiet error messages for common lock contention (%d)\n", DEFAULT_QUIET_FAIL);
printf(" -R 0|1 renewal debugging, log debug info about renewals (0)\n");
+ printf(" -H <num> renewal history size (%d)\n", DEFAULT_RENEWAL_HISTORY_SIZE);
printf(" -L <pri> write logging at priority level and up to logfile (3 LOG_ERR)\n");
printf(" (use -1 for none)\n");
printf(" -S <pri> write logging at priority level and up to syslog (3 LOG_ERR)\n");
@@ -1827,6 +1829,7 @@ static void print_usage(void)
printf("sanlock client status [-D] [-o p|s]\n");
printf("sanlock client gets [-h 0|1]\n");
printf("sanlock client host_status -s LOCKSPACE [-D]\n");
+ printf("sanlock client renewal -s LOCKSPACE\n");
printf("sanlock client set_event -s LOCKSPACE -i <host_id> [-g gen] -e <event> -d <data>\n");
printf("sanlock client set_config -s LOCKSPACE [-u 0|1] [-O 0|1]\n");
printf("sanlock client log_dump\n");
@@ -1935,6 +1938,8 @@ static int read_command_line(int argc, char *argv[])
com.action = ACT_STATUS;
else if (!strcmp(act, "host_status"))
com.action = ACT_HOST_STATUS;
+ else if (!strcmp(act, "renewal"))
+ com.action = ACT_RENEWAL;
else if (!strcmp(act, "gets"))
com.action = ACT_GETS;
else if (!strcmp(act, "log_dump"))
@@ -2051,6 +2056,9 @@ static int read_command_line(int argc, char *argv[])
case 'R':
com.debug_renew = atoi(optionarg);
break;
+ case 'H':
+ com.renewal_history_size = atoi(optionarg);
+ break;
case 'L':
log_logfile_priority = atoi(optionarg);
break;
@@ -2331,6 +2339,10 @@ static void read_config_file(void)
get_val_int(line, &val);
com.renewal_read_extend_sec_set = 1;
com.renewal_read_extend_sec = val;
+
+ } else if (!strcmp(str, "renewal_history_size")) {
+ get_val_int(line, &val);
+ com.renewal_history_size = val;
}
}
@@ -2571,6 +2583,10 @@ static int do_client(void)
rv = sanlock_host_status(com.debug, com.lockspace.name);
break;
+ case ACT_RENEWAL:
+ rv = sanlock_renewal(com.lockspace.name);
+ break;
+
case ACT_GETS:
rv = do_client_gets();
break;
@@ -3189,6 +3205,7 @@ int main(int argc, char *argv[])
com.quiet_fail = DEFAULT_QUIET_FAIL;
com.renewal_read_extend_sec_set = 0;
com.renewal_read_extend_sec = 0;
+ com.renewal_history_size = DEFAULT_RENEWAL_HISTORY_SIZE;
if (getgrnam("sanlock") && getpwnam("sanlock")) {
com.uname = (char *)"sanlock";
diff --git a/src/monotime.c b/src/monotime.c
index e4ce85a..5691766 100644
--- a/src/monotime.c
+++ b/src/monotime.c
@@ -19,3 +19,14 @@ uint64_t monotime(void)
return ts.tv_sec;
}
+
+void ts_diff(struct timespec *begin, struct timespec *end, struct timespec *diff)
+{
+ if ((end->tv_nsec - begin->tv_nsec) < 0) {
+ diff->tv_sec = end->tv_sec - begin->tv_sec - 1;
+ diff->tv_nsec = end->tv_nsec - begin->tv_nsec + 1000000000;
+ } else {
+ diff->tv_sec = end->tv_sec - begin->tv_sec;
+ diff->tv_nsec = end->tv_nsec - begin->tv_nsec;
+ }
+}
diff --git a/src/monotime.h b/src/monotime.h
index 4e8c12d..788edd3 100644
--- a/src/monotime.h
+++ b/src/monotime.h
@@ -10,5 +10,6 @@
#define __MONOTIME_H__
uint64_t monotime(void);
+void ts_diff(struct timespec *begin, struct timespec *end, struct timespec *diff);
#endif
diff --git a/src/ondisk.c b/src/ondisk.c
index c161f8b..83b6832 100644
--- a/src/ondisk.c
+++ b/src/ondisk.c
@@ -11,6 +11,7 @@
#include <byteswap.h>
#include <inttypes.h>
#include <unistd.h>
+#include <time.h>
#include "sanlock_internal.h"
#include "ondisk.h"
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 2206c95..ecd4597 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -181,7 +181,7 @@ static int write_dblock_mblock_sh(struct task *task,
memcpy(iobuf, (char *)&pd_end, sizeof(struct paxos_dblock));
memcpy(iobuf + MBLOCK_OFFSET, (char *)&mb_end, sizeof(struct mode_block));
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
if (rv < 0) {
log_errot(token, "write_dblock_mblock_sh host_id %llu gen %llu rv %d",
@@ -513,7 +513,7 @@ static int run_ballot(struct task *task, struct token *token, int num_hosts,
continue;
memset(iobuf[d], 0, iobuf_len);
- rv = read_iobuf(disk->fd, disk->offset, iobuf[d], iobuf_len, task, token->io_timeout);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf[d], iobuf_len, task, token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
iobuf[d] = NULL;
if (rv < 0)
@@ -667,7 +667,7 @@ static int run_ballot(struct task *task, struct token *token, int num_hosts,
continue;
memset(iobuf[d], 0, iobuf_len);
- rv = read_iobuf(disk->fd, disk->offset, iobuf[d], iobuf_len, task, token->io_timeout);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf[d], iobuf_len, task, token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
iobuf[d] = NULL;
if (rv < 0)
@@ -954,7 +954,7 @@ int paxos_read_buf(struct task *task,
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
*buf_out = iobuf;
@@ -1141,7 +1141,7 @@ static int _lease_read_one(struct task *task,
memset(iobuf, 0, iobuf_len);
- rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = read_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
if (rv < 0)
goto out;
@@ -2101,7 +2101,7 @@ int paxos_lease_init(struct task *task,
for (d = 0; d < token->r.num_disks; d++) {
rv = write_iobuf(token->disks[d].fd, token->disks[d].offset,
- iobuf, iobuf_len, task, token->io_timeout);
+ iobuf, iobuf_len, task, token->io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
aio_timeout = 1;
diff --git a/src/resource.c b/src/resource.c
index 4d80528..584b66f 100644
--- a/src/resource.c
+++ b/src/resource.c
@@ -334,7 +334,7 @@ static int write_host_block(struct task *task, struct token *token,
offset = disk->offset + ((2 + host_id - 1) * disk->sector_size);
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
if (rv < 0)
break;
}
@@ -382,7 +382,7 @@ static int read_mode_block(struct task *task, struct token *token,
offset = disk->offset + ((2 + host_id - 1) * disk->sector_size);
- rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
if (rv < 0)
break;
@@ -469,7 +469,7 @@ static int read_lvb_block(struct task *task, struct token *token)
if (!r->lvb)
return 0;
- rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = read_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
return rv;
}
@@ -489,7 +489,7 @@ static int write_lvb_block(struct task *task, struct resource *r, struct token *
if (!r->lvb)
return 0;
- rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout);
+ rv = write_iobuf(disk->fd, offset, iobuf, iobuf_len, task, token->io_timeout, NULL);
return rv;
}
diff --git a/src/sanlock.8 b/src/sanlock.8
index 6078a5f..73e48ff 100644
--- a/src/sanlock.8
+++ b/src/sanlock.8
@@ -560,6 +560,10 @@ Print lockspaces being managed by the sanlock daemon. The LOCKSPACE
string will be followed by ADD or REM if the lockspace is currently being
added or removed. Add -h 1 to also show hosts in each lockspace.
+.BR "sanlock client renewal -s" " LOCKSPACE"
+
+Print a history of renewals with timing details.
+
.B sanlock client log_dump
Print the sanlock daemon internal debug log.
diff --git a/src/sanlock_internal.h b/src/sanlock_internal.h
index 511b448..1e4e7e1 100644
--- a/src/sanlock_internal.h
+++ b/src/sanlock_internal.h
@@ -161,6 +161,14 @@ struct host_status {
char owner_name[NAME_ID_SIZE];
};
+struct renewal_history {
+ uint64_t timestamp;
+ int read_ms;
+ int write_ms;
+ int next_timeouts;
+ int next_errors;
+};
+
/* The max number of connections that can get events for a lockspace. */
#define MAX_EVENT_FDS 32
@@ -193,6 +201,10 @@ struct space {
pthread_mutex_t mutex; /* protects lease_status, thread_stop */
struct lease_status lease_status;
struct host_status host_status[DEFAULT_MAX_HOSTS];
+ struct renewal_history *renewal_history;
+ int renewal_history_size;
+ int renewal_history_next;
+ int renewal_history_prev;
};
/* Update lockspace_info() to copy any fields from struct space
@@ -283,6 +295,7 @@ EXTERN struct client *client;
#define DEFAULT_MAX_WORKER_THREADS 8
#define DEFAULT_SH_RETRIES 8
#define DEFAULT_QUIET_FAIL 1
+#define DEFAULT_RENEWAL_HISTORY_SIZE 180 /* about 1 hour with 20 sec renewal interval */
struct command_line {
int type; /* COM_ */
@@ -320,6 +333,7 @@ struct command_line {
int res_count;
int sh_retries;
uint32_t force_mode;
+ int renewal_history_size;
int renewal_read_extend_sec_set; /* 1 if renewal_read_extend_sec is configured */
uint32_t renewal_read_extend_sec;
char our_host_name[SANLK_NAME_LEN+1];
@@ -367,6 +381,7 @@ enum {
ACT_SET_EVENT,
ACT_SET_CONFIG,
ACT_WRITE_LEADER,
+ ACT_RENEWAL,
};
EXTERN int external_shutdown;
diff --git a/src/sanlock_sock.h b/src/sanlock_sock.h
index d9fb076..78821c2 100644
--- a/src/sanlock_sock.h
+++ b/src/sanlock_sock.h
@@ -54,6 +54,7 @@ enum {
SM_CMD_END_EVENT = 31,
SM_CMD_SET_EVENT = 32,
SM_CMD_SET_CONFIG = 33,
+ SM_CMD_RENEWAL = 34,
};
#define SM_CB_GET_EVENT 1
@@ -76,6 +77,7 @@ struct sm_header {
#define SANLK_STATE_LOCKSPACE 3
#define SANLK_STATE_RESOURCE 4
#define SANLK_STATE_HOST 5
+#define SANLK_STATE_RENEWAL 6
struct sanlk_state {
uint32_t type; /* SANLK_STATE_ */
7 years, 9 months
src/client.c
by David Teigland
src/client.c | 134 +++++++++++++++++++++++++++++++++++------------------------
1 file changed, 80 insertions(+), 54 deletions(-)
New commits:
commit f520991e83d0a05d1670abba4561c3de86a09c5f
Author: David Teigland <teigland(a)redhat.com>
Date: Wed Jun 8 12:06:22 2016 -0500
libsanlock: ignore EINTR
libsanlock calls were returning EINTR if there was a
signal during send() or recv(). Now just restart the
syscall on EINTR.
diff --git a/src/client.c b/src/client.c
index 3992250..4e1c14c 100644
--- a/src/client.c
+++ b/src/client.c
@@ -78,13 +78,37 @@ static int send_header(int sock, int cmd, uint32_t cmd_flags, int datalen,
header.data = data;
header.data2 = data2;
+retry:
rv = send(sock, (void *) &header, sizeof(header), 0);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
+
if (rv < 0)
return -errno;
return 0;
}
+static ssize_t send_data(int sockfd, const void *buf, size_t len, int flags)
+{
+ ssize_t rv;
+retry:
+ rv = send(sockfd, buf, len, flags);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
+ return rv;
+}
+
+static ssize_t recv_data(int sockfd, void *buf, size_t len, int flags)
+{
+ ssize_t rv;
+retry:
+ rv = recv(sockfd, buf, len, flags);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
+ return rv;
+}
+
int send_command(int cmd, uint32_t data);
int send_command(int cmd, uint32_t data)
@@ -110,8 +134,10 @@ static int recv_result(int fd)
int rv;
memset(&h, 0, sizeof(h));
-
+retry:
rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
if (rv < 0)
return -errno;
if (rv != sizeof(h))
@@ -132,7 +158,7 @@ static int cmd_lockspace(int cmd, struct sanlk_lockspace *ls, uint32_t flags, ui
if (rv < 0)
goto out;
- rv = send(fd, (void *)ls, sizeof(struct sanlk_lockspace), 0);
+ rv = send_data(fd, (void *)ls, sizeof(struct sanlk_lockspace), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -183,7 +209,7 @@ int sanlock_get_lockspaces(struct sanlk_lockspace **lss, int *lss_count,
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -213,7 +239,7 @@ int sanlock_get_lockspaces(struct sanlk_lockspace **lss, int *lss_count,
ls = lsbuf;
for (i = 0; i < recv_count; i++) {
- ret = recv(fd, ls, sizeof(struct sanlk_lockspace), MSG_WAITALL);
+ ret = recv_data(fd, ls, sizeof(struct sanlk_lockspace), MSG_WAITALL);
if (ret < 0) {
rv = -errno;
free(lsbuf);
@@ -261,7 +287,7 @@ int sanlock_get_hosts(const char *ls_name, uint64_t host_id,
if (rv < 0)
goto out;
- rv = send(fd, &ls, sizeof(struct sanlk_lockspace), 0);
+ rv = send_data(fd, &ls, sizeof(struct sanlk_lockspace), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -271,7 +297,7 @@ int sanlock_get_hosts(const char *ls_name, uint64_t host_id,
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -301,7 +327,7 @@ int sanlock_get_hosts(const char *ls_name, uint64_t host_id,
hs = hsbuf;
for (i = 0; i < recv_count; i++) {
- ret = recv(fd, hs, sizeof(struct sanlk_host), MSG_WAITALL);
+ ret = recv_data(fd, hs, sizeof(struct sanlk_host), MSG_WAITALL);
if (ret < 0) {
rv = -errno;
free(hsbuf);
@@ -345,7 +371,7 @@ int sanlock_set_config(const char *ls_name, uint32_t flags, uint32_t cmd, GNUC_U
if (rv < 0)
goto out;
- rv = send(fd, &ls, sizeof(ls), 0);
+ rv = send_data(fd, &ls, sizeof(ls), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -353,7 +379,7 @@ int sanlock_set_config(const char *ls_name, uint32_t flags, uint32_t cmd, GNUC_U
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -382,7 +408,7 @@ int sanlock_align(struct sanlk_disk *disk)
if (rv < 0)
goto out;
- rv = send(fd, (void *)disk, sizeof(struct sanlk_disk), 0);
+ rv = send_data(fd, (void *)disk, sizeof(struct sanlk_disk), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -412,7 +438,7 @@ int sanlock_read_lockspace(struct sanlk_lockspace *ls, uint32_t flags, uint32_t
if (rv < 0)
goto out;
- rv = send(fd, ls, sizeof(struct sanlk_lockspace), 0);
+ rv = send_data(fd, ls, sizeof(struct sanlk_lockspace), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -422,7 +448,7 @@ int sanlock_read_lockspace(struct sanlk_lockspace *ls, uint32_t flags, uint32_t
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -437,7 +463,7 @@ int sanlock_read_lockspace(struct sanlk_lockspace *ls, uint32_t flags, uint32_t
if (rv < 0)
goto out;
- rv = recv(fd, ls, sizeof(struct sanlk_lockspace), MSG_WAITALL);
+ rv = recv_data(fd, ls, sizeof(struct sanlk_lockspace), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -475,13 +501,13 @@ int sanlock_read_resource(struct sanlk_resource *res, uint32_t flags)
if (rv < 0)
goto out;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
+ rv = send_data(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -491,7 +517,7 @@ int sanlock_read_resource(struct sanlk_resource *res, uint32_t flags)
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -506,7 +532,7 @@ int sanlock_read_resource(struct sanlk_resource *res, uint32_t flags)
if (rv < 0)
goto out;
- rv = recv(fd, res, sizeof(struct sanlk_resource), MSG_WAITALL);
+ rv = recv_data(fd, res, sizeof(struct sanlk_resource), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -541,7 +567,7 @@ int sanlock_write_lockspace(struct sanlk_lockspace *ls, int max_hosts,
if (rv < 0)
goto out;
- rv = send(fd, ls, sizeof(struct sanlk_lockspace), 0);
+ rv = send_data(fd, ls, sizeof(struct sanlk_lockspace), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -573,13 +599,13 @@ int sanlock_write_resource(struct sanlk_resource *res,
if (rv < 0)
goto out;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
+ rv = send_data(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -613,13 +639,13 @@ int sanlock_read_resource_owners(struct sanlk_resource *res, uint32_t flags,
if (rv < 0)
goto out;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
+ rv = send_data(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -629,7 +655,7 @@ int sanlock_read_resource_owners(struct sanlk_resource *res, uint32_t flags,
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -644,7 +670,7 @@ int sanlock_read_resource_owners(struct sanlk_resource *res, uint32_t flags,
if (rv < 0)
goto out;
- rv = recv(fd, res, sizeof(struct sanlk_resource), MSG_WAITALL);
+ rv = recv_data(fd, res, sizeof(struct sanlk_resource), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -670,7 +696,7 @@ int sanlock_read_resource_owners(struct sanlk_resource *res, uint32_t flags,
hs = hsbuf;
for (i = 0; i < recv_count; i++) {
- ret = recv(fd, hs, sizeof(struct sanlk_host), MSG_WAITALL);
+ ret = recv_data(fd, hs, sizeof(struct sanlk_host), MSG_WAITALL);
if (ret < 0) {
rv = -errno;
free(hsbuf);
@@ -774,17 +800,17 @@ int sanlock_reg_event(const char *ls_name, struct sanlk_host_event *he, uint32_t
if (rv < 0)
goto fail;
- rv = send(reg_fd, &ls, sizeof(ls), 0);
+ rv = send_data(reg_fd, &ls, sizeof(ls), 0);
if (rv < 0)
goto fail;
- rv = send(reg_fd, &ev, sizeof(ev), 0);
+ rv = send_data(reg_fd, &ev, sizeof(ev), 0);
if (rv < 0)
goto fail;
memset(&h, 0, sizeof(h));
- rv = recv(reg_fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(reg_fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto fail;
@@ -821,7 +847,7 @@ int sanlock_end_event(int reg_fd, const char *ls_name, uint32_t flags)
* check if they have been unregistered.
*/
- rv = send(reg_fd, &end, sizeof(end), 0);
+ rv = send_data(reg_fd, &end, sizeof(end), 0);
if (rv < 0) {
close(reg_fd);
return -EALREADY;
@@ -848,13 +874,13 @@ int sanlock_end_event(int reg_fd, const char *ls_name, uint32_t flags)
if (rv < 0)
goto out;
- rv = send(fd, &ls, sizeof(ls), 0);
+ rv = send_data(fd, &ls, sizeof(ls), 0);
if (rv < 0)
goto out;
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -897,13 +923,13 @@ int sanlock_set_event(const char *ls_name, struct sanlk_host_event *he, uint32_t
if (rv < 0)
goto out;
- rv = send(fd, &ls, sizeof(ls), 0);
+ rv = send_data(fd, &ls, sizeof(ls), 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(fd, he, sizeof(struct sanlk_host_event), 0);
+ rv = send_data(fd, he, sizeof(struct sanlk_host_event), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -911,7 +937,7 @@ int sanlock_set_event(const char *ls_name, struct sanlk_host_event *he, uint32_t
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -940,7 +966,7 @@ int sanlock_get_event(int reg_fd, GNUC_UNUSED uint32_t flags, struct sanlk_host_
* get events until we return -EAGAIN to indicate there are no more.
*/
- rv = recv(reg_fd, &cb, sizeof(cb), MSG_DONTWAIT);
+ rv = recv_data(reg_fd, &cb, sizeof(cb), MSG_DONTWAIT);
if (rv < 0)
return -errno;
@@ -1012,7 +1038,7 @@ int sanlock_version(uint32_t flags, uint32_t *version, uint32_t *proto)
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv < 0) {
rv = -errno;
goto out;
@@ -1055,13 +1081,13 @@ int sanlock_killpath(int sock, uint32_t flags, const char *path, char *args)
if (rv < 0)
return rv;
- rv = send(sock, path_max, SANLK_HELPER_PATH_LEN, 0);
+ rv = send_data(sock, path_max, SANLK_HELPER_PATH_LEN, 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(sock, args_max, SANLK_HELPER_ARGS_LEN, 0);
+ rv = send_data(sock, args_max, SANLK_HELPER_ARGS_LEN, 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -1125,27 +1151,27 @@ int sanlock_acquire(int sock, int pid, uint32_t flags, int res_count,
for (i = 0; i < res_count; i++) {
res = res_args[i];
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -1;
goto out;
}
- rv = send(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
+ rv = send_data(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
if (rv < 0) {
rv = -1;
goto out;
}
}
- rv = send(fd, &opt, sizeof(struct sanlk_options), 0);
+ rv = send_data(fd, &opt, sizeof(struct sanlk_options), 0);
if (rv < 0) {
rv = -1;
goto out;
}
if (opt.len) {
- rv = send(fd, opt_in->str, opt.len, 0);
+ rv = send_data(fd, opt_in->str, opt.len, 0);
if (rv < 0) {
rv = -1;
goto out;
@@ -1196,7 +1222,7 @@ int sanlock_inquire(int sock, int pid, uint32_t flags, int *res_count,
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv != sizeof(h)) {
rv = -1;
goto out;
@@ -1214,7 +1240,7 @@ int sanlock_inquire(int sock, int pid, uint32_t flags, int *res_count,
goto out;
}
- rv = recv(fd, reply_data, len, MSG_WAITALL);
+ rv = recv_data(fd, reply_data, len, MSG_WAITALL);
if (rv != len) {
free(reply_data);
rv = -1;
@@ -1264,7 +1290,7 @@ int sanlock_convert(int sock, int pid, uint32_t flags, struct sanlk_resource *re
if (rv < 0)
goto out;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -1310,7 +1336,7 @@ int sanlock_release(int sock, int pid, uint32_t flags, int res_count,
goto out;
for (i = 0; i < res_count; i++) {
- rv = send(fd, res_args[i], sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res_args[i], sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -1;
goto out;
@@ -1343,13 +1369,13 @@ int sanlock_request(uint32_t flags, uint32_t force_mode,
if (rv < 0)
goto out;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
+ rv = send_data(fd, res->disks, sizeof(struct sanlk_disk) * res->num_disks, 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -1388,7 +1414,7 @@ int sanlock_examine(uint32_t flags, struct sanlk_lockspace *ls,
if (rv < 0)
goto out;
- rv = send(fd, data, datalen, 0);
+ rv = send_data(fd, data, datalen, 0);
if (rv < 0) {
rv = -errno;
goto out;
@@ -1418,13 +1444,13 @@ int sanlock_set_lvb(uint32_t flags, struct sanlk_resource *res, char *lvb, int l
if (rv < 0)
return rv;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -errno;
goto out;
}
- rv = send(fd, lvb, lvblen, 0);
+ rv = send_data(fd, lvb, lvblen, 0);
if (rv < 0) {
rv = -1;
goto out;
@@ -1456,7 +1482,7 @@ int sanlock_get_lvb(uint32_t flags, struct sanlk_resource *res, char *lvb, int l
if (rv < 0)
return rv;
- rv = send(fd, res, sizeof(struct sanlk_resource), 0);
+ rv = send_data(fd, res, sizeof(struct sanlk_resource), 0);
if (rv < 0) {
rv = -1;
goto out;
@@ -1466,7 +1492,7 @@ int sanlock_get_lvb(uint32_t flags, struct sanlk_resource *res, char *lvb, int l
memset(&h, 0, sizeof(h));
- rv = recv(fd, &h, sizeof(h), MSG_WAITALL);
+ rv = recv_data(fd, &h, sizeof(h), MSG_WAITALL);
if (rv != sizeof(h)) {
rv = -1;
goto out;
@@ -1484,7 +1510,7 @@ int sanlock_get_lvb(uint32_t flags, struct sanlk_resource *res, char *lvb, int l
goto out;
}
- rv = recv(fd, reply_data, len, MSG_WAITALL);
+ rv = recv_data(fd, reply_data, len, MSG_WAITALL);
if (rv != len) {
free(reply_data);
rv = -1;
7 years, 9 months