Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
BIND
Commits
37225662
Commit
37225662
authored
Jan 05, 2004
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1534. [bug] Race condition when priming cache. [RT# 9940]
parent
62700b67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
CHANGES
CHANGES
+1
-1
lib/dns/resolver.c
lib/dns/resolver.c
+22
-11
No files found.
CHANGES
View file @
37225662
...
...
@@ -30,7 +30,7 @@
1535. [bug] When parsing APL records it was possible to silently
accept out of range ADDRESSFAMILY values. [RT# 9979]
1534. [
placeholder
]
1534. [
bug] Race condition when priming cache. [RT# 9940
]
1533. [placeholder]
...
...
lib/dns/resolver.c
View file @
37225662
...
...
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.27
4
2004/01/05 0
5
:4
4:25
marka Exp $ */
/* $Id: resolver.c,v 1.27
5
2004/01/05 0
7
:4
5:34
marka Exp $ */
#include <config.h>
...
...
@@ -270,6 +270,7 @@ struct dns_resolver {
isc_mem_t
*
mctx
;
isc_mutex_t
lock
;
isc_mutex_t
nlock
;
isc_mutex_t
primelock
;
dns_rdataclass_t
rdclass
;
isc_socketmgr_t
*
socketmgr
;
isc_timermgr_t
*
timermgr
;
...
...
@@ -291,6 +292,7 @@ struct dns_resolver {
isc_eventlist_t
whenshutdown
;
unsigned
int
activebuckets
;
isc_boolean_t
priming
;
/* Locked by primelock. */
dns_fetch_t
*
primefetch
;
/* Locked by nlock. */
unsigned
int
nfctx
;
...
...
@@ -5274,6 +5276,7 @@ destroy(dns_resolver_t *res) {
INSIST
(
res
->
nfctx
==
0
);
DESTROYLOCK
(
&
res
->
primelock
);
DESTROYLOCK
(
&
res
->
nlock
);
DESTROYLOCK
(
&
res
->
lock
);
for
(
i
=
0
;
i
<
res
->
nbuckets
;
i
++
)
{
...
...
@@ -5422,12 +5425,19 @@ dns_resolver_create(dns_view_t *view,
if
(
result
!=
ISC_R_SUCCESS
)
goto
cleanup_lock
;
result
=
isc_mutex_init
(
&
res
->
primelock
);
if
(
result
!=
ISC_R_SUCCESS
)
goto
cleanup_nlock
;
res
->
magic
=
RES_MAGIC
;
*
resp
=
res
;
return
(
ISC_R_SUCCESS
);
cleanup_nlock:
DESTROYLOCK
(
&
res
->
nlock
);
cleanup_lock:
DESTROYLOCK
(
&
res
->
lock
);
...
...
@@ -5469,8 +5479,10 @@ prime_done(isc_task_t *task, isc_event_t *event) {
INSIST
(
res
->
priming
);
res
->
priming
=
ISC_FALSE
;
LOCK
(
&
res
->
primelock
);
fetch
=
res
->
primefetch
;
res
->
primefetch
=
NULL
;
UNLOCK
(
&
res
->
primelock
);
UNLOCK
(
&
res
->
lock
);
...
...
@@ -5491,7 +5503,6 @@ prime_done(isc_task_t *task, isc_event_t *event) {
void
dns_resolver_prime
(
dns_resolver_t
*
res
)
{
isc_boolean_t
want_priming
=
ISC_FALSE
;
dns_fetch_t
*
fetch
;
dns_rdataset_t
*
rdataset
;
isc_result_t
result
;
...
...
@@ -5531,21 +5542,21 @@ dns_resolver_prime(dns_resolver_t *res) {
return
;
}
dns_rdataset_init
(
rdataset
);
fetch
=
NULL
;
LOCK
(
&
res
->
primelock
)
;
result
=
dns_resolver_createfetch
(
res
,
dns_rootname
,
dns_rdatatype_ns
,
NULL
,
NULL
,
NULL
,
0
,
res
->
buckets
[
0
].
task
,
prime_done
,
res
,
rdataset
,
NULL
,
&
fetch
);
LOCK
(
&
res
->
lock
);
INSIST
(
res
->
priming
);
INSIST
(
res
->
primefetch
==
NULL
);
if
(
result
==
ISC_R_SUCCESS
)
res
->
primefetch
=
fetch
;
else
res
,
rdataset
,
NULL
,
&
res
->
primefetch
);
UNLOCK
(
&
res
->
primelock
);
if
(
result
!=
ISC_R_SUCCESS
)
{
LOCK
(
&
res
->
lock
);
INSIST
(
res
->
priming
);
res
->
priming
=
ISC_FALSE
;
UNLOCK
(
&
res
->
lock
);
UNLOCK
(
&
res
->
lock
);
}
}
}
...
...
Write
Preview
Markdown
is supported
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