diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 0d0f2fea448..1b4143985fe 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -4123,7 +4123,9 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ... return -1; } - return 0; + ctdb->can_send_controls = true; + + return 0; } /* diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 1ff4c1f9aa2..061c16d2c4c 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -346,6 +346,7 @@ pid_t ctdb_fork(struct ctdb_context *ctdb) if (ctdb->do_setsched) { ctdb_restore_scheduler(ctdb); } + ctdb->can_send_controls = false; } return pid; } diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index f420e6c3417..272b94aa86d 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -483,6 +483,9 @@ struct ctdb_context { /* Used to defer db attach requests while in recovery mode */ struct ctdb_deferred_attach_context *deferred_attach; + + /* if we are a child process, do we have a domain socket to send controls on */ + bool can_send_controls; }; struct ctdb_db_context { diff --git a/ctdb/server/ctdb_vacuum.c b/ctdb/server/ctdb_vacuum.c index ff373564f82..e0e1e3b5089 100644 --- a/ctdb/server/ctdb_vacuum.c +++ b/ctdb/server/ctdb_vacuum.c @@ -1560,8 +1560,16 @@ int32_t ctdb_local_schedule_for_deletion(struct ctdb_db_context *ctdb_db, return ret; } - /* child process: send the main daemon a control */ + /* if we dont have a connection to the daemon we can not send + a control. For example sometimes from update_record control child + process. + */ + if (!ctdb_db->ctdb->can_send_controls) { + return -1; + } + + /* child process: send the main daemon a control */ indata.dsize = offsetof(struct ctdb_control_schedule_for_deletion, key) + key.dsize; indata.dptr = talloc_zero_array(ctdb_db, uint8_t, indata.dsize); if (indata.dptr == NULL) {