Branch: refs/heads/staging
  Home:   https://github.com/lxc/lxc
  Commit: 025ed0f3911836b71f498d8368725c77a7e1932a
      https://github.com/lxc/lxc/commit/025ed0f3911836b71f498d8368725c77a7e1932a
  Author: Serge Hallyn <serge.hal...@ubuntu.com>
  Date:   2013-09-18 (Wed, 18 Sep 2013)

  Changed paths:
    M src/lxc/af_unix.c
    M src/lxc/apparmor.c
    M src/lxc/attach.c
    M src/lxc/bdev.c
    M src/lxc/caps.c
    M src/lxc/cgroup.c
    M src/lxc/commands.c
    M src/lxc/conf.c
    M src/lxc/console.c
    M src/lxc/freezer.c
    M src/lxc/log.c
    M src/lxc/lxccontainer.c
    M src/lxc/lxclock.c
    M src/lxc/lxclock.h
    M src/lxc/lxcutmp.c
    M src/lxc/mainloop.c
    M src/lxc/monitor.c
    M src/lxc/network.c
    M src/lxc/nl.c
    M src/lxc/parse.c
    M src/lxc/seccomp.c
    M src/lxc/start.c
    M src/lxc/state.c
    M src/lxc/sync.c
    M src/lxc/utils.c

  Log Message:
  -----------
  make heavier use of process_lock (v2)

pthread_mutex_lock() will only return an error if it was set to
PTHREAD_MUTEX_ERRORCHECK and we are recursively calling it (and
would otherwise have deadlocked).  If that's the case then log a
message for future debugging and exit.  Trying to "recover" is
nonsense at that point.

process_lock() was held over too long a time in lxcapi_start()
in the daemonize case.  (note the non-daemonized case still needs a
check to enforce that it must NOT be called while threaded).  Add
process_lock() at least across all open/close/socket() calls.

Anything done after a fork() doesn't need the locks as it is no
longer threaded - so some open/close/dups()s are not locked for
that reason.  However, some common functions are called from both
threaded and non-threaded contexts.  So after doing a fork(), do
a possibly-extraneous process_unlock() to make sure that, if we
were forked while pthread mutex was held, we aren't deadlocked by
nobody.

Tested that lp:~serge-hallyn/+junk/lxc-test still works with this
patch.

Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
Tested-by: S.Çağlar Onur <cag...@10ur.org>
Acked-by: Stéphane Graber <stgra...@ubuntu.com>



------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to