mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
block alarm signals during critical sections of vacuum
(This used to be ctdb commit cfb14ae76f00f10d27b56c034b2247ab12d63065)
This commit is contained in:
parent
35e8f2ff6c
commit
3b3fceacbe
@ -22,6 +22,7 @@
|
||||
#include "lib/tdb/include/tdb.h"
|
||||
#include "system/network.h"
|
||||
#include "system/filesys.h"
|
||||
#include "system/wait.h"
|
||||
#include "../include/ctdb_private.h"
|
||||
|
||||
int LogLevel;
|
||||
@ -340,3 +341,21 @@ bool ctdb_same_sockaddr(const struct sockaddr_in *ip1, const struct sockaddr_in
|
||||
{
|
||||
return ctdb_same_ip(ip1, ip2) && ip1->sin_port == ip2->sin_port;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctdb_block_signal(int signum)
|
||||
{
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set,signum);
|
||||
sigprocmask(SIG_BLOCK,&set,NULL);
|
||||
}
|
||||
|
||||
void ctdb_unblock_signal(int signum)
|
||||
{
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set,signum);
|
||||
sigprocmask(SIG_UNBLOCK,&set,NULL);
|
||||
}
|
||||
|
@ -1209,5 +1209,7 @@ int ctdb_repack(struct ctdb_context *ctdb, int argc, const char **argv);
|
||||
|
||||
int32_t ctdb_control_delete_record(struct ctdb_context *ctdb, TDB_DATA indata);
|
||||
|
||||
void ctdb_block_signal(int signum);
|
||||
void ctdb_unblock_signal(int signum);
|
||||
|
||||
#endif
|
||||
|
@ -26,18 +26,6 @@
|
||||
#include "cmdline.h"
|
||||
#include "../include/ctdb_private.h"
|
||||
|
||||
static void block_signal(int signum)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
memset(&act, 0, sizeof(act));
|
||||
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset(&act.sa_mask);
|
||||
sigaddset(&act.sa_mask, signum);
|
||||
sigaction(signum, &act, NULL);
|
||||
}
|
||||
|
||||
static struct {
|
||||
const char *nlist;
|
||||
const char *transport;
|
||||
@ -149,7 +137,7 @@ int main(int argc, const char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
block_signal(SIGPIPE);
|
||||
ctdb_block_signal(SIGPIPE);
|
||||
|
||||
ev = event_context_init(NULL);
|
||||
|
||||
|
@ -208,7 +208,9 @@ static int ctdb_vacuum_one(struct ctdb_context *ctdb, TDB_DATA key,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ctdb_block_signal(SIGALRM);
|
||||
tdb_delete(ctdb_db->ltdb->tdb, key);
|
||||
ctdb_unblock_signal(SIGALRM);
|
||||
tdb_chainunlock(ctdb_db->ltdb->tdb, key);
|
||||
free(data.dptr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user