[lxc-devel] [PATCH 1/1] make heavier use of process_lock (v2)
S.Çağlar Onur
caglar at 10ur.org
Wed Sep 18 16:08:56 UTC 2013
Hi Serge,
[resending as lxc-devel rejected my first mail due to its size]
On Wed, Sep 18, 2013 at 11:20 AM, Serge Hallyn <serge.hallyn at ubuntu.com>wrote:
> 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.
>
> lxc-test-concurrent with this patchset passes almost 100%. I
> occasionally get failures of containers to start (but no task
> corruption) which I've yet to look into. Certainly it seems a
> huge improvement.
>
It is a huge improvement, thanks! I'm observing very same thing that you
described with my test suite. Concurrent creates/stops/shutdowns and
destroys are now %100 passing but some start calls are failing time to time.
Tested-by: S.Çağlar Onur <caglar at 10ur.org>
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/af_unix.c | 15 ++++
> src/lxc/apparmor.c | 11 +++
> src/lxc/attach.c | 35 +++++++++
> src/lxc/bdev.c | 96 +++++++++++++++++++++---
> src/lxc/caps.c | 5 ++
> src/lxc/cgroup.c | 35 +++++++++
> src/lxc/commands.c | 11 +++
> src/lxc/conf.c | 83 +++++++++++++++++++-
> src/lxc/console.c | 72 ++++++++++++------
> src/lxc/freezer.c | 5 ++
> src/lxc/log.c | 7 ++
> src/lxc/lxccontainer.c | 200
> ++++++++++++++++++++++++++++++++-----------------
> src/lxc/lxclock.c | 9 ++-
> src/lxc/lxclock.h | 2 +-
> src/lxc/lxcutmp.c | 11 +++
> src/lxc/mainloop.c | 11 ++-
> src/lxc/monitor.c | 18 ++++-
> src/lxc/network.c | 9 +++
> src/lxc/nl.c | 5 ++
> src/lxc/parse.c | 5 ++
> src/lxc/seccomp.c | 5 ++
> src/lxc/start.c | 31 +++++++-
> src/lxc/state.c | 5 ++
> src/lxc/sync.c | 12 ++-
> src/lxc/utils.c | 52 +++++++++++--
> 25 files changed, 627 insertions(+), 123 deletions(-)
>
Cheers,
--
S.Çağlar Onur <caglar at 10ur.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130918/bfdfca78/attachment.html>
More information about the lxc-devel
mailing list