Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 2010 09:02:10 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sbin/hastd Makefile control.c control.h event.c event.h hast.conf.5 hast.h hast_proto.c hast_proto.h hastd.8 hastd.c hastd.h hooks.c hooks.h parse.y pjdlog.c pjdlog.h primary.c proto.c proto.h proto_common.c proto_impl.h ...
Message-ID:  <201009230902.o8N92MSI071252@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
pjd         2010-09-23 09:02:10 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_8)
    sbin/hastd           Makefile control.c control.h hast.conf.5 
                         hast.h hast_proto.c hast_proto.h hastd.8 
                         hastd.c hastd.h hooks.c hooks.h parse.y 
                         pjdlog.c pjdlog.h primary.c proto.c 
                         proto.h proto_common.c proto_impl.h 
                         proto_socketpair.c proto_tcp4.c 
                         proto_uds.c secondary.c synch.h token.l 
  Added files:           (Branch: RELENG_8)
    sbin/hastd           event.c event.h 
  Log:
  SVN rev 213049 on 2010-09-23 09:02:10Z by pjd
  
  MFC r208028,r210368,r210702,r210869,r210870,r210872,r210873,r210875,r210876,
    r210879,r210880,r210881,r210882,r210883,r210886,r210892,r211397,r211407,
    r211452,r211875,r211876,r211877,r211878,r211879,r211880,r211881,r211882,
    r211883,r211884,r211885,r211886,r211887,r211895,r211896,r211897,r211898,
    r211899,r211975,r211976,r211977,r211978,r211979,r211981,r211982,r211983,
    r211984,r212033,r212034,r212036,r212037,r212038,r212046,r212049,r212051,
    r212052,r212899,r213003,r213004,r213006,r213007,r213008,r213009:
  
  r208028:
  
  mdoc: move remaining sections into consistent order
  
  This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections.
  
  Found by:       mdocml lint run
  Reviewed by:    ru
  
  r210368:
  
  Actually, only the fullsync mode is implemented, not memsync mode.
  Correct manual page.
  
  r210702:
  
  Spelling fixes.
  
  r210869:
  
  Add an argument to the proto_register() function which allows protocol to
  declare it is the default and be placed at the end of the queue so it is
  checked last.
  
  r210870:
  
  Now that TCP will be checked last we don't need any knowledge about other
  protocols.
  
  r210872:
  
  Mark two more places that we won't reach.
  
  r210873:
  
  Keep $FreeBSD$ in __FBSDID() only for C files.
  
  r210875:
  
  Problem with assertion is that it logs on stderr. Add two macros:
  PJDLOG_ASSERT() and PJDLOG_VERIFY() that will check the given condition
  and log the problem where appropriate. The difference between those
  two is that PJDLOG_VERIFY() always work and PJDLOG_ASSERT() can be
  turned off by defining NDEBUG.
  
  r210876:
  
  Assert that various buffers we are large enough.
  
  r210879:
  
  - Use pjdlog_exitx() to log errors and exit instead of errx().
  - Use 'unable to' (instead of 'cannot') consistently.
  
  r210880:
  
  Reset signal handlers after fork().
  
  r210881:
  
  Allow to use 'none' keywork as remote address in case second cluster node
  is not setup yet.
  
  r210882:
  
  Make control_set_role() more public. We will need it soon.
  
  r210883:
  
  Prepare configuration parsing code to be called multiple times:
  - Don't exit on errors if not requested.
  - Don't keep configuration in global variable, but allocate memory for
    configuration.
  - Call yyrestart() before yyparse() so that on error in configuration file
    we will start from the begining next time and not from the place we left of.
  
  r210886:
  
  Implement configuration reload on SIGHUP. This includes:
  - Load added resources.
  - Stop and forget removed resources.
  - Update modified resources in least intrusive way, ie. don't touch
    /dev/hast/<name> unless path to local component or provider name were
    modified.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r210892:
  
  Document 'none' value for remote.
  
  Reviewed by:    dougb
  
  r211397:
  
  Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
  translating these manual pages.  Minor corrections by me.
  
  Submitted by:   Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
  
  r211407:
  
  The 'size' variable is there to limit how many bytes we want to copy from
  'addr'. It is very likely that size of 'addr' is larger than 'size', so checking
  strlcpy() return value is bogus.
  
  r211452:
  
  For some setups sending data in 128kB chunks makes communication very slow. No
  idea why. 32kB on the other hand seems to work properly everywhere.
  
  Reported by:    Thomas Steen Rasmussen <thomas@gibfest.dk>
  
  r211875:
  
  Make comment more readable.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211876:
  
  Add mtx_owned() implementation.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211877:
  
  Add QUEUE_INSERT() and QUEUE_TAKE() macros that simplify the code a bit.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211878:
  
  We have sync_start() function to start synchronization, introduce sync_stop()
  function to stop it.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211879:
  
  Log that synchronization was interrupted in a proper place.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211880:
  
  Don't increase number synchronized bytes in case of an error.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211881:
  
  - Remove redundant and incorrect 'old' word from debug message.
  - Log disconnects as warnings.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211882:
  
  Implement keepalive mechanism inside HAST protocol so we can detect secondary
  node failures quickly for HAST resources that are rarely modified.
  
  Remove XXX from a comment now that the guard thread never sleeps infinitely.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211883:
  
  Reduce indent where possible.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211884:
  
  When logging to stdout/stderr don't close those descriptors after fork().
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211885:
  
  - Run hooks in background - don't block waiting for them to finish.
  - Keep all hooks we're running in a global list, so we can report when
    they finish and also report when they are running for too long.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211886:
  
  Allow to execute specified program on various HAST events.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211887:
  
  Document new 'exec' parameter.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211895:
  
  Add hooks execution.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211896:
  
  Check if no signals were delivered just before going to sleep.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211897:
  
  Correct when we log interrupted synchronization.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211898:
  
  When logging to stdout/stderr, flush after each log.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211899:
  
  When SIGTERM or SIGINT is received, terminate worker processes.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211975:
  
  Implement mtx_destroy() and rw_destroy().
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211976:
  
  - Add hook_fini() which should be called after fork() from the main hastd
    process, once it start to use hooks.
  - Add hook_check_one() in case the caller expects different child processes
    and once it can recognize it, it will pass pid and status to hook_check_one().
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211977:
  
  Allow to run hooks from the main hastd process.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211978:
  
  - Call hook on role change.
  - Document new event.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211979:
  
  Disconnect after logging errors.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211981:
  
  - Move functionality responsible for checking one connection to separate
    function to make code more readable.
  - Be sure not to reconnect too often in case of signal delivery, etc.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211982:
  
  Use sigtimedwait(2) for signals handling in primary process.
  This fixes various races and eliminates use of pthread* API in signal handler.
  
  Pointed out by: kib
  With help from: jilles
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211983:
  
  Execute hook when split-brain is detected.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r211984:
  
  Execute hook when connection between the nodes is established or lost.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212033:
  
  Constify arguments we can constify.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212034:
  
  Use pjdlog_exit() before fork().
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212036:
  
  When someone gives NULL as data, assume this is because he want to declare
  connection side only.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212037:
  
  We only want to know if descriptors are ready for reading.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212038:
  
  Because it is very hard to make fork(2) from threaded process safe (we are
  limited to async-signal safe functions in the child process), move all hooks
  execution to the main (non-threaded) process.
  
  Do it by maintaining connection (socketpair) between child and parent
  and sending events from the child to parent, so it can execute the hook.
  
  This is step in right direction for others reasons too. For example there is
  one less problem to drop privs in worker processes.
  
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212046:
  
  Mask only those signals that we want to handle.
  
  Suggested by:   jilles
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212049:
  
  Forgot to add event.c and event.h in r212038.
  
  Pointed out by: pluknet <pluknet@gmail.com>
  Obtained from:  Wheel Systems Sp. z o.o. http://www.wheelsystems.com
  
  r212051:
  
  Correct error message.
  
  Submitted by:   Mikolaj Golub <to.my.trociny@gmail.com>
  
  r212052:
  
  Include process PID in log messages.
  
  Submitted by:   Mikolaj Golub <to.my.trociny@gmail.com>
  
  r212899:
  
  Add __dead2 to functions that we know they are going to exit.
  
  r213003:
  
  Sort includes.
  
  r213004:
  
  If we are unable to receive control message is most likely because the main
  process died. Instead of entering infinite loop, terminate.
  
  r213006:
  
  Fix descriptor leaks: when child exits, we have to close control and event
  socket pairs. We did that only in one case out of three.
  
  r213007:
  
  Fix possible deadlock where worker process sends an event to the main process
  while the main process sends control message to the worker process, but worker
  process hasn't started control thread yet, because it waits for reply from the
  main process.
  
  The fix is to start the control thread before sending any events.
  
  Reported and fix suggested by:  Mikolaj Golub <to.my.trociny@gmail.com>
  
  r213008:
  
  Assert that descriptor numbers are sane.
  
  r213009:
  
  Switch to sigprocmask(2) API also in the main process and secondary process.
  This way the primary process inherits signal mask from the main process,
  which fixes a race where signal is delivered to the primary process before
  configuring signal mask.
  
  Reported by:    Mikolaj Golub <to.my.trociny@gmail.com>
  
  Revision  Changes    Path
  1.3.2.5   +1 -1      src/sbin/hastd/Makefile
  1.1.2.3   +38 -13    src/sbin/hastd/control.c
  1.1.2.3   +5 -0      src/sbin/hastd/control.h
  1.1.2.2   +162 -0    src/sbin/hastd/event.c (new)
  1.1.2.2   +46 -0     src/sbin/hastd/event.h (new)
  1.1.2.4   +99 -19    src/sbin/hastd/hast.conf.5
  1.1.2.4   +12 -2     src/sbin/hastd/hast.h
  1.1.2.5   +16 -14    src/sbin/hastd/hast_proto.c
  1.1.2.3   +5 -5      src/sbin/hastd/hast_proto.h
  1.1.2.3   +17 -17    src/sbin/hastd/hastd.8
  1.2.2.6   +306 -53   src/sbin/hastd/hastd.c
  1.1.2.3   +1 -0      src/sbin/hastd/hastd.h
  1.1.2.3   +273 -20   src/sbin/hastd/hooks.c
  1.1.2.3   +10 -2     src/sbin/hastd/hooks.h
  1.1.2.4   +168 -74   src/sbin/hastd/parse.y
  1.2.2.4   +26 -2     src/sbin/hastd/pjdlog.c
  1.1.2.3   +13 -0     src/sbin/hastd/pjdlog.h
  1.3.2.6   +311 -129  src/sbin/hastd/primary.c
  1.1.2.4   +13 -6     src/sbin/hastd/proto.c
  1.1.2.4   +2 -2      src/sbin/hastd/proto.h
  1.1.2.4   +1 -2      src/sbin/hastd/proto_common.c
  1.1.2.3   +2 -2      src/sbin/hastd/proto_impl.h
  1.2.2.4   +9 -1      src/sbin/hastd/proto_socketpair.c
  1.1.2.4   +15 -13    src/sbin/hastd/proto_tcp4.c
  1.1.2.3   +7 -6      src/sbin/hastd/proto_uds.c
  1.1.2.5   +113 -67   src/sbin/hastd/secondary.c
  1.1.2.3   +24 -0     src/sbin/hastd/synch.h
  1.1.2.4   +1 -0      src/sbin/hastd/token.l



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009230902.o8N92MSI071252>