mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Note bucket lock requirements and move REQUIRE inside locked section.
This commit is contained in:
@@ -320,7 +320,7 @@ struct fetchctx {
|
|||||||
/*%
|
/*%
|
||||||
* The number of events we're waiting for.
|
* The number of events we're waiting for.
|
||||||
*/
|
*/
|
||||||
unsigned int pending;
|
unsigned int pending; /* Bucket lock. */
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* The number of times we've "restarted" the current
|
* The number of times we've "restarted" the current
|
||||||
@@ -349,7 +349,7 @@ struct fetchctx {
|
|||||||
/*%
|
/*%
|
||||||
* Number of queries that reference this context.
|
* Number of queries that reference this context.
|
||||||
*/
|
*/
|
||||||
unsigned int nqueries;
|
unsigned int nqueries; /* Bucket lock. */
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
* The reason to print when logging a successful
|
* The reason to print when logging a successful
|
||||||
@@ -394,7 +394,7 @@ struct fetchctx {
|
|||||||
#define FCTX_ATTR_HAVEANSWER 0x0001
|
#define FCTX_ATTR_HAVEANSWER 0x0001
|
||||||
#define FCTX_ATTR_GLUING 0x0002
|
#define FCTX_ATTR_GLUING 0x0002
|
||||||
#define FCTX_ATTR_ADDRWAIT 0x0004
|
#define FCTX_ATTR_ADDRWAIT 0x0004
|
||||||
#define FCTX_ATTR_SHUTTINGDOWN 0x0008
|
#define FCTX_ATTR_SHUTTINGDOWN 0x0008 /* Bucket lock */
|
||||||
#define FCTX_ATTR_WANTCACHE 0x0010
|
#define FCTX_ATTR_WANTCACHE 0x0010
|
||||||
#define FCTX_ATTR_WANTNCACHE 0x0020
|
#define FCTX_ATTR_WANTNCACHE 0x0020
|
||||||
#define FCTX_ATTR_NEEDEDNS0 0x0040
|
#define FCTX_ATTR_NEEDEDNS0 0x0040
|
||||||
@@ -5291,11 +5291,12 @@ maybe_destroy(fetchctx_t *fctx, bool locked) {
|
|||||||
dns_validator_t *validator, *next_validator;
|
dns_validator_t *validator, *next_validator;
|
||||||
bool dodestroy = false;
|
bool dodestroy = false;
|
||||||
|
|
||||||
REQUIRE(SHUTTINGDOWN(fctx));
|
|
||||||
|
|
||||||
bucketnum = fctx->bucketnum;
|
bucketnum = fctx->bucketnum;
|
||||||
if (!locked)
|
if (!locked)
|
||||||
LOCK(&res->buckets[bucketnum].lock);
|
LOCK(&res->buckets[bucketnum].lock);
|
||||||
|
|
||||||
|
REQUIRE(SHUTTINGDOWN(fctx));
|
||||||
|
|
||||||
if (fctx->pending != 0 || fctx->nqueries != 0)
|
if (fctx->pending != 0 || fctx->nqueries != 0)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
@@ -6991,6 +6992,9 @@ fctx_increference(fetchctx_t *fctx) {
|
|||||||
isc_refcount_increment(&fctx->references);
|
isc_refcount_increment(&fctx->references);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Requires bucket lock to be held.
|
||||||
|
*/
|
||||||
static bool
|
static bool
|
||||||
fctx_decreference(fetchctx_t *fctx) {
|
fctx_decreference(fetchctx_t *fctx) {
|
||||||
bool bucket_empty = false;
|
bool bucket_empty = false;
|
||||||
|
Reference in New Issue
Block a user