Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
cf5c0e1d
Commit
cf5c0e1d
authored
Mar 05, 2009
by
Quanah Gibson-Mount
Browse files
Once more, mutex_lock -> trylock...
Must use txns everywhere, otherwise it will deadlock
parent
deec312e
Changes
2
Hide whitespace changes
Inline
Side-by-side
servers/slapd/back-bdb/operational.c
View file @
cf5c0e1d
...
...
@@ -34,6 +34,10 @@ bdb_hasSubordinates(
Entry
*
e
,
int
*
hasSubordinates
)
{
struct
bdb_info
*
bdb
=
(
struct
bdb_info
*
)
op
->
o_bd
->
be_private
;
struct
bdb_op_info
*
opinfo
;
OpExtra
*
oex
;
DB_TXN
*
rtxn
;
int
rc
;
assert
(
e
!=
NULL
);
...
...
@@ -47,12 +51,25 @@ bdb_hasSubordinates(
return
LDAP_OTHER
;
}
/* Check for a txn in a parent op, otherwise use reader txn */
LDAP_SLIST_FOREACH
(
oex
,
&
op
->
o_extra
,
oe_next
)
{
if
(
oex
->
oe_key
==
bdb
)
break
;
}
opinfo
=
(
struct
bdb_op_info
*
)
oex
;
if
(
opinfo
&&
opinfo
->
boi_txn
)
{
rtxn
=
opinfo
->
boi_txn
;
}
else
{
rc
=
bdb_reader_get
(
op
,
bdb
->
bi_dbenv
,
&
rtxn
);
if
(
rc
)
return
LDAP_OTHER
;
}
retry:
/* FIXME: we can no longer assume the entry's e_private
* field is correctly populated; so we need to reacquire
* it with reader lock */
rc
=
bdb_cache_children
(
op
,
NULL
,
e
);
rc
=
bdb_cache_children
(
op
,
rtxn
,
e
);
switch
(
rc
)
{
case
DB_LOCK_DEADLOCK
:
case
DB_LOCK_NOTGRANTED
:
...
...
servers/slapd/syncrepl.c
View file @
cf5c0e1d
...
...
@@ -1258,8 +1258,11 @@ do_syncrepl(
if
(
si
==
NULL
)
return
NULL
;
/* There will never be more than one instance active */
ldap_pvt_thread_mutex_lock
(
&
si
->
si_mutex
);
/* Don't get stuck here while a pause is initiated */
while
(
ldap_pvt_thread_mutex_trylock
(
&
si
->
si_mutex
))
{
if
(
!
ldap_pvt_thread_pool_pausecheck
(
&
connection_pool
))
ldap_pvt_thread_yield
();
}
switch
(
abs
(
si
->
si_type
)
)
{
case
LDAP_SYNC_REFRESH_ONLY
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment