From f9a3272bf2263137ff8d018d4cf969f28196b8f7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 11 Sep 2007 22:14:42 +0000 Subject: [PATCH] kes Implement patch supplied by Landon to fix bug #944 where using TLS with bconsole uses 99+% of the CPU. kes Note, you need GTK >= 2.10 to be able to link the Tray Monitor program. kes Move patches into patches directory. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5528 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ReleaseNotes | 16 + bacula/kernstodo | 1 + .../patches/{ => 2.0.x}/2.0.1-restart.patch | 0 bacula/patches/{ => 2.0.x}/2.0.3-ampm.patch | 0 .../{ => 2.0.x}/2.0.3-maxbyteslist.patch | 0 .../{ => 2.0.x}/2.0.3-maxwaittime.patch | 0 .../2.0.3-scheduler-next-hour.patch | 0 .../{ => 2.0.x}/2.0.3-tls-disconnect.patch | 0 bacula/patches/{ => 2.0.x}/2.0.3-verify.patch | 0 bacula/patches/2.2.0-restore.patch | 322 ++++++++++++++++++ bacula/patches/2.2.1-restore.patch | 117 +++++++ bacula/patches/2.2.2-restore.patch | 117 +++++++ bacula/patches/2.2.3-tls.patch | 43 +++ bacula/technotes-2.3 | 6 + 14 files changed, 622 insertions(+) rename bacula/patches/{ => 2.0.x}/2.0.1-restart.patch (100%) rename bacula/patches/{ => 2.0.x}/2.0.3-ampm.patch (100%) rename bacula/patches/{ => 2.0.x}/2.0.3-maxbyteslist.patch (100%) rename bacula/patches/{ => 2.0.x}/2.0.3-maxwaittime.patch (100%) rename bacula/patches/{ => 2.0.x}/2.0.3-scheduler-next-hour.patch (100%) rename bacula/patches/{ => 2.0.x}/2.0.3-tls-disconnect.patch (100%) rename bacula/patches/{ => 2.0.x}/2.0.3-verify.patch (100%) create mode 100644 bacula/patches/2.2.0-restore.patch create mode 100644 bacula/patches/2.2.1-restore.patch create mode 100644 bacula/patches/2.2.2-restore.patch create mode 100644 bacula/patches/2.2.3-tls.patch diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index f8247782b2..7be316919f 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -10,6 +10,22 @@ use some of the new features that affect the FD. In other words, you should not have to upgrade all your File daemons when you upgrade. There is no database upgrade needed from version 2.0.x to 2.2.0. +Version 2.2.3 is a critical bug fix release to version 2.2.2 +- Fix bug #935, and possibly also bug #903 where files were not + restored. MediaId was not properly set in JobMedia record after + a Volume change. This bug is known to affect all versions from + 2.0.0 on, and probably versions prior to that. A detailed analysis + of the bug can be found at: + + http://www.bacula.org/downloads/bug-395.txt + +- Add ./configure search in qwt-qt4 for qwt package +- Apply Martin Simmons patch that should turn off the new API usage + when batch insert is turned off allowing building on older + PostgreSQLs. +- Note, you need GTK >= 2.10 to be able to link the Tray Monitor + program. + Version 2.2.2 is a bug fix release to 2.2.1 - Detect if new PosgreSQL batch insert API is present. - Correct incorrect mempool call causing Director crash. diff --git a/bacula/kernstodo b/bacula/kernstodo index a26fc7f848..8eed47c6b8 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -180,6 +180,7 @@ Projects: For next release: +- Try to fix bscan not working with multiple DVD volumes bug #912. - Look at mondo/mindi - Don't restore Solaris Door files: #define S_IFDOOR in st_mode. diff --git a/bacula/patches/2.0.1-restart.patch b/bacula/patches/2.0.x/2.0.1-restart.patch similarity index 100% rename from bacula/patches/2.0.1-restart.patch rename to bacula/patches/2.0.x/2.0.1-restart.patch diff --git a/bacula/patches/2.0.3-ampm.patch b/bacula/patches/2.0.x/2.0.3-ampm.patch similarity index 100% rename from bacula/patches/2.0.3-ampm.patch rename to bacula/patches/2.0.x/2.0.3-ampm.patch diff --git a/bacula/patches/2.0.3-maxbyteslist.patch b/bacula/patches/2.0.x/2.0.3-maxbyteslist.patch similarity index 100% rename from bacula/patches/2.0.3-maxbyteslist.patch rename to bacula/patches/2.0.x/2.0.3-maxbyteslist.patch diff --git a/bacula/patches/2.0.3-maxwaittime.patch b/bacula/patches/2.0.x/2.0.3-maxwaittime.patch similarity index 100% rename from bacula/patches/2.0.3-maxwaittime.patch rename to bacula/patches/2.0.x/2.0.3-maxwaittime.patch diff --git a/bacula/patches/2.0.3-scheduler-next-hour.patch b/bacula/patches/2.0.x/2.0.3-scheduler-next-hour.patch similarity index 100% rename from bacula/patches/2.0.3-scheduler-next-hour.patch rename to bacula/patches/2.0.x/2.0.3-scheduler-next-hour.patch diff --git a/bacula/patches/2.0.3-tls-disconnect.patch b/bacula/patches/2.0.x/2.0.3-tls-disconnect.patch similarity index 100% rename from bacula/patches/2.0.3-tls-disconnect.patch rename to bacula/patches/2.0.x/2.0.3-tls-disconnect.patch diff --git a/bacula/patches/2.0.3-verify.patch b/bacula/patches/2.0.x/2.0.3-verify.patch similarity index 100% rename from bacula/patches/2.0.3-verify.patch rename to bacula/patches/2.0.x/2.0.3-verify.patch diff --git a/bacula/patches/2.2.0-restore.patch b/bacula/patches/2.2.0-restore.patch new file mode 100644 index 0000000000..4cccf12c8c --- /dev/null +++ b/bacula/patches/2.2.0-restore.patch @@ -0,0 +1,322 @@ +Index: fd_cmds.c +=================================================================== +--- fd_cmds.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508) ++++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -1,18 +1,4 @@ + /* +- * This file handles commands from the File daemon. +- * +- * Kern Sibbald, MM +- * +- * We get here because the Director has initiated a Job with +- * the Storage daemon, then done the same with the File daemon, +- * then when the Storage daemon receives a proper connection from +- * the File daemon, control is passed here to handle the +- * subsequent File daemon commands. +- * +- * Version $Id$ +- * +- */ +-/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. +@@ -39,6 +25,20 @@ + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. + */ ++/* ++ * This file handles commands from the File daemon. ++ * ++ * Kern Sibbald, MM ++ * ++ * We get here because the Director has initiated a Job with ++ * the Storage daemon, then done the same with the File daemon, ++ * then when the Storage daemon receives a proper connection from ++ * the File daemon, control is passed here to handle the ++ * subsequent File daemon commands. ++ * ++ * Version $Id$ ++ * ++ */ + + #include "bacula.h" + #include "stored.h" +@@ -120,7 +120,7 @@ + + dir->set_jcr(jcr); + Dmsg1(120, "Start run Job=%s\n", jcr->Job); +- bnet_fsend(dir, Job_start, jcr->Job); ++ dir->fsend(Job_start, jcr->Job); + jcr->start_time = time(NULL); + jcr->run_time = jcr->start_time; + set_jcr_job_status(jcr, JS_Running); +@@ -130,9 +130,9 @@ + dequeue_messages(jcr); /* send any queued messages */ + set_jcr_job_status(jcr, JS_Terminated); + generate_daemon_event(jcr, "JobEnd"); +- bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, ++ dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles, + edit_uint64(jcr->JobBytes, ec1)); +- bnet_sig(dir, BNET_EOD); /* send EOD to Director daemon */ ++ dir->signal(BNET_EOD); /* send EOD to Director daemon */ + return; + } + +@@ -150,7 +150,7 @@ + int stat; + + /* Read command coming from the File daemon */ +- stat = bnet_recv(fd); ++ stat = fd->recv(); + if (is_bnet_stop(fd)) { /* hardeof or error */ + break; /* connection terminated */ + } +@@ -171,11 +171,11 @@ + } + if (!found) { /* command not found */ + Dmsg1(110, "msg); +- bnet_fsend(fd, ferrmsg); ++ fd->fsend(ferrmsg); + break; + } + } +- bnet_sig(fd, BNET_TERMINATE); /* signal to FD job is done */ ++ fd->signal(BNET_TERMINATE); /* signal to FD job is done */ + } + + /* +@@ -195,10 +195,10 @@ + return true; + } else { + bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */ +- bnet_fsend(fd, ERROR_append); ++ fd->fsend(ERROR_append); + } + } else { +- bnet_fsend(fd, NOT_opened); ++ fd->fsend(NOT_opened); + } + return false; + } +@@ -209,11 +209,11 @@ + + Dmsg1(120, "storemsg); + if (!jcr->session_opened) { +- bnet_fsend(fd, NOT_opened); ++ fd->fsend(NOT_opened); + return false; + } + set_jcr_job_status(jcr, JS_Terminated); +- return bnet_fsend(fd, OK_end); ++ return fd->fsend(OK_end); + } + + +@@ -227,14 +227,14 @@ + + Dmsg1(120, "Append open session: %s", fd->msg); + if (jcr->session_opened) { +- bnet_fsend(fd, NO_open); ++ fd->fsend(NO_open); + return false; + } + + jcr->session_opened = true; + + /* Send "Ticket" to File Daemon */ +- bnet_fsend(fd, OK_open, jcr->VolSessionId); ++ fd->fsend(OK_open, jcr->VolSessionId); + Dmsg1(110, ">filed: %s", fd->msg); + + return true; +@@ -251,14 +251,14 @@ + + Dmsg1(120, "msg); + if (!jcr->session_opened) { +- bnet_fsend(fd, NOT_opened); ++ fd->fsend(NOT_opened); + return false; + } + /* Send final statistics to File daemon */ +- bnet_fsend(fd, OK_close, jcr->JobStatus); ++ fd->fsend(OK_close, jcr->JobStatus); + Dmsg1(120, ">filed: %s", fd->msg); + +- bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */ ++ fd->signal(BNET_EOD); /* send EOD to File daemon */ + + jcr->session_opened = false; + return true; +@@ -279,7 +279,7 @@ + Dmsg1(120, "msg); + return do_read_data(jcr); + } else { +- bnet_fsend(fd, NOT_opened); ++ fd->fsend(NOT_opened); + return false; + } + } +@@ -296,7 +296,7 @@ + + Dmsg1(120, "%s\n", fd->msg); + if (jcr->session_opened) { +- bnet_fsend(fd, NO_open); ++ fd->fsend(NO_open); + return false; + } + +@@ -304,7 +304,7 @@ + &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile, + &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) { + if (jcr->session_opened) { +- bnet_fsend(fd, NOT_opened); ++ fd->fsend(NOT_opened); + return false; + } + Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n", +@@ -319,7 +319,7 @@ + jcr->JobType = JT_RESTORE; + + /* Send "Ticket" to File Daemon */ +- bnet_fsend(fd, OK_open, jcr->VolSessionId); ++ fd->fsend(OK_open, jcr->VolSessionId); + Dmsg1(110, ">filed: %s", fd->msg); + + return true; +@@ -357,7 +357,7 @@ + goto bail_out; + } + Dmsg0(10, "=== Bootstrap file ===\n"); +- while (bnet_recv(sock) >= 0) { ++ while (sock->recv() >= 0) { + Dmsg1(10, "%s", sock->msg); + fputs(sock->msg, bs); + } +@@ -378,10 +378,10 @@ + free_pool_memory(jcr->RestoreBootstrap); + jcr->RestoreBootstrap = NULL; + if (!ok) { +- bnet_fsend(sock, ERROR_bootstrap); ++ sock->fsend(ERROR_bootstrap); + return false; + } +- return bnet_fsend(sock, OK_bootstrap); ++ return sock->fsend(OK_bootstrap); + } + + +@@ -395,14 +395,14 @@ + + Dmsg1(120, "Read close session: %s\n", fd->msg); + if (!jcr->session_opened) { +- bnet_fsend(fd, NOT_opened); ++ fd->fsend(NOT_opened); + return false; + } +- /* Send final statistics to File daemon */ +- bnet_fsend(fd, OK_close); ++ /* Send final close msg to File daemon */ ++ fd->fsend(OK_close, jcr->JobStatus); + Dmsg1(160, ">filed: %s\n", fd->msg); + +- bnet_sig(fd, BNET_EOD); /* send EOD to File daemon */ ++ fd->signal(BNET_EOD); /* send EOD to File daemon */ + + jcr->session_opened = false; + return true; +Index: stored_conf.c +=================================================================== +--- stored_conf.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508) ++++ stored_conf.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -75,7 +75,7 @@ + {"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0}, + {"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, 0, 0}, + {"scriptsdirectory", store_dir, ITEM(res_store.scripts_directory), 0, 0, 0}, +- {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 10}, ++ {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20}, + {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0}, + {"tlsenable", store_bit, ITEM(res_store.tls_enable), 1, 0, 0}, + {"tlsrequire", store_bit, ITEM(res_store.tls_require), 1, 0, 0}, +Index: bscan.c +=================================================================== +--- bscan.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508) ++++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -120,7 +120,7 @@ + " -m update media info in database\n" + " -n specify the database name (default bacula)\n" + " -u specify database user name (default bacula)\n" +-" -P specify database password (default none)\n" + " -h specify database host (default NULL)\n" + " -p proceed inspite of I/O errors\n" + " -r list records\n" +@@ -326,6 +326,7 @@ + mdcr->StartFile = dcr->StartFile; + mdcr->EndBlock = dcr->EndBlock; + mdcr->EndFile = dcr->EndFile; ++ mdcr->VolMediaId = dcr->VolMediaId; + mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex; + if (!create_jobmedia_record(db, mjcr)) { + Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"), +@@ -476,6 +477,7 @@ + dcr->VolFirstIndex = dcr->FileIndex = 0; + dcr->StartBlock = dcr->EndBlock = 0; + dcr->StartFile = dcr->EndFile = 0; ++ dcr->VolMediaId = 0; + } + + Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName); +@@ -1177,6 +1179,7 @@ + + dcr->EndBlock = dev->EndBlock; + dcr->EndFile = dev->EndFile; ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + + memset(&jmr, 0, sizeof(jmr)); + jmr.JobId = mjcr->JobId; +Index: askdir.c +=================================================================== +--- askdir.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508) ++++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -398,7 +398,7 @@ + dcr->StartFile, dcr->EndFile, + dcr->StartBlock, dcr->EndBlock, + dcr->Copy, dcr->Stripe, +- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1)); ++ edit_uint64(dcr->VolMediaId, ed1)); + Dmsg1(100, ">dird: %s", dir->msg); + if (bnet_recv(dir) <= 0) { + Dmsg0(190, "create_jobmedia error bnet_recv\n"); +Index: dev.h +=================================================================== +--- dev.h (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508) ++++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -447,6 +447,7 @@ + uint32_t StartFile; /* Start write file */ + uint32_t StartBlock; /* Start write block */ + uint32_t EndBlock; /* Ending block written */ ++ int64_t VolMediaId; /* MediaId */ + int64_t job_spool_size; /* Current job spool size */ + int64_t max_job_spool_size; /* Max job spool size */ + char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ +Index: block.c +=================================================================== +--- block.c (.../tags/Release-2.2.0/bacula/src/stored) (revision 5508) ++++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -611,6 +611,7 @@ + dev->block_num = dcr->EndBlock; + dev->file = dcr->EndFile; + } ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) { + dcr->VolFirstIndex = block->FirstIndex; + } +@@ -1098,6 +1099,7 @@ + dev->block_num = dcr->EndBlock; + dev->file = dcr->EndFile; + } ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + dev->file_addr += block->read_len; + dev->file_size += block->read_len; + diff --git a/bacula/patches/2.2.1-restore.patch b/bacula/patches/2.2.1-restore.patch new file mode 100644 index 0000000000..255058475c --- /dev/null +++ b/bacula/patches/2.2.1-restore.patch @@ -0,0 +1,117 @@ +Index: fd_cmds.c +=================================================================== +--- fd_cmds.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508) ++++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -1,18 +1,4 @@ + /* +- * This file handles commands from the File daemon. +- * +- * Kern Sibbald, MM +- * +- * We get here because the Director has initiated a Job with +- * the Storage daemon, then done the same with the File daemon, +- * then when the Storage daemon receives a proper connection from +- * the File daemon, control is passed here to handle the +- * subsequent File daemon commands. +- * +- * Version $Id$ +- * +- */ +-/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. +@@ -39,6 +25,20 @@ + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. + */ ++/* ++ * This file handles commands from the File daemon. ++ * ++ * Kern Sibbald, MM ++ * ++ * We get here because the Director has initiated a Job with ++ * the Storage daemon, then done the same with the File daemon, ++ * then when the Storage daemon receives a proper connection from ++ * the File daemon, control is passed here to handle the ++ * subsequent File daemon commands. ++ * ++ * Version $Id$ ++ * ++ */ + + #include "bacula.h" + #include "stored.h" +Index: bscan.c +=================================================================== +--- bscan.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508) ++++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -326,6 +326,7 @@ + mdcr->StartFile = dcr->StartFile; + mdcr->EndBlock = dcr->EndBlock; + mdcr->EndFile = dcr->EndFile; ++ mdcr->VolMediaId = dcr->VolMediaId; + mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex; + if (!create_jobmedia_record(db, mjcr)) { + Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"), +@@ -476,6 +477,7 @@ + dcr->VolFirstIndex = dcr->FileIndex = 0; + dcr->StartBlock = dcr->EndBlock = 0; + dcr->StartFile = dcr->EndFile = 0; ++ dcr->VolMediaId = 0; + } + + Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName); +@@ -1177,6 +1179,7 @@ + + dcr->EndBlock = dev->EndBlock; + dcr->EndFile = dev->EndFile; ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + + memset(&jmr, 0, sizeof(jmr)); + jmr.JobId = mjcr->JobId; +Index: askdir.c +=================================================================== +--- askdir.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508) ++++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -398,7 +398,7 @@ + dcr->StartFile, dcr->EndFile, + dcr->StartBlock, dcr->EndBlock, + dcr->Copy, dcr->Stripe, +- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1)); ++ edit_uint64(dcr->VolMediaId, ed1)); + Dmsg1(100, ">dird: %s", dir->msg); + if (bnet_recv(dir) <= 0) { + Dmsg0(190, "create_jobmedia error bnet_recv\n"); +Index: dev.h +=================================================================== +--- dev.h (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508) ++++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -447,6 +447,7 @@ + uint32_t StartFile; /* Start write file */ + uint32_t StartBlock; /* Start write block */ + uint32_t EndBlock; /* Ending block written */ ++ int64_t VolMediaId; /* MediaId */ + int64_t job_spool_size; /* Current job spool size */ + int64_t max_job_spool_size; /* Max job spool size */ + char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ +Index: block.c +=================================================================== +--- block.c (.../tags/Release-2.2.1/bacula/src/stored) (revision 5508) ++++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -611,6 +611,7 @@ + dev->block_num = dcr->EndBlock; + dev->file = dcr->EndFile; + } ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) { + dcr->VolFirstIndex = block->FirstIndex; + } +@@ -1098,6 +1099,7 @@ + dev->block_num = dcr->EndBlock; + dev->file = dcr->EndFile; + } ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + dev->file_addr += block->read_len; + dev->file_size += block->read_len; + diff --git a/bacula/patches/2.2.2-restore.patch b/bacula/patches/2.2.2-restore.patch new file mode 100644 index 0000000000..c061e4cf3c --- /dev/null +++ b/bacula/patches/2.2.2-restore.patch @@ -0,0 +1,117 @@ +Index: fd_cmds.c +=================================================================== +--- fd_cmds.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508) ++++ fd_cmds.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -1,18 +1,4 @@ + /* +- * This file handles commands from the File daemon. +- * +- * Kern Sibbald, MM +- * +- * We get here because the Director has initiated a Job with +- * the Storage daemon, then done the same with the File daemon, +- * then when the Storage daemon receives a proper connection from +- * the File daemon, control is passed here to handle the +- * subsequent File daemon commands. +- * +- * Version $Id$ +- * +- */ +-/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. +@@ -39,6 +25,20 @@ + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. + */ ++/* ++ * This file handles commands from the File daemon. ++ * ++ * Kern Sibbald, MM ++ * ++ * We get here because the Director has initiated a Job with ++ * the Storage daemon, then done the same with the File daemon, ++ * then when the Storage daemon receives a proper connection from ++ * the File daemon, control is passed here to handle the ++ * subsequent File daemon commands. ++ * ++ * Version $Id$ ++ * ++ */ + + #include "bacula.h" + #include "stored.h" +Index: bscan.c +=================================================================== +--- bscan.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508) ++++ bscan.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -326,6 +326,7 @@ + mdcr->StartFile = dcr->StartFile; + mdcr->EndBlock = dcr->EndBlock; + mdcr->EndFile = dcr->EndFile; ++ mdcr->VolMediaId = dcr->VolMediaId; + mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex; + if (!create_jobmedia_record(db, mjcr)) { + Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"), +@@ -476,6 +477,7 @@ + dcr->VolFirstIndex = dcr->FileIndex = 0; + dcr->StartBlock = dcr->EndBlock = 0; + dcr->StartFile = dcr->EndFile = 0; ++ dcr->VolMediaId = 0; + } + + Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName); +@@ -1177,6 +1179,7 @@ + + dcr->EndBlock = dev->EndBlock; + dcr->EndFile = dev->EndFile; ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + + memset(&jmr, 0, sizeof(jmr)); + jmr.JobId = mjcr->JobId; +Index: askdir.c +=================================================================== +--- askdir.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508) ++++ askdir.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -398,7 +398,7 @@ + dcr->StartFile, dcr->EndFile, + dcr->StartBlock, dcr->EndBlock, + dcr->Copy, dcr->Stripe, +- edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1)); ++ edit_uint64(dcr->VolMediaId, ed1)); + Dmsg1(100, ">dird: %s", dir->msg); + if (bnet_recv(dir) <= 0) { + Dmsg0(190, "create_jobmedia error bnet_recv\n"); +Index: dev.h +=================================================================== +--- dev.h (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508) ++++ dev.h (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -447,6 +447,7 @@ + uint32_t StartFile; /* Start write file */ + uint32_t StartBlock; /* Start write block */ + uint32_t EndBlock; /* Ending block written */ ++ int64_t VolMediaId; /* MediaId */ + int64_t job_spool_size; /* Current job spool size */ + int64_t max_job_spool_size; /* Max job spool size */ + char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ +Index: block.c +=================================================================== +--- block.c (.../tags/Release-2.2.2/bacula/src/stored) (revision 5508) ++++ block.c (.../branches/Branch-2.2/bacula/src/stored) (revision 5508) +@@ -611,6 +611,7 @@ + dev->block_num = dcr->EndBlock; + dev->file = dcr->EndFile; + } ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) { + dcr->VolFirstIndex = block->FirstIndex; + } +@@ -1098,6 +1099,7 @@ + dev->block_num = dcr->EndBlock; + dev->file = dcr->EndFile; + } ++ dcr->VolMediaId = dev->VolCatInfo.VolMediaId; + dev->file_addr += block->read_len; + dev->file_size += block->read_len; + diff --git a/bacula/patches/2.2.3-tls.patch b/bacula/patches/2.2.3-tls.patch new file mode 100644 index 0000000000..c65132e48a --- /dev/null +++ b/bacula/patches/2.2.3-tls.patch @@ -0,0 +1,43 @@ + + This patch was supplied by Landon Fuller and corrects a bug that + caused high CPU usage when connecting from bconsole to the Director. + This fixes bug #944. + + Apply this patch to version 2.2.3 (it should work with any 2.2.x + version with: + + cd + patch -p0 <2.2.3-tls.patch + ./configure (your options) + make + ... + make install + +Index: src/lib/tls.c +=================================================================== +--- src/lib/tls.c (revision 5507) ++++ src/lib/tls.c (working copy) +@@ -622,13 +622,21 @@ + break; + + case SSL_ERROR_WANT_READ: ++ /* If we timeout on a select, this will be unset */ ++ FD_SET((unsigned)bsock->m_fd, &fdset); ++ tv.tv_sec = 10; ++ tv.tv_usec = 0; ++ /* Block until we can read */ ++ select(fdmax, &fdset, NULL, NULL, &tv); ++ break; ++ + case SSL_ERROR_WANT_WRITE: + /* If we timeout on a select, this will be unset */ + FD_SET((unsigned)bsock->m_fd, &fdset); + tv.tv_sec = 10; + tv.tv_usec = 0; +- /* Block until we can read or write */ +- select(fdmax, NULL, &fdset, &fdset, &tv); ++ /* Block until we can write */ ++ select(fdmax, NULL, &fdset, NULL, &tv); + break; + + case SSL_ERROR_ZERO_RETURN: diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index b96674ebe1..1390c5c1eb 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,12 @@ Technical notes on version 2.3 General: +12Sep07 +kes Implement patch supplied by Landon to fix bug #944 where using + TLS with bconsole uses 99+% of the CPU. +kes Note, you need GTK >= 2.10 to be able to link the Tray Monitor + program. +kes Move patches into patches directory. 11Sep07 ebl Fix bug #946 about "bacula-dir -t" witch doesn't works as expected. -- 2.39.5