Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure other tasks are processed with tasklists that contain both bad xfrs (that cause reload to exit) and other tasks #332

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions difffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,7 @@ check_for_bad_serial(namedb_type* db, const char* zone_str, uint32_t old_serial)

int
apply_ixfr_for_zone(nsd_type* nsd, zone_type* zone, FILE* in,
struct nsd_options* ATTR_UNUSED(opt), udb_base* taskudb, udb_ptr* last_task,
uint32_t xfrfilenr)
struct nsd_options* ATTR_UNUSED(opt), udb_base* taskudb, uint32_t xfrfilenr)
{
char zone_buf[3072];
char log_buf[5120];
Expand All @@ -1289,7 +1288,6 @@ apply_ixfr_for_zone(nsd_type* nsd, zone_type* zone, FILE* in,
uint8_t committed;
uint32_t i;
int num_bytes = 0;
(void)last_task;
assert(zone);

/* read zone name and serial */
Expand Down Expand Up @@ -2085,9 +2083,8 @@ task_process_zonestat_inc(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
}
#endif

static void
task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
udb_ptr* task)
void
task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr* task)
{
/* we have to use an udb_ptr task here, because the apply_xfr procedure
* appends soa_info which may remap and change the pointer. */
Expand All @@ -2099,6 +2096,7 @@ task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
if(!zone) {
/* assume the zone has been deleted and a zone transfer was
* still waiting to be processed */
udb_ptr_free_space(task, udb, TASKLIST(task)->size);
return;
}

Expand All @@ -2110,10 +2108,11 @@ task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
/* soainfo_gone will be communicated from server_reload, unless
preceding updates have been applied */
zone->is_skipped = 1;
udb_ptr_free_space(task, udb, TASKLIST(task)->size);
return;
}
/* read and apply zone transfer */
switch(apply_ixfr_for_zone(nsd, zone, df, nsd->options, udb, last_task,
switch(apply_ixfr_for_zone(nsd, zone, df, nsd->options, udb,
TASKLIST(task)->yesno)) {
case 1: /* Success */
break;
Expand All @@ -2131,6 +2130,7 @@ task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
default:break;
}
fclose(df);
udb_ptr_free_space(task, udb, TASKLIST(task)->size);
}


Expand Down Expand Up @@ -2176,9 +2176,6 @@ void task_process_in_reload(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
task_process_zonestat_inc(nsd, udb, last_task, TASKLIST(task));
break;
#endif
case task_apply_xfr:
task_process_apply_xfr(nsd, udb, last_task, task);
break;
case task_add_cookie_secret:
task_process_add_cookie_secret(nsd, TASKLIST(task));
break;
Expand Down
4 changes: 2 additions & 2 deletions difffile.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ int add_RR(namedb_type* db, const dname_type* dname,

/* apply the xfr file identified by xfrfilenr to zone */
int apply_ixfr_for_zone(struct nsd* nsd, zone_type* zone, FILE* in,
struct nsd_options* opt, udb_base* taskudb, udb_ptr* last_task,
uint32_t xfrfilenr);
struct nsd_options* opt, udb_base* taskudb, uint32_t xfrfilenr);

enum soainfo_hint {
soainfo_ok,
Expand Down Expand Up @@ -157,6 +156,7 @@ void task_new_drop_cookie_secret(udb_base* udb, udb_ptr* last);
void task_new_activate_cookie_secret(udb_base* udb, udb_ptr* last);
int task_new_apply_xfr(udb_base* udb, udb_ptr* last, const dname_type* zone,
uint32_t old_serial, uint32_t new_serial, uint64_t filenumber);
void task_process_apply_xfr(struct nsd* nsd, udb_base* udb, udb_ptr *task);
void task_process_in_reload(struct nsd* nsd, udb_base* udb, udb_ptr *last_task,
udb_ptr* task);
void task_process_expire(namedb_type* db, struct task_list_d* task);
Expand Down
10 changes: 10 additions & 0 deletions ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,16 @@ parent_handle_reload_command(netio_type *ATTR_UNUSED(netio),
}
parent_check_all_children_exited(nsd);
break;
case NSD_QUIT_NOTIFIER:
/* This process only served as pass through for notifies (from
* the serve processes). When this signal is received, this
* process should quit immediately.
*/
DEBUG(DEBUG_IPC,1, (LOG_INFO, "parent_handle_reload_command: "
"quit notifier"));
/* Do silent shutdown in server_main */
nsd->mode = NSD_QUIT_NOTIFIER;
break;
default:
log_msg(LOG_ERR, "handle_reload_command: bad mode %d",
(int) mode);
Expand Down
9 changes: 9 additions & 0 deletions nsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ struct dt_collector;
*/
#define NSD_RELOAD_FAILED 14

/*
* QUIT_NOTIFIER is sent to the "notifier" process that is responsible for
* channeling incoming notifies from the server processes to the transfer
* daemon (via NSD_PASS_TO_XFRD), when the "reload" process is applying non-xfr
* tasks (like writing zone files which may take long).
*/
#define NSD_QUIT_NOTIFIER 15


#define NSD_SERVER_MAIN 0x0U
#define NSD_SERVER_UDP 0x1U
#define NSD_SERVER_TCP 0x2U
Expand Down
Loading
Loading