Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
cd0b419f
Commit
cd0b419f
authored
Mar 01, 2017
by
Vitezslav Kriz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
axfr: zone async free with rcu
parent
59e5ab97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
src/knot/events/handlers/refresh.c
src/knot/events/handlers/refresh.c
+31
-4
No files found.
src/knot/events/handlers/refresh.c
View file @
cd0b419f
...
...
@@ -206,6 +206,35 @@ static void axfr_cleanup(struct refresh_data *data)
zone_contents_deep_free
(
&
data
->
axfr
.
zone
);
}
/*! \brief Routine for calling call_rcu() easier way.
*
* TODO: move elsewhere, as it has no direct relation to AXFR
*/
typedef
struct
{
struct
rcu_head
rcuhead
;
void
(
*
ptr_free_fun
)(
void
**
);
void
*
ptr
;
}
callrcu_wrapper_t
;
static
void
callrcu_wrapper_cb
(
struct
rcu_head
*
param
)
{
callrcu_wrapper_t
*
wrap
=
(
callrcu_wrapper_t
*
)
param
;
wrap
->
ptr_free_fun
(
&
wrap
->
ptr
);
free
(
wrap
);
}
/* note: does nothing if not-enough-memory */
static
void
callrcu_wrapper
(
void
*
ptr
,
void
(
*
ptr_free_fun
)(
void
**
))
{
callrcu_wrapper_t
*
wrap
=
malloc
(
sizeof
(
callrcu_wrapper_t
));
if
(
wrap
!=
NULL
)
{
wrap
->
ptr
=
ptr
;
wrap
->
ptr_free_fun
=
ptr_free_fun
;
call_rcu
((
struct
rcu_head
*
)
wrap
,
callrcu_wrapper_cb
);
}
}
static
int
axfr_finalize
(
struct
refresh_data
*
data
)
{
zone_contents_t
*
new_zone
=
data
->
axfr
.
zone
;
...
...
@@ -229,11 +258,9 @@ static int axfr_finalize(struct refresh_data *data)
zone_contents_t
*
old_zone
=
zone_switch_contents
(
data
->
zone
,
new_zone
);
xfr_log_publish
(
data
->
zone
->
name
,
data
->
remote
,
old_zone
,
new_zone
);
synchronize_rcu
();
data
->
axfr
.
zone
=
NULL
;
// seized
zone_contents_deep_free
(
&
old_zone
);
callrcu_wrapper
(
old_zone
,
(
void
(
*
)(
void
**
))
zone_contents_deep_free
);
return
KNOT_EOK
;
}
...
...
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