1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

when we are shutting down, we should first shut down the recovery daemon

(This used to be ctdb commit 39ade6b329adcd3234124d6a8daaa6181abf739b)
This commit is contained in:
Ronnie Sahlberg 2007-10-22 12:34:08 +10:00
parent f022df1d40
commit 4a97876fb7
3 changed files with 20 additions and 4 deletions

View File

@ -365,6 +365,7 @@ struct ctdb_context {
struct _trbt_tree_t *server_ids;
const char *event_script_dir;
const char *default_public_interface;
pid_t recoverd_pid;
};
struct ctdb_db_context {
@ -1038,6 +1039,7 @@ int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *
int32_t ctdb_control_thaw(struct ctdb_context *ctdb);
int ctdb_start_recoverd(struct ctdb_context *ctdb);
void ctdb_stop_recoverd(struct ctdb_context *ctdb);
uint32_t ctdb_get_num_active_nodes(struct ctdb_context *ctdb);

View File

@ -232,6 +232,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
return ctdb->monitoring_mode;
case CTDB_CONTROL_SHUTDOWN:
ctdb_stop_recoverd(ctdb);
ctdb_release_all_ips(ctdb);
ctdb->methods->shutdown(ctdb);
ctdb_event_script(ctdb, "shutdown");

View File

@ -22,6 +22,7 @@
#include "system/filesys.h"
#include "system/time.h"
#include "system/network.h"
#include "system/wait.h"
#include "popt.h"
#include "cmdline.h"
#include "../include/ctdb.h"
@ -1950,18 +1951,17 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
{
int ret;
int fd[2];
pid_t child;
if (pipe(fd) != 0) {
return -1;
}
child = fork();
if (child == -1) {
ctdb->recoverd_pid = fork();
if (ctdb->recoverd_pid == -1) {
return -1;
}
if (child != 0) {
if (ctdb->recoverd_pid != 0) {
close(fd[0]);
return 0;
}
@ -1995,3 +1995,16 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
DEBUG(0,("ERROR: ctdb_recoverd finished!?\n"));
return -1;
}
/*
shutdown the recovery daemon
*/
void ctdb_stop_recoverd(struct ctdb_context *ctdb)
{
if (ctdb->recoverd_pid == 0) {
return;
}
DEBUG(0,("Shutting down recovery daemon\n"));
kill(ctdb->recoverd_pid, SIGTERM);
}