[libknet] Unlock the global lock if logging pipe is full.
If a write to the logging pipe fails (eg it's busy
waiting on something else, I've seen this in corosync
at shutdown) then we must unlock the global_rwlock
or we'll never get out of this alive.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com> Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Bin Liu [Fri, 17 Feb 2017 07:44:43 +0000 (15:44 +0800)]
Fix: remove duplicate judgement of (have_name < 0) in kronosnetd/vty_cli_cmds.c
In line 1087 of kronosnetd/vty_cli_cmds.c, there is a judgement of
(have_name < 0), when have_name < 0, it will return 0, which make
the judge of have_name < 0 in line 1094 will never be executed.
Remove the unnecessary judgement.
as requested by different kernel developers, we should stop
using both sendmmsg and recvmmsg.
as temporary solution use Jan's compat wrappers. the whole TX/RX
code will need review to do a full proper switch since all
error codes will change and propagate differently to transport hooks
and knet_send_sync users
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
as requested by different kernel developers, we should stop
using both sendmmsg and recvmmsg.
as temporary solution use Jan's compat wrappers. the whole TX/RX
code will need review to do a full proper switch since all
error codes will change and propagate differently to transport hooks
and knet_send_sync users
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
[tx] increase timeres on TX pressure and reduce log noise
when TX sockets are overloaded, we spend more time spitting out
logs than recovering from the overload. ifdef the logging on
critical path out (still available with debug build).
also drastically reduce the waiting time by 64x.
this changes increases UDP perf on 3 nodes by 200%
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
[send/recv] Unify and simplify usage of seq_num in packets
IMPORTANT: this commit changes onwire protocol in an incompatible way!
- remove the concet of bcast and mcast seq num and use one tx_seq_num
- stop using LINK_UP_DOWN messages to broadcast node seq num and
transfer this data inside heartbeat messages
- LINK_UP_DOWN messages are currently unused but let's keep the
infrastructure around for future
- minor cleanup in host_set_policy to confirm change of switching
policy in the logs
- _link_updown should use async call to host dstcache update
due to locking context
- switch knet_link_set_enable to use write locking context
since the only reason it was read lock, was due to the need
to send LINK_UP_DOWN messages
- knet_link_set_priority can now use dstcache in sync mode
- add seq_num and heartbeat type (timed/untimed) data to heartbeat
messages. timed messages are generated regularly by hb_thread.
untimed messages are generated by the TX thread to sync seq_num
on heavy load across all connected node. (see comments in the code)
- access to the node seq_num is now mutex locked
- abstract ability to send pings from multiple threads
- special case seq_num == 0 to detect a node crash and coming back
to life before hb_thread can detect the disconnection
- forcefully send ping in the TX thread every SEQ_MAX / 8 packets
to allow nodes to sync seq_num
- optimize TX thread code to prepare the outgoing buffers once
vs multiple times. There is still work that can be done here
to optimize sending to multiple host, but this change
is intrusive enough already as it is
- add logic to clear circular buffers when receiving pings
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
[host] remove completely broken host to host communication locking system
the original idea was to have a host-to-host (semi-)reliable communication protocol
but that just isn't possible without flow control and retransmit
IIRC the only side affect of this missing lock is a corner case where:
1) node A totally crashes
2) node A come backs to life, sends it's status info (seq_num information)
3) node B does NOT receive the status info
4) node A starts sending traffic and a few packets might get lost
this will be solved when rewriting the TX thread to optimize the seq_num handling
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
[transport] fix support for dynamic links connections
- add internal transport API for handling incoming dynamic connections (both UDP and SCTP)
- fix copy/compare address code in RX thread
- make sure to reset sockaddr_storage len in iov
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Although FreeBSD 11 has sendmmsg & recvmmsg wrappers, they
don't quite work the same as Linux so I've enabled the (fixed)
compat versions for that platform.
- fix trasport is_data API
- handle per accepted socket reassembly buffer by changing fd_tracker
data for incoming connections
- allow in-kernel SCTP fragmentation again
- use MSG_EOR on a per socket base to reassemble partial packet delivery
- fix some whitespaces around
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
This is enough to get knet compiling on FreeBSD 11 and bits of it
working. It's nowhere near ready on BSD though, more work is needed,
but given the fast pace of development it's best to get this in now
rather than track it in a separate branch.
[api] add commodity functions to convert to/from strings/sockaddress
functions are nothing more than wrappers for getnameinfo and getaddrinfo
with some sanity checks, but exposing them around saves lots of
maintanance of duplicate code across different stuff.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
[sctp] port sctp to the new API and fix many issues
- use the new transport API
- fix locking context around to avoid race conditions and deadlocking
- fix shutdown code (segfaults and core dumps)
- properly differentiate between connecting sockets and accepted sockets
and better use of fd_tracker
- abstract as much as possible socket management code from threads
- add lots of comments and debugging messages around
- simplify socket error management reported from RX thread
- rework loop timers for connect_thread to avoid thread overload
- reduce usage of _transport_addrtostr to one call and reuse
link information around
- improve error handling across the board
- stop using data structs inside epolls and switch back to using fds
this was necessary to avoid processing stale data from epolls
and look up data from fd_tracket instead
- add listener stop function
- make functions safer to be called multiple times
- probably more.. but can't remember
NOTE: this is not the most elegant code, but it seems to be doing its job
fine.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>