set_jcr_job_status(jcr, JS_WaitFD);
if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
+ cancel_storage_daemon_job(jcr);
goto bail_out;
}
return true;
}
+void cancel_storage_daemon_job(JCR *jcr)
+{
+ UAContext *ua = new_ua_context(jcr);
+ JCR *control_jcr = new_control_jcr("*JobCancel*", JT_SYSTEM);
+ BSOCK *sd;
+
+ ua->jcr = control_jcr;
+ if (jcr->store_bsock) {
+ if (!ua->jcr->wstorage) {
+ if (jcr->rstorage) {
+ copy_wstorage(ua->jcr, jcr->rstorage, _("Job resource"));
+ } else {
+ copy_wstorage(ua->jcr, jcr->wstorage, _("Job resource"));
+ }
+ } else {
+ USTORE store;
+ if (jcr->rstorage) {
+ store.store = jcr->rstore;
+ } else {
+ store.store = jcr->wstore;
+ }
+ set_wstorage(ua->jcr, &store);
+ }
+
+ if (!connect_to_storage_daemon(ua->jcr, 10, SDConnectTimeout, 1)) {
+ goto bail_out;
+ }
+ Dmsg0(200, "Connected to storage daemon\n");
+ sd = ua->jcr->store_bsock;
+ sd->fsend("cancel Job=%s\n", jcr->Job);
+ while (sd->recv() >= 0) {
+ }
+ sd->signal(BNET_TERMINATE);
+ sd->close();
+ ua->jcr->store_bsock = NULL;
+ }
+bail_out:
+ free_jcr(control_jcr);
+ free_ua_context(ua);
+}
static void job_monitor_destructor(watchdog_t *self)
{
extern bool create_restore_bootstrap_file(JCR *jcr);
extern void dird_free_jcr(JCR *jcr);
extern void dird_free_jcr_pointers(JCR *jcr);
+extern void cancel_storage_daemon_job(JCR *jcr);
/* migration.c */
extern bool do_migration(JCR *jcr);
*/
set_jcr_job_status(jcr, JS_WaitFD);
if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
+ cancel_storage_daemon_job(jcr);
restore_cleanup(jcr, JS_ErrorTerminated);
return false;
}
*/
set_jcr_job_status(jcr, JS_Blocked);
if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) {
+ cancel_storage_daemon_job(jcr);
return false;
}
void terminate_filed(int sig)
{
+ static bool already_here = false;
+
+ if (already_here) {
+ exit(1); /* prevent loops */
+ }
+ already_here = true;
+ stop_watchdog();
+
bnet_stop_thread_server(server_tid);
generate_daemon_event(NULL, "Exit");
write_state_file(me->working_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs));
if (configfile != NULL) {
free(configfile);
}
+
if (debug_level > 0) {
print_memory_pool_stats();
}
- free_config_resources();
term_msg();
- stop_watchdog();
+ free_config_resources();
cleanup_crypto();
close_memory_pool(); /* release free memory in pool */
sm_dump(false); /* dump orphaned buffers */
if (!(jcr=get_jcr_by_full_name(Job))) {
bnet_fsend(dir, _("3904 Job %s not found.\n"), Job);
} else {
- jcr->lock();
oldStatus = jcr->JobStatus;
set_jcr_job_status(jcr, JS_Canceled);
if (!jcr->authenticated && oldStatus == JS_WaitFD) {
pthread_cond_signal(&jcr->job_start_wait); /* wake waiting thread */
}
- jcr->unlock();
if (jcr->file_bsock) {
bnet_sig(jcr->file_bsock, BNET_TERMINATE);
} else {
bstrncpy(VolumeName, dcr->VolumeName, sizeof(VolumeName));
bstrncpy(dcr->VolumeName, dev->VolHdr.VolumeName, sizeof(dcr->VolumeName));
if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_WRITE)) {
+ POOL_MEM vol_info_msg;
+ pm_strcpy(vol_info_msg, jcr->dir_bsock->msg); /* save error message */
/* Restore desired volume name, note device info out of sync */
/* This gets the info regardless of the Pool */
bstrncpy(dcr->VolumeName, dev->VolHdr.VolumeName, sizeof(dcr->VolumeName));
" Current Volume \"%s\" not acceptable because:\n"
" %s"),
dcrVolCatInfo.VolCatName, dev->VolHdr.VolumeName,
- jcr->dir_bsock->msg);
+ vol_info_msg.c_str());
ask = true;
/* Restore saved DCR before continuing */
bstrncpy(dcr->VolumeName, VolumeName, sizeof(dcr->VolumeName));
*/
#undef VERSION
-#define VERSION "2.3.3"
-#define BDATE "06 September 2007"
-#define LSMDATE "06Sep07"
+#define VERSION "2.3.4"
+#define BDATE "12 September 2007"
+#define LSMDATE "12Sep07"
#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
#define BYEAR "2007" /* year for copyright messages in progs */
General:
12Sep07
+kes Fix error message that was clobbered when Dir tells SD it does not
+ have write permission on Volume. This should fix a minor point
+ in bug #942, but not the main problem.
+kes Add code to cancel job in SD if FD connection fails. This should
+ fix bug #920.
+kes Add code in FD exit to prevent loops and a crash on FreeBSD.
dvl Pass jcr and db into db_escape_string() to enable better escaping
of strings
kes Fix migration code to get correct Volume name with multiple volumes
program.
kes Move patches into patches directory.
11Sep07
-ebl Fix bug #946 about "bacula-dir -t" witch doesn't works
+ebl Fix bug #946 about "bacula-dir -t" which doesn't works
as expected.
09Sep07
ebl Using "m" in bconsole will show messages like before,
kes Suppress chown and chmod error messages if the FD is not running
as root.
07Sep07
-kes Apply Martin Simmons patch that should turn off the new API usage
+kes Apply Martin Simmons' patch that should turn off the new API usage
when batch insert is turned off allowing building on older
PostgreSQLs.
kes Add ./configure search in qwt-qt4 for qwt package
kes Remove enh_fnmatch.c. Make code that references it use fnmatch.c
04Sep07
ebl Detect if new PosgreSQL batch insert API is present.
-kes Correct incorrect mempool call causing Director crash.
+kes Correct incorrect mempool call causing Director crash. Occurs on
+ systems without va_copy().
sb Update spec files for 2.2.1 release
03Sep07
kes Fix memory pool call in ua_output.c. bug #934.