]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rados.py: avoid CephManager creation race
authorLoic Dachary <loic@dachary.org>
Thu, 14 Aug 2014 08:49:45 +0000 (10:49 +0200)
committerLoic Dachary <loic@dachary.org>
Thu, 14 Aug 2014 08:57:35 +0000 (10:57 +0200)
commit6237acb316f3505aea6fbca53aca48bcd92bf994
tree02e5056357ac5927e890d5c7d67d1eafc93ff0f9
parent6411dae9813b6b6b7473f25b3b929ee2a4f1bafb
rados.py: avoid CephManager creation race

gevent may hold the rados.py thread when it has an opportunity. The

   if not hasattr(ctx, 'manager'):

must therefore be immediately before the manager creation it is supposed
to protect. If any of the functions called as a side effect of

   first_mon = teuthology.get_first_mon(ctx, config)
   (mon,) = ctx.cluster.only(first_mon).remotes.iterkeys()

give gevent an opportunity to hold the thread, it creates a race
condition.

The other possibility would be use a ctx lock to protect the code, but
this solution seem simpler.

http://tracker.ceph.com/issues/9027 Fixes: #9027

Signed-off-by: Loic Dachary <loic@dachary.org>
tasks/rados.py