mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Merge branch '4683-qpzone-tsan-fix' into 'main'
replace qpzone node attributes with atomics Closes #4683 See merge request isc-projects/bind9!9033
This commit is contained in:
commit
6a9ac65f0c
@ -155,12 +155,10 @@ struct qpznode {
|
|||||||
isc_refcount_t erefs;
|
isc_refcount_t erefs;
|
||||||
uint16_t locknum;
|
uint16_t locknum;
|
||||||
void *data;
|
void *data;
|
||||||
unsigned int : 0;
|
atomic_uint_fast8_t nsec;
|
||||||
unsigned int nsec : 2; /*%< range is 0..3 */
|
atomic_bool wild;
|
||||||
unsigned int wild : 1;
|
atomic_bool delegating;
|
||||||
unsigned int delegating : 1;
|
atomic_bool dirty;
|
||||||
unsigned int dirty : 1;
|
|
||||||
unsigned int : 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qpzonedb {
|
struct qpzonedb {
|
||||||
@ -882,7 +880,7 @@ clean_zone_node(qpznode_t *node, uint32_t least_serial) {
|
|||||||
top_prev = current;
|
top_prev = current;
|
||||||
}
|
}
|
||||||
if (!still_dirty) {
|
if (!still_dirty) {
|
||||||
node->dirty = 0;
|
node->dirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,7 +1322,7 @@ rollback_node(qpznode_t *node, uint32_t serial) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (make_dirty) {
|
if (make_dirty) {
|
||||||
node->dirty = 1;
|
node->dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1968,7 +1966,7 @@ add(qpzonedb_t *qpdb, qpznode_t *node, const dns_name_t *nodename,
|
|||||||
newheader->next = topheader->next;
|
newheader->next = topheader->next;
|
||||||
newheader->down = topheader;
|
newheader->down = topheader;
|
||||||
topheader->next = newheader;
|
topheader->next = newheader;
|
||||||
node->dirty = 1;
|
node->dirty = true;
|
||||||
if (changed != NULL) {
|
if (changed != NULL) {
|
||||||
changed->dirty = true;
|
changed->dirty = true;
|
||||||
}
|
}
|
||||||
@ -2014,7 +2012,7 @@ add(qpzonedb_t *qpdb, qpznode_t *node, const dns_name_t *nodename,
|
|||||||
if (changed != NULL) {
|
if (changed != NULL) {
|
||||||
changed->dirty = true;
|
changed->dirty = true;
|
||||||
}
|
}
|
||||||
node->dirty = 1;
|
node->dirty = true;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* No rdatasets of the given type exist at the node.
|
* No rdatasets of the given type exist at the node.
|
||||||
@ -2055,14 +2053,12 @@ add(qpzonedb_t *qpdb, qpznode_t *node, const dns_name_t *nodename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wildcardmagic(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name,
|
wildcardmagic(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name) {
|
||||||
bool lock) {
|
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
dns_name_t foundname;
|
dns_name_t foundname;
|
||||||
dns_offsets_t offsets;
|
dns_offsets_t offsets;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
qpznode_t *node = NULL;
|
qpznode_t *node = NULL;
|
||||||
isc_rwlocktype_t nlocktype = isc_rwlocktype_none;
|
|
||||||
|
|
||||||
dns_name_init(&foundname, offsets);
|
dns_name_init(&foundname, offsets);
|
||||||
n = dns_name_countlabels(name);
|
n = dns_name_countlabels(name);
|
||||||
@ -2080,19 +2076,11 @@ wildcardmagic(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name,
|
|||||||
qpznode_unref(node);
|
qpznode_unref(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the bit, locking if necessary */
|
node->wild = true;
|
||||||
if (lock) {
|
|
||||||
NODE_WRLOCK(&qpdb->node_locks[node->locknum].lock, &nlocktype);
|
|
||||||
}
|
|
||||||
node->wild = 1;
|
|
||||||
if (lock) {
|
|
||||||
NODE_UNLOCK(&qpdb->node_locks[node->locknum].lock, &nlocktype);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
addwildcards(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name,
|
addwildcards(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name) {
|
||||||
bool lock) {
|
|
||||||
dns_name_t foundname;
|
dns_name_t foundname;
|
||||||
dns_offsets_t offsets;
|
dns_offsets_t offsets;
|
||||||
unsigned int n, l, i;
|
unsigned int n, l, i;
|
||||||
@ -2104,7 +2092,7 @@ addwildcards(qpzonedb_t *qpdb, dns_qp_t *qp, const dns_name_t *name,
|
|||||||
while (i < n) {
|
while (i < n) {
|
||||||
dns_name_getlabelsequence(name, n - i, i, &foundname);
|
dns_name_getlabelsequence(name, n - i, i, &foundname);
|
||||||
if (dns_name_iswildcard(&foundname)) {
|
if (dns_name_iswildcard(&foundname)) {
|
||||||
wildcardmagic(qpdb, qp, &foundname, lock);
|
wildcardmagic(qpdb, qp, &foundname);
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@ -2136,7 +2124,7 @@ loading_addrdataset(void *arg, const dns_name_t *name,
|
|||||||
if (rdataset->type != dns_rdatatype_nsec3 &&
|
if (rdataset->type != dns_rdatatype_nsec3 &&
|
||||||
rdataset->covers != dns_rdatatype_nsec3)
|
rdataset->covers != dns_rdatatype_nsec3)
|
||||||
{
|
{
|
||||||
addwildcards(qpdb, loadctx->tree, name, false);
|
addwildcards(qpdb, loadctx->tree, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dns_name_iswildcard(name)) {
|
if (dns_name_iswildcard(name)) {
|
||||||
@ -2154,7 +2142,7 @@ loading_addrdataset(void *arg, const dns_name_t *name,
|
|||||||
return (DNS_R_INVALIDNSEC3);
|
return (DNS_R_INVALIDNSEC3);
|
||||||
}
|
}
|
||||||
|
|
||||||
wildcardmagic(qpdb, loadctx->tree, name, false);
|
wildcardmagic(qpdb, loadctx->tree, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
loading_addnode(loadctx, name, rdataset->type, rdataset->covers, &node);
|
loading_addnode(loadctx, name, rdataset->type, rdataset->covers, &node);
|
||||||
@ -2193,7 +2181,7 @@ loading_addrdataset(void *arg, const dns_name_t *name,
|
|||||||
if (result == ISC_R_SUCCESS &&
|
if (result == ISC_R_SUCCESS &&
|
||||||
delegating_type(qpdb, node, rdataset->type))
|
delegating_type(qpdb, node, rdataset->type))
|
||||||
{
|
{
|
||||||
node->delegating = 1;
|
node->delegating = true;
|
||||||
} else if (result == DNS_R_UNCHANGED) {
|
} else if (result == DNS_R_UNCHANGED) {
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -2521,9 +2509,9 @@ findnodeintree(qpzonedb_t *qpdb, const dns_name_t *name, bool create,
|
|||||||
if (nsec3) {
|
if (nsec3) {
|
||||||
node->nsec = DNS_DB_NSEC_NSEC3;
|
node->nsec = DNS_DB_NSEC_NSEC3;
|
||||||
} else {
|
} else {
|
||||||
addwildcards(qpdb, qp, name, true);
|
addwildcards(qpdb, qp, name);
|
||||||
if (dns_name_iswildcard(name)) {
|
if (dns_name_iswildcard(name)) {
|
||||||
wildcardmagic(qpdb, qp, name, true);
|
wildcardmagic(qpdb, qp, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4738,7 +4726,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
|
|||||||
if (result == ISC_R_SUCCESS &&
|
if (result == ISC_R_SUCCESS &&
|
||||||
delegating_type(qpdb, node, rdataset->type))
|
delegating_type(qpdb, node, rdataset->type))
|
||||||
{
|
{
|
||||||
node->delegating = 1;
|
node->delegating = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NODE_UNLOCK(&qpdb->node_locks[node->locknum].lock, &nlocktype);
|
NODE_UNLOCK(&qpdb->node_locks[node->locknum].lock, &nlocktype);
|
||||||
@ -4906,7 +4894,7 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *dbnode, dns_dbversion_t *dbversion,
|
|||||||
newheader->next = topheader->next;
|
newheader->next = topheader->next;
|
||||||
newheader->down = topheader;
|
newheader->down = topheader;
|
||||||
topheader->next = newheader;
|
topheader->next = newheader;
|
||||||
node->dirty = 1;
|
node->dirty = true;
|
||||||
changed->dirty = true;
|
changed->dirty = true;
|
||||||
resigndelete(qpdb, version, header DNS__DB_FLARG_PASS);
|
resigndelete(qpdb, version, header DNS__DB_FLARG_PASS);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user