[ovs-git] Open vSwitch: daemon: Avoid races on pidfile creation. (master)

dev at openvswitch.org dev at openvswitch.org
Mon Apr 4 18:01:45 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  aacea8ba432bdffcca77696ba407be0c62661394 (commit)
       via  00c08589876b7c1cd8f57e5ebb3e66bb164c5a3d (commit)
       via  af9a144207eb1b4fdfd735b29f90c41f80aa9a2e (commit)
       via  279c9e030818e039bb1c26be76e2cc1e8f6b13a6 (commit)
       via  fcaddd4dd1e8feefc09ea2664ad51fb669d136f8 (commit)
       via  b725cf028c85d0ebafcf55e503d332bb96fb708c (commit)
       via  67a51a1d851df25eebc676cf24bbb0f821d1c736 (commit)
       via  fe1e967e3bc6c04f773b150fbb358b2350d0ad8c (commit)
       via  1c5a216a80ce40c6af79a8919c7f5a06d1b97a90 (commit)
       via  1d2c568dfdb317055f330f4703923437d565ad3e (commit)
      from  c6b547cd44f14e3ccbac9dc8d98b20a565d32c91 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit aacea8ba432bdffcca77696ba407be0c62661394
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=aacea8ba432bdffcca77696ba407be0c62661394
Author: Ben Pfaff <blp at nicira.com>
		
daemon: Avoid races on pidfile creation.
		
Until now, if two copies of one OVS daemon started up at the same time,
then due to races in pidfile creation it was possible for both of them to
start successfully, instead of just one.  This was made worse when a
previous copy of the daemon had died abruptly, leaving a stale pidfile.

This commit implements a new pidfile creation and removal protocol that I
believe closes these races.  Now, a pidfile is asserted with "link" instead
of "rename", which prevents the race on creation, and a stale pidfile may
only be deleted by a process after it has taken a lock on it.

This may solve mysterious problems seen occasionally on vswitch restart.
I'm still puzzled by these problems, however, because I don't see anything
in our tests cases that would actually cause two copies of a daemon to
start at the same time, which as far as I can see is a necessary
precondition for the problem.


commit 00c08589876b7c1cd8f57e5ebb3e66bb164c5a3d
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=00c08589876b7c1cd8f57e5ebb3e66bb164c5a3d
Author: Ben Pfaff <blp at nicira.com>
		
daemon: Integrate checking for an existing pidfile into daemonize_start().
		
Until now, it has been the responsibility of an individual daemon to call
die_if_already_running() at an appropriate time.  A long time ago, this
had to happen *before* daemonizing, because once the process daemonized
itself there was no way to report failure to the process that originally
started the daemon.  With the introduction of daemonize_start(), this is
now possible, but we haven't been taking advantage of it.

Therefore, this commit integrates the die_if_already_running() call into
daemonize_start() and deletes the calls to it from individual daemons.


commit af9a144207eb1b4fdfd735b29f90c41f80aa9a2e
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=af9a144207eb1b4fdfd735b29f90c41f80aa9a2e
Author: Ben Pfaff <blp at nicira.com>
		
daemon: Tolerate EINTR in fork_and_wait_for_startup().
		
It seems possible that a signal coming in at the wrong time could confuse
this code.  It's always best to loop on EINTR.


commit 279c9e030818e039bb1c26be76e2cc1e8f6b13a6
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=279c9e030818e039bb1c26be76e2cc1e8f6b13a6
Author: Ben Pfaff <blp at nicira.com>
		
Log anything that could prevent a daemon from starting.
		
If a daemon doesn't start, we need to know why.  Being able to
consistently consult the log to find out is helpful.


commit fcaddd4dd1e8feefc09ea2664ad51fb669d136f8
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=fcaddd4dd1e8feefc09ea2664ad51fb669d136f8
Author: Ben Pfaff <blp at nicira.com>
		
