1 |
commit: 461564ae94ff936918eeaa18493bc1da3846796f |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 14 23:53:35 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 14 23:53:35 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=461564ae |
7 |
|
8 |
counter_tick_core: don't lock if parallel-install |
9 |
|
10 |
Hopefully this avoids the following exception: |
11 |
|
12 |
File "/usr/lib/portage/pym/portage/locks.py", line 138, in lockfile |
13 |
fcntl.lockf(myfd, fcntl.LOCK_EX) |
14 |
IOError: [Errno 35] Resource deadlock avoided |
15 |
|
16 |
--- |
17 |
pym/portage/dbapi/vartree.py | 13 +++++++++++-- |
18 |
1 files changed, 11 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py |
21 |
index fca590a..802253a 100644 |
22 |
--- a/pym/portage/dbapi/vartree.py |
23 |
+++ b/pym/portage/dbapi/vartree.py |
24 |
@@ -789,7 +789,15 @@ class vardbapi(dbapi): |
25 |
""" |
26 |
myroot = None |
27 |
mycpv = None |
28 |
- self.lock() |
29 |
+ locked_vdb = False |
30 |
+ if "parallel-install" not in self.settings.features: |
31 |
+ # If parallel-install is enabled, it's unsafe to |
32 |
+ # lock the vdb here since the portage.locks module |
33 |
+ # does not behave as desired if we try to lock the |
34 |
+ # same file multiple times concurrently from the |
35 |
+ # same process. |
36 |
+ self.lock() |
37 |
+ locked_vdb = True |
38 |
try: |
39 |
counter = self.get_counter_tick_core() - 1 |
40 |
if self._cached_counter != counter: |
41 |
@@ -803,7 +811,8 @@ class vardbapi(dbapi): |
42 |
write_atomic(self._counter_path, str(counter)) |
43 |
self._cached_counter = counter |
44 |
finally: |
45 |
- self.unlock() |
46 |
+ if locked_vdb: |
47 |
+ self.unlock() |
48 |
|
49 |
return counter |