summaryrefslogtreecommitdiffstats
path: root/pym/portage/dbapi/vartree.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-05-14 16:53:35 -0700
committerZac Medico <zmedico@gentoo.org>2011-05-14 16:53:35 -0700
commit461564ae94ff936918eeaa18493bc1da3846796f (patch)
tree77f2eb6843f7915d388cb7e982d5e25464e1106f /pym/portage/dbapi/vartree.py
parent2610d89a6bc1f7df847878bbd1ebbfbe747dacc2 (diff)
downloadportage-461564ae94ff936918eeaa18493bc1da3846796f.tar.gz
portage-461564ae94ff936918eeaa18493bc1da3846796f.tar.bz2
portage-461564ae94ff936918eeaa18493bc1da3846796f.zip
counter_tick_core: don't lock if parallel-install
Hopefully this avoids the following exception: File "/usr/lib/portage/pym/portage/locks.py", line 138, in lockfile fcntl.lockf(myfd, fcntl.LOCK_EX) IOError: [Errno 35] Resource deadlock avoided
Diffstat (limited to 'pym/portage/dbapi/vartree.py')
-rw-r--r--pym/portage/dbapi/vartree.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index fca590a0b..802253afc 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -789,7 +789,15 @@ class vardbapi(dbapi):
"""
myroot = None
mycpv = None
- self.lock()
+ locked_vdb = False
+ if "parallel-install" not in self.settings.features:
+ # If parallel-install is enabled, it's unsafe to
+ # lock the vdb here since the portage.locks module
+ # does not behave as desired if we try to lock the
+ # same file multiple times concurrently from the
+ # same process.
+ self.lock()
+ locked_vdb = True
try:
counter = self.get_counter_tick_core() - 1
if self._cached_counter != counter:
@@ -803,7 +811,8 @@ class vardbapi(dbapi):
write_atomic(self._counter_path, str(counter))
self._cached_counter = counter
finally:
- self.unlock()
+ if locked_vdb:
+ self.unlock()
return counter