util: New function ovs_fatal_valist().
		
This commit adds a few initial users but more are coming up.


commit b725cf028c85d0ebafcf55e503d332bb96fb708c
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=b725cf028c85d0ebafcf55e503d332bb96fb708c
Author: Ben Pfaff <blp at nicira.com>
		
signals: New function signal_name().
		
This will acquire a new user in an upcoming commit.


commit 67a51a1d851df25eebc676cf24bbb0f821d1c736
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=67a51a1d851df25eebc676cf24bbb0f821d1c736
Author: Ben Pfaff <blp at nicira.com>
		
type-props: New macro for estimating length of a decimal integer.
		


commit fe1e967e3bc6c04f773b150fbb358b2350d0ad8c
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=fe1e967e3bc6c04f773b150fbb358b2350d0ad8c
Author: Ben Pfaff <blp at nicira.com>
		
Add a few more users for ovs_retval_to_string().
		


commit 1c5a216a80ce40c6af79a8919c7f5a06d1b97a90
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1c5a216a80ce40c6af79a8919c7f5a06d1b97a90
Author: Ben Pfaff <blp at nicira.com>
		
vlog: Use PRINTF_FORMAT macro from compiler.h.
		
PRINTF_FORMAT is more portable than raw __attribute__.  We use it
elsewhere, I don't know why it wasn't used here.


commit 1d2c568dfdb317055f330f4703923437d565ad3e
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1d2c568dfdb317055f330f4703923437d565ad3e
Author: Ben Pfaff <blp at nicira.com>
		
stream-ssl: Use out_of_memory() to abort due to lack of memory.
		
This matches what xmalloc() does.  It will be handled better by a monitor
process (created with --monitor), which will restart the child instead of
exiting.


-----------------------------------------------------------------------

Summary of changes:
 debian/ovs-monitor-ipsec                           |    4 +-
 lib/command-line.c                                 |   19 +-
 lib/daemon.c                                       |  278 ++++++++++++--------
 lib/daemon.h                                       |    1 -
 lib/entropy.c                                      |    8 +-
 lib/fatal-signal.c                                 |   11 +-
 lib/ovsdb-error.c                                  |   10 +-
 lib/process.c                                      |   38 +--
 lib/random.c                                       |    7 +-
 lib/signals.c                                      |   52 ++++-
 lib/signals.h                                      |    8 +-
 lib/socket-util.c                                  |    7 +
 lib/socket-util.h                                  |    4 +-
 lib/stream-ssl.c                                   |    3 +-
 lib/timeval.c                                      |   25 +-
 lib/timeval.h                                      |    4 +-
 lib/type-props.h                                   |    9 +-
 lib/unixctl.c                                      |    5 +-
 lib/util.c                                         |    9 +-
 lib/util.h                                         |    2 +
 lib/uuid.c                                         |    7 +-
 lib/vlog.c                                         |   27 ++-
 lib/vlog.h                                         |   20 ++-
 ovsdb/ovsdb-server.c                               |    1 -
 python/ovs/daemon.py                               |  201 +++++++++------
 tests/ovsdb-log.at                                 |    2 +-
 tests/test-daemon.py                               |    5 +-
 tests/test-jsonrpc.c                               |    2 -
 tests/test-jsonrpc.py                              |    4 +-
 tests/test-timeval.c                               |    4 +-
 tests/test-type-props.c                            |   13 +-
 utilities/ovs-controller.c                         |    1 -
 utilities/ovs-dpctl.c                              |   11 +-
 utilities/ovs-ofctl.c                              |   19 +-
 utilities/ovs-openflowd.c                          |   45 ++--
 vswitchd/ovs-brcompatd.c                           |   19 +-
 vswitchd/ovs-vswitchd.c                            |    5 +-
 .../usr_share_openvswitch_scripts_ovs-xapi-sync    |    2 -
 38 files changed, 529 insertions(+), 363 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list