From: Kern Sibbald Date: Sat, 11 Apr 2009 12:35:04 +0000 (+0000) Subject: Modify insertion of read Volumes in SD to be done before the X-Git-Tag: Release-3.0.1~55 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=47404072ebc56fcdc68c6ea0efc7c9f5eedca6f2;p=bacula%2Fbacula Modify insertion of read Volumes in SD to be done before the drive reservation. This ensures that a Volume to be read will not be reserved for writing. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8713 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/Patchnotes b/bacula/Patchnotes new file mode 100644 index 0000000000..304387cdf7 --- /dev/null +++ b/bacula/Patchnotes @@ -0,0 +1,5 @@ + Patch notes for version 3.0 + + +Patches Committed: +3.0.0-read-vol-list.patch diff --git a/bacula/Patchnotes-2.5 b/bacula/Patchnotes-2.5 deleted file mode 100644 index 3c12a6fbe3..0000000000 --- a/bacula/Patchnotes-2.5 +++ /dev/null @@ -1,4 +0,0 @@ - Patch notes for version 3.0 - - -Patches Committed: diff --git a/bacula/patches/2.4.4-bat-install.patch b/bacula/patches/2.4.4-bat-install.patch deleted file mode 100644 index a3e95fa03c..0000000000 --- a/bacula/patches/2.4.4-bat-install.patch +++ /dev/null @@ -1,29 +0,0 @@ - - This patch fixes bat.pro.in so that bat will install correctly. - - Apply it to version 2.4.4 with: - - cd - patch -p0 <2.4.4-bat-install.patch - ./configure - make - ... - make install - - -Index: src/qt-console/bat.pro.in -=================================================================== ---- src/qt-console/bat.pro.in (revision 8326) -+++ src/qt-console/bat.pro.in (working copy) -@@ -9,9 +9,9 @@ - # - CONFIG += qt debug @QWT@ - --bins.path = /$(DESTDIR)@sbindir@ -+bins.path = $(DESTDIR)@sbindir@ - bins.files = ./bat --confs.path = /$(DESTDIR)@sysconfdir@ -+confs.path = $(DESTDIR)@sysconfdir@ - confs.commands = ./install_conf_file - - TEMPLATE = app diff --git a/bacula/patches/2.4.4-jobname-edit.patch b/bacula/patches/2.4.4-jobname-edit.patch deleted file mode 100644 index 240519f7aa..0000000000 --- a/bacula/patches/2.4.4-jobname-edit.patch +++ /dev/null @@ -1,26 +0,0 @@ - - This patch fixes bug #1255 'variable %n changed' - - Apply it to version 2.4.4 with: - - cd - patch -p0 <2.4.4-jobname-edit.patch - ./configure - make - ... - make install - - -Index: src/dird/job.c -=================================================================== ---- src/dird/job.c (revision 8455) -+++ src/dird/job.c (working copy) -@@ -787,7 +787,7 @@ - len = strlen(dt) + 5; /* dt + .%02d EOS */ - bstrncpy(name, base_name, sizeof(name)); - name[sizeof(name)-len] = 0; /* truncate if too long */ -- bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s.%02d", name, dt, seq); /* add date & time */ -+ bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s_%02d", name, dt, seq); /* add date & time */ - /* Convert spaces into underscores */ - for (p=jcr->Job; *p; p++) { - if (*p == ' ') { diff --git a/bacula/patches/2.4.4-label-failure.patch b/bacula/patches/2.4.4-label-failure.patch deleted file mode 100644 index 3dc115776a..0000000000 --- a/bacula/patches/2.4.4-label-failure.patch +++ /dev/null @@ -1,85 +0,0 @@ - [label-failure.patch] IQ - This patch should fix the problems labeling a tape while - Bacula is requesting you to mount or label a new tape. - It should also fix problems where Bacula will not recognize - that a new tape is inserted or created and it keeps asking for - a different tape. It fixes bug #1227. - - Apply it to 2.4.4 (possibly earlier versions) with: - - cd - patch -p0 <2.4.4-label-failure.patch - ./configure - make - ... - make install - ... - - - -Index: src/stored/wait.c -=================================================================== ---- src/stored/wait.c (revision 8605) -+++ src/stored/wait.c (working copy) -@@ -1,7 +1,7 @@ - /* - Bacula® - The Network Backup Solution - -- Copyright (C) 2000-2008 Free Software Foundation Europe e.V. -+ Copyright (C) 2000-2009 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. -@@ -20,7 +20,7 @@ - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -- Bacula® is a registered trademark of John Walker. -+ Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. -@@ -62,8 +62,14 @@ - - dev->dlock(); - Dmsg1(dbglvl, "Enter blocked=%s\n", dev->print_blocked()); -+ -+ /* -+ * Since we want to mount a tape, make sure current one is -+ * not marked as using this drive. -+ */ -+ volume_unused(dcr); -+ - unmounted = is_device_unmounted(dev); -- - dev->poll = false; - /* - * Wait requested time (dev->rem_wait_sec). However, we also wake up every -Index: src/stored/reserve.c -=================================================================== ---- src/stored/reserve.c (revision 8605) -+++ src/stored/reserve.c (working copy) -@@ -20,7 +20,7 @@ - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -- Bacula® is a registered trademark of John Walker. -+ Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. -@@ -346,8 +346,12 @@ - goto get_out; - } - Dmsg3(dbglvl, "jid=%u reserve_vol free vol=%s at %p\n", jid(), vol->vol_name, vol->vol_name); -- free_volume(dev); -- dev->set_unload(); /* have to unload current volume */ -+ /* If old Volume is still mounted, must unload it */ -+ if (strcmp(vol->vol_name, dev->VolHdr.VolumeName) == 0) { -+ Dmsg0(50, "set_unload\n"); -+ dev->set_unload(); /* have to unload current volume */ -+ } -+ free_volume(dev); /* Release old volume entry */ - debug_list_volumes("reserve_vol free"); - } - } diff --git a/bacula/patches/2.4.4-reload.patch b/bacula/patches/2.4.4-reload.patch deleted file mode 100644 index 367a0d6dad..0000000000 --- a/bacula/patches/2.4.4-reload.patch +++ /dev/null @@ -1,165 +0,0 @@ - - This patch fixes bug #1211 crash during reload with bad dird.conf file. - - Apply it to version 2.4.4 with: - - cd - patch -p0 <2.4.4-reload.patch - ./configure - make - ... - make install - - -Index: src/lib/parse_conf.c -=================================================================== ---- src/lib/parse_conf.c (revision 8393) -+++ src/lib/parse_conf.c (working copy) -@@ -284,6 +284,7 @@ - } - if (token != T_EQUALS) { - scan_err1(lc, _("expected an =, got: %s"), lc->str); -+ return; - } - break; - } -@@ -304,6 +305,7 @@ - Dmsg1(900, "store_msgs dest=%s:\n", NPRT(dest)); - if (token != T_EQUALS) { - scan_err1(lc, _("expected an =, got: %s"), lc->str); -+ return; - } - scan_types(lc, (MSGS *)(item->value), item->code, dest, NULL); - free_pool_memory(dest); -@@ -312,7 +314,7 @@ - - default: - scan_err1(lc, _("Unknown item code: %d\n"), item->code); -- break; -+ return; - } - } - scan_to_eol(lc); -@@ -352,7 +354,7 @@ - } - if (!found) { - scan_err1(lc, _("message type: %s not found"), str); -- /* NOT REACHED */ -+ return; - } - - if (msg_type == M_MAX+1) { /* all? */ -@@ -384,12 +386,14 @@ - lex_get_token(lc, T_NAME); - if (!is_name_valid(lc->str, &msg)) { - scan_err1(lc, "%s\n", msg); -+ return; - } - free_pool_memory(msg); - /* Store the name both pass 1 and pass 2 */ - if (*(item->value)) { - scan_err2(lc, _("Attempt to redefine name \"%s\" to \"%s\"."), - *(item->value), lc->str); -+ return; - } - *(item->value) = bstrdup(lc->str); - scan_to_eol(lc); -@@ -481,10 +485,12 @@ - if (res == NULL) { - scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"), - lc->str, lc->line_no, lc->line); -+ return; - } - if (*(item->value)) { - scan_err3(lc, _("Attempt to redefine resource \"%s\" referenced on line %d : %s\n"), - item->name, lc->line_no, lc->line); -+ return; - } - *(item->value) = (char *)res; - } -@@ -520,6 +526,7 @@ - if (i >= count) { - scan_err4(lc, _("Too many %s directives. Max. is %d. line %d: %s\n"), - lc->str, count, lc->line_no, lc->line); -+ return; - } - list = New(alist(10, not_owned_by_alist)); - } -@@ -530,6 +537,7 @@ - if (res == NULL) { - scan_err3(lc, _("Could not find config Resource \"%s\" referenced on line %d : %s\n"), - item->name, lc->line_no, lc->line); -+ return; - } - Dmsg5(900, "Append %p to alist %p size=%d i=%d %s\n", - res, list, list->size(), i, item->name); -@@ -592,6 +600,7 @@ - if (res == NULL) { - scan_err3(lc, _("Missing config Resource \"%s\" referenced on line %d : %s\n"), - lc->str, lc->line_no, lc->line); -+ return; - } - } - scan_to_eol(lc); -@@ -655,12 +664,13 @@ - } - if (!size_to_uint64(bsize, strlen(bsize), &uvalue)) { - scan_err1(lc, _("expected a size number, got: %s"), lc->str); -+ return; - } - *(uint64_t *)(item->value) = uvalue; - break; - default: - scan_err1(lc, _("expected a size, got: %s"), lc->str); -- break; -+ return; - } - if (token != T_EOL) { - scan_to_eol(lc); -@@ -697,12 +707,13 @@ - } - if (!duration_to_utime(period, &utime)) { - scan_err1(lc, _("expected a time period, got: %s"), period); -+ return; - } - *(utime_t *)(item->value) = utime; - break; - default: - scan_err1(lc, _("expected a time period, got: %s"), lc->str); -- break; -+ return; - } - if (token != T_EOL) { - scan_to_eol(lc); -@@ -721,6 +732,7 @@ - *(uint32_t *)(item->value) &= ~(item->code); - } else { - scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */ -+ return; - } - scan_to_eol(lc); - set_bit(index, res_all.hdr.item_present); -@@ -736,6 +748,7 @@ - *(bool *)(item->value) = false; - } else { - scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */ -+ return; - } - scan_to_eol(lc); - set_bit(index, res_all.hdr.item_present); -@@ -761,6 +774,7 @@ - } - if (i != 0) { - scan_err1(lc, _("Expected a Tape Label keyword, got: %s"), lc->str); -+ return; - } - scan_to_eol(lc); - set_bit(index, res_all.hdr.item_present); -@@ -910,6 +924,7 @@ - Dmsg0(900, "T_EOB => define new resource\n"); - if (res_all.hdr.name == NULL) { - scan_err0(lc, _("Name not specified for resource")); -+ return 0; - } - save_resource(res_type, items, pass); /* save resource */ - break; diff --git a/bacula/patches/2.4.4-sd-deadlock.patch b/bacula/patches/2.4.4-sd-deadlock.patch deleted file mode 100644 index ed60e6874b..0000000000 --- a/bacula/patches/2.4.4-sd-deadlock.patch +++ /dev/null @@ -1,67 +0,0 @@ - - This patch is backported from the development SVN and should fix - bug #1213, which is a deadlock in the SD when a volume is on the - wrong drive. - - Apply it to version 2.4.4 with: - - cd - patch -p0 <2.4.4-sd-deadlock.patch - ./configure - make - ... - make install - - -Index: src/stored/reserve.c -=================================================================== ---- src/stored/reserve.c (revision 8426) -+++ src/stored/reserve.c (working copy) -@@ -1,7 +1,7 @@ - /* - Bacula® - The Network Backup Solution - -- Copyright (C) 2000-2008 Free Software Foundation Europe e.V. -+ Copyright (C) 2000-2009 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. -@@ -498,7 +498,6 @@ - void DCR::unreserve_device() - { - lock_volumes(); -- dev->dlock(); - if (is_reserved()) { - clear_reserved(); - reserved_volume = false; -@@ -514,7 +513,6 @@ - volume_unused(this); - } - } -- dev->dunlock(); - unlock_volumes(); - } - -Index: src/stored/acquire.c -=================================================================== ---- src/stored/acquire.c (revision 8426) -+++ src/stored/acquire.c (working copy) -@@ -1,7 +1,7 @@ - /* - Bacula® - The Network Backup Solution - -- Copyright (C) 2002-2008 Free Software Foundation Europe e.V. -+ Copyright (C) 2002-2009 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. -@@ -647,8 +647,8 @@ - - /* Detach this dcr only if attached */ - if (dcr->attached_to_dev && dev) { -+ dev->dlock(); - dcr->unreserve_device(); -- dev->dlock(); - dcr->dev->attached_dcrs->remove(dcr); /* detach dcr from device */ - dcr->attached_to_dev = false; - // remove_dcr_from_dcrs(dcr); /* remove dcr from jcr list */ diff --git a/bacula/patches/2.4.4-time_t_64bit.patch b/bacula/patches/2.4.4-time_t_64bit.patch deleted file mode 100644 index 46dd440a11..0000000000 --- a/bacula/patches/2.4.4-time_t_64bit.patch +++ /dev/null @@ -1,55 +0,0 @@ - - This patch fixes bug #1247 - 64-bit time_t and varargs don't get along in some - printf-like formatting - - Apply it to version 2.4.4 with: - - cd - patch -p0 <2.4.4-time_t_64bit.patch - ./configure - make - ... - make install - - -Index: src/stored/spool.c -=================================================================== ---- src/stored/spool.c (revision 8455) -+++ src/stored/spool.c (working copy) -@@ -306,7 +306,7 @@ - set_new_file_parameters(dcr); - - /* Subtracting run_time give us elapsed time - wait_time since we started despooling */ -- time_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; -+ int32_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; - - if (despool_elapsed <= 0) { - despool_elapsed = 1; -Index: src/stored/append.c -=================================================================== ---- src/stored/append.c (revision 8455) -+++ src/stored/append.c (working copy) -@@ -270,7 +270,7 @@ - do_fd_commands(jcr); /* finish dialog with FD */ - - -- time_t job_elapsed = time(NULL) - jcr->run_time; -+ int32_t job_elapsed = time(NULL) - jcr->run_time; - - if (job_elapsed <= 0) { - job_elapsed = 1; -Index: src/lib/message.c -=================================================================== ---- src/lib/message.c (revision 8455) -+++ src/lib/message.c (working copy) -@@ -780,8 +780,8 @@ - case MD_DIRECTOR: - Dmsg1(850, "DIRECTOR for following msg: %s", msg); - if (jcr && jcr->dir_bsock && !jcr->dir_bsock->errors) { -- bnet_fsend(jcr->dir_bsock, "Jmsg Job=%s type=%d level=%d %s", -- jcr->Job, type, mtime, msg); -+ bnet_fsend(jcr->dir_bsock, "Jmsg Job=%s type=%d level=%lld %s", -+ jcr->Job, type, (utime_t)mtime, msg); - } - break; - case MD_STDOUT: diff --git a/bacula/patches/2.4.4-tray-sizing.patch b/bacula/patches/2.4.4-tray-sizing.patch deleted file mode 100644 index abeffb7343..0000000000 --- a/bacula/patches/2.4.4-tray-sizing.patch +++ /dev/null @@ -1,59 +0,0 @@ - - This patch fixes a text sizing problem in the tray-monitor. - It fixes bug #1219. - - Apply it to version 2.4.4 with: - - cd - patch -p0 <2.4.4-tray-sizing.patch - ./configure - make - ... - make install - - -Index: src/tray-monitor/tray-monitor.c -=================================================================== ---- src/tray-monitor/tray-monitor.c (revision 8393) -+++ src/tray-monitor/tray-monitor.c (working copy) -@@ -1,7 +1,7 @@ - /* - Bacula® - The Network Backup Solution - -- Copyright (C) 2004-2007 Free Software Foundation Europe e.V. -+ Copyright (C) 2004-2009 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. -@@ -97,6 +97,7 @@ - static GtkWidget *textview; - static GtkTextBuffer *buffer; - static GtkWidget *timeoutspinner; -+static GtkWidget *scrolledWindow; - char** xpm_generic_var; - static gboolean blinkstate = TRUE; - -@@ -409,9 +410,13 @@ - } - - gtk_box_pack_start(GTK_BOX(vbox), daemon_table, FALSE, FALSE, 0); -- -+ - textview = gtk_text_view_new(); - -+ scrolledWindow = gtk_scrolled_window_new(NULL, NULL); -+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); -+ gtk_container_add(GTK_CONTAINER (scrolledWindow), textview); -+ - buffer = gtk_text_buffer_new(NULL); - - gtk_text_buffer_set_text(buffer, "", -1); -@@ -456,7 +461,7 @@ - - gtk_text_view_set_buffer(GTK_TEXT_VIEW(textview), buffer); - -- gtk_box_pack_start(GTK_BOX(vbox), textview, TRUE, TRUE, 0); -+ gtk_box_pack_start(GTK_BOX(vbox), scrolledWindow, TRUE, TRUE, 0); - - GtkWidget* hbox = gtk_hbox_new(FALSE, 10); - diff --git a/bacula/patches/2.4.x/2.4.4-bat-install.patch b/bacula/patches/2.4.x/2.4.4-bat-install.patch new file mode 100644 index 0000000000..a3e95fa03c --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-bat-install.patch @@ -0,0 +1,29 @@ + + This patch fixes bat.pro.in so that bat will install correctly. + + Apply it to version 2.4.4 with: + + cd + patch -p0 <2.4.4-bat-install.patch + ./configure + make + ... + make install + + +Index: src/qt-console/bat.pro.in +=================================================================== +--- src/qt-console/bat.pro.in (revision 8326) ++++ src/qt-console/bat.pro.in (working copy) +@@ -9,9 +9,9 @@ + # + CONFIG += qt debug @QWT@ + +-bins.path = /$(DESTDIR)@sbindir@ ++bins.path = $(DESTDIR)@sbindir@ + bins.files = ./bat +-confs.path = /$(DESTDIR)@sysconfdir@ ++confs.path = $(DESTDIR)@sysconfdir@ + confs.commands = ./install_conf_file + + TEMPLATE = app diff --git a/bacula/patches/2.4.x/2.4.4-jobname-edit.patch b/bacula/patches/2.4.x/2.4.4-jobname-edit.patch new file mode 100644 index 0000000000..240519f7aa --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-jobname-edit.patch @@ -0,0 +1,26 @@ + + This patch fixes bug #1255 'variable %n changed' + + Apply it to version 2.4.4 with: + + cd + patch -p0 <2.4.4-jobname-edit.patch + ./configure + make + ... + make install + + +Index: src/dird/job.c +=================================================================== +--- src/dird/job.c (revision 8455) ++++ src/dird/job.c (working copy) +@@ -787,7 +787,7 @@ + len = strlen(dt) + 5; /* dt + .%02d EOS */ + bstrncpy(name, base_name, sizeof(name)); + name[sizeof(name)-len] = 0; /* truncate if too long */ +- bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s.%02d", name, dt, seq); /* add date & time */ ++ bsnprintf(jcr->Job, sizeof(jcr->Job), "%s.%s_%02d", name, dt, seq); /* add date & time */ + /* Convert spaces into underscores */ + for (p=jcr->Job; *p; p++) { + if (*p == ' ') { diff --git a/bacula/patches/2.4.x/2.4.4-label-failure.patch b/bacula/patches/2.4.x/2.4.4-label-failure.patch new file mode 100644 index 0000000000..3dc115776a --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-label-failure.patch @@ -0,0 +1,85 @@ + [label-failure.patch] IQ + This patch should fix the problems labeling a tape while + Bacula is requesting you to mount or label a new tape. + It should also fix problems where Bacula will not recognize + that a new tape is inserted or created and it keeps asking for + a different tape. It fixes bug #1227. + + Apply it to 2.4.4 (possibly earlier versions) with: + + cd + patch -p0 <2.4.4-label-failure.patch + ./configure + make + ... + make install + ... + + + +Index: src/stored/wait.c +=================================================================== +--- src/stored/wait.c (revision 8605) ++++ src/stored/wait.c (working copy) +@@ -1,7 +1,7 @@ + /* + Bacula® - The Network Backup Solution + +- Copyright (C) 2000-2008 Free Software Foundation Europe e.V. ++ Copyright (C) 2000-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. +@@ -20,7 +20,7 @@ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + +- Bacula® is a registered trademark of John Walker. ++ Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +@@ -62,8 +62,14 @@ + + dev->dlock(); + Dmsg1(dbglvl, "Enter blocked=%s\n", dev->print_blocked()); ++ ++ /* ++ * Since we want to mount a tape, make sure current one is ++ * not marked as using this drive. ++ */ ++ volume_unused(dcr); ++ + unmounted = is_device_unmounted(dev); +- + dev->poll = false; + /* + * Wait requested time (dev->rem_wait_sec). However, we also wake up every +Index: src/stored/reserve.c +=================================================================== +--- src/stored/reserve.c (revision 8605) ++++ src/stored/reserve.c (working copy) +@@ -20,7 +20,7 @@ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + +- Bacula® is a registered trademark of John Walker. ++ Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +@@ -346,8 +346,12 @@ + goto get_out; + } + Dmsg3(dbglvl, "jid=%u reserve_vol free vol=%s at %p\n", jid(), vol->vol_name, vol->vol_name); +- free_volume(dev); +- dev->set_unload(); /* have to unload current volume */ ++ /* If old Volume is still mounted, must unload it */ ++ if (strcmp(vol->vol_name, dev->VolHdr.VolumeName) == 0) { ++ Dmsg0(50, "set_unload\n"); ++ dev->set_unload(); /* have to unload current volume */ ++ } ++ free_volume(dev); /* Release old volume entry */ + debug_list_volumes("reserve_vol free"); + } + } diff --git a/bacula/patches/2.4.x/2.4.4-reload.patch b/bacula/patches/2.4.x/2.4.4-reload.patch new file mode 100644 index 0000000000..367a0d6dad --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-reload.patch @@ -0,0 +1,165 @@ + + This patch fixes bug #1211 crash during reload with bad dird.conf file. + + Apply it to version 2.4.4 with: + + cd + patch -p0 <2.4.4-reload.patch + ./configure + make + ... + make install + + +Index: src/lib/parse_conf.c +=================================================================== +--- src/lib/parse_conf.c (revision 8393) ++++ src/lib/parse_conf.c (working copy) +@@ -284,6 +284,7 @@ + } + if (token != T_EQUALS) { + scan_err1(lc, _("expected an =, got: %s"), lc->str); ++ return; + } + break; + } +@@ -304,6 +305,7 @@ + Dmsg1(900, "store_msgs dest=%s:\n", NPRT(dest)); + if (token != T_EQUALS) { + scan_err1(lc, _("expected an =, got: %s"), lc->str); ++ return; + } + scan_types(lc, (MSGS *)(item->value), item->code, dest, NULL); + free_pool_memory(dest); +@@ -312,7 +314,7 @@ + + default: + scan_err1(lc, _("Unknown item code: %d\n"), item->code); +- break; ++ return; + } + } + scan_to_eol(lc); +@@ -352,7 +354,7 @@ + } + if (!found) { + scan_err1(lc, _("message type: %s not found"), str); +- /* NOT REACHED */ ++ return; + } + + if (msg_type == M_MAX+1) { /* all? */ +@@ -384,12 +386,14 @@ + lex_get_token(lc, T_NAME); + if (!is_name_valid(lc->str, &msg)) { + scan_err1(lc, "%s\n", msg); ++ return; + } + free_pool_memory(msg); + /* Store the name both pass 1 and pass 2 */ + if (*(item->value)) { + scan_err2(lc, _("Attempt to redefine name \"%s\" to \"%s\"."), + *(item->value), lc->str); ++ return; + } + *(item->value) = bstrdup(lc->str); + scan_to_eol(lc); +@@ -481,10 +485,12 @@ + if (res == NULL) { + scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"), + lc->str, lc->line_no, lc->line); ++ return; + } + if (*(item->value)) { + scan_err3(lc, _("Attempt to redefine resource \"%s\" referenced on line %d : %s\n"), + item->name, lc->line_no, lc->line); ++ return; + } + *(item->value) = (char *)res; + } +@@ -520,6 +526,7 @@ + if (i >= count) { + scan_err4(lc, _("Too many %s directives. Max. is %d. line %d: %s\n"), + lc->str, count, lc->line_no, lc->line); ++ return; + } + list = New(alist(10, not_owned_by_alist)); + } +@@ -530,6 +537,7 @@ + if (res == NULL) { + scan_err3(lc, _("Could not find config Resource \"%s\" referenced on line %d : %s\n"), + item->name, lc->line_no, lc->line); ++ return; + } + Dmsg5(900, "Append %p to alist %p size=%d i=%d %s\n", + res, list, list->size(), i, item->name); +@@ -592,6 +600,7 @@ + if (res == NULL) { + scan_err3(lc, _("Missing config Resource \"%s\" referenced on line %d : %s\n"), + lc->str, lc->line_no, lc->line); ++ return; + } + } + scan_to_eol(lc); +@@ -655,12 +664,13 @@ + } + if (!size_to_uint64(bsize, strlen(bsize), &uvalue)) { + scan_err1(lc, _("expected a size number, got: %s"), lc->str); ++ return; + } + *(uint64_t *)(item->value) = uvalue; + break; + default: + scan_err1(lc, _("expected a size, got: %s"), lc->str); +- break; ++ return; + } + if (token != T_EOL) { + scan_to_eol(lc); +@@ -697,12 +707,13 @@ + } + if (!duration_to_utime(period, &utime)) { + scan_err1(lc, _("expected a time period, got: %s"), period); ++ return; + } + *(utime_t *)(item->value) = utime; + break; + default: + scan_err1(lc, _("expected a time period, got: %s"), lc->str); +- break; ++ return; + } + if (token != T_EOL) { + scan_to_eol(lc); +@@ -721,6 +732,7 @@ + *(uint32_t *)(item->value) &= ~(item->code); + } else { + scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */ ++ return; + } + scan_to_eol(lc); + set_bit(index, res_all.hdr.item_present); +@@ -736,6 +748,7 @@ + *(bool *)(item->value) = false; + } else { + scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */ ++ return; + } + scan_to_eol(lc); + set_bit(index, res_all.hdr.item_present); +@@ -761,6 +774,7 @@ + } + if (i != 0) { + scan_err1(lc, _("Expected a Tape Label keyword, got: %s"), lc->str); ++ return; + } + scan_to_eol(lc); + set_bit(index, res_all.hdr.item_present); +@@ -910,6 +924,7 @@ + Dmsg0(900, "T_EOB => define new resource\n"); + if (res_all.hdr.name == NULL) { + scan_err0(lc, _("Name not specified for resource")); ++ return 0; + } + save_resource(res_type, items, pass); /* save resource */ + break; diff --git a/bacula/patches/2.4.x/2.4.4-sd-deadlock.patch b/bacula/patches/2.4.x/2.4.4-sd-deadlock.patch new file mode 100644 index 0000000000..ed60e6874b --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-sd-deadlock.patch @@ -0,0 +1,67 @@ + + This patch is backported from the development SVN and should fix + bug #1213, which is a deadlock in the SD when a volume is on the + wrong drive. + + Apply it to version 2.4.4 with: + + cd + patch -p0 <2.4.4-sd-deadlock.patch + ./configure + make + ... + make install + + +Index: src/stored/reserve.c +=================================================================== +--- src/stored/reserve.c (revision 8426) ++++ src/stored/reserve.c (working copy) +@@ -1,7 +1,7 @@ + /* + Bacula® - The Network Backup Solution + +- Copyright (C) 2000-2008 Free Software Foundation Europe e.V. ++ Copyright (C) 2000-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. +@@ -498,7 +498,6 @@ + void DCR::unreserve_device() + { + lock_volumes(); +- dev->dlock(); + if (is_reserved()) { + clear_reserved(); + reserved_volume = false; +@@ -514,7 +513,6 @@ + volume_unused(this); + } + } +- dev->dunlock(); + unlock_volumes(); + } + +Index: src/stored/acquire.c +=================================================================== +--- src/stored/acquire.c (revision 8426) ++++ src/stored/acquire.c (working copy) +@@ -1,7 +1,7 @@ + /* + Bacula® - The Network Backup Solution + +- Copyright (C) 2002-2008 Free Software Foundation Europe e.V. ++ Copyright (C) 2002-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. +@@ -647,8 +647,8 @@ + + /* Detach this dcr only if attached */ + if (dcr->attached_to_dev && dev) { ++ dev->dlock(); + dcr->unreserve_device(); +- dev->dlock(); + dcr->dev->attached_dcrs->remove(dcr); /* detach dcr from device */ + dcr->attached_to_dev = false; + // remove_dcr_from_dcrs(dcr); /* remove dcr from jcr list */ diff --git a/bacula/patches/2.4.x/2.4.4-time_t_64bit.patch b/bacula/patches/2.4.x/2.4.4-time_t_64bit.patch new file mode 100644 index 0000000000..46dd440a11 --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-time_t_64bit.patch @@ -0,0 +1,55 @@ + + This patch fixes bug #1247 - 64-bit time_t and varargs don't get along in some + printf-like formatting + + Apply it to version 2.4.4 with: + + cd + patch -p0 <2.4.4-time_t_64bit.patch + ./configure + make + ... + make install + + +Index: src/stored/spool.c +=================================================================== +--- src/stored/spool.c (revision 8455) ++++ src/stored/spool.c (working copy) +@@ -306,7 +306,7 @@ + set_new_file_parameters(dcr); + + /* Subtracting run_time give us elapsed time - wait_time since we started despooling */ +- time_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; ++ int32_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; + + if (despool_elapsed <= 0) { + despool_elapsed = 1; +Index: src/stored/append.c +=================================================================== +--- src/stored/append.c (revision 8455) ++++ src/stored/append.c (working copy) +@@ -270,7 +270,7 @@ + do_fd_commands(jcr); /* finish dialog with FD */ + + +- time_t job_elapsed = time(NULL) - jcr->run_time; ++ int32_t job_elapsed = time(NULL) - jcr->run_time; + + if (job_elapsed <= 0) { + job_elapsed = 1; +Index: src/lib/message.c +=================================================================== +--- src/lib/message.c (revision 8455) ++++ src/lib/message.c (working copy) +@@ -780,8 +780,8 @@ + case MD_DIRECTOR: + Dmsg1(850, "DIRECTOR for following msg: %s", msg); + if (jcr && jcr->dir_bsock && !jcr->dir_bsock->errors) { +- bnet_fsend(jcr->dir_bsock, "Jmsg Job=%s type=%d level=%d %s", +- jcr->Job, type, mtime, msg); ++ bnet_fsend(jcr->dir_bsock, "Jmsg Job=%s type=%d level=%lld %s", ++ jcr->Job, type, (utime_t)mtime, msg); + } + break; + case MD_STDOUT: diff --git a/bacula/patches/2.4.x/2.4.4-tray-sizing.patch b/bacula/patches/2.4.x/2.4.4-tray-sizing.patch new file mode 100644 index 0000000000..abeffb7343 --- /dev/null +++ b/bacula/patches/2.4.x/2.4.4-tray-sizing.patch @@ -0,0 +1,59 @@ + + This patch fixes a text sizing problem in the tray-monitor. + It fixes bug #1219. + + Apply it to version 2.4.4 with: + + cd + patch -p0 <2.4.4-tray-sizing.patch + ./configure + make + ... + make install + + +Index: src/tray-monitor/tray-monitor.c +=================================================================== +--- src/tray-monitor/tray-monitor.c (revision 8393) ++++ src/tray-monitor/tray-monitor.c (working copy) +@@ -1,7 +1,7 @@ + /* + Bacula® - The Network Backup Solution + +- Copyright (C) 2004-2007 Free Software Foundation Europe e.V. ++ Copyright (C) 2004-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. +@@ -97,6 +97,7 @@ + static GtkWidget *textview; + static GtkTextBuffer *buffer; + static GtkWidget *timeoutspinner; ++static GtkWidget *scrolledWindow; + char** xpm_generic_var; + static gboolean blinkstate = TRUE; + +@@ -409,9 +410,13 @@ + } + + gtk_box_pack_start(GTK_BOX(vbox), daemon_table, FALSE, FALSE, 0); +- ++ + textview = gtk_text_view_new(); + ++ scrolledWindow = gtk_scrolled_window_new(NULL, NULL); ++ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); ++ gtk_container_add(GTK_CONTAINER (scrolledWindow), textview); ++ + buffer = gtk_text_buffer_new(NULL); + + gtk_text_buffer_set_text(buffer, "", -1); +@@ -456,7 +461,7 @@ + + gtk_text_view_set_buffer(GTK_TEXT_VIEW(textview), buffer); + +- gtk_box_pack_start(GTK_BOX(vbox), textview, TRUE, TRUE, 0); ++ gtk_box_pack_start(GTK_BOX(vbox), scrolledWindow, TRUE, TRUE, 0); + + GtkWidget* hbox = gtk_hbox_new(FALSE, 10); + diff --git a/bacula/patches/3.0.0-read-vol-list.patch b/bacula/patches/3.0.0-read-vol-list.patch new file mode 100644 index 0000000000..de1cfea600 --- /dev/null +++ b/bacula/patches/3.0.0-read-vol-list.patch @@ -0,0 +1,282 @@ + + This patch can be applied to version 3.0.0. It ensures that the list + of volumes to be read is created very early when starting the Job in + the SD (before the drive reservation) so that any Volume to be read + cannot also be chosen to append. + + Apply it to version 3.0.0 with: + + cd + patch -p0 <3.0.0-read-vol-list.patch + ./configure + make + ... + make install + + + +Index: src/dird/msgchan.c +=================================================================== +--- src/dird/msgchan.c (revision 8699) ++++ src/dird/msgchan.c (working copy) +@@ -144,10 +144,12 @@ + } + #endif + ++static char OKbootstrap[] = "3000 OK bootstrap\n"; ++ + /* + * Start a job with the Storage daemon + */ +-bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) ++bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_bsr) + { + bool ok = true; + STORE *storage; +@@ -196,7 +198,7 @@ + &jcr->VolSessionTime, &auth_key) != 3) { + Dmsg1(100, "BadJob=%s\n", sd->msg); + Jmsg(jcr, M_FATAL, 0, _("Storage daemon rejected Job command: %s\n"), sd->msg); +- return 0; ++ return false; + } else { + jcr->sd_auth_key = bstrdup(auth_key); + Dmsg1(150, "sd_auth_key=%s\n", jcr->sd_auth_key); +@@ -204,9 +206,14 @@ + } else { + Jmsg(jcr, M_FATAL, 0, _("bstrerror()); +- return 0; ++ return false; + } + ++ if (send_bsr && (!send_bootstrap_file(jcr, sd) || ++ !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR))) { ++ return false; ++ } ++ + /* + * We have two loops here. The first comes from the + * Storage = associated with the Job, and we need +Index: src/dird/migrate.c +=================================================================== +--- src/dird/migrate.c (revision 8699) ++++ src/dird/migrate.c (working copy) +@@ -55,7 +55,6 @@ + + static const int dbglevel = 10; + +-static char OKbootstrap[] = "3000 OK bootstrap\n"; + static int get_job_to_migrate(JCR *jcr); + struct idpkt; + static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, +@@ -353,15 +352,11 @@ + ((STORE *)jcr->rstorage->first())->name()); + return false; + } +- if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage)) { ++ if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage, /*send_bsr*/true)) { + return false; + } + Dmsg0(150, "Storage daemon connection OK\n"); + +- if (!send_bootstrap_file(jcr, sd) || +- !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) { +- return false; +- } + + /* + * We re-update the job start record so that the start +Index: src/dird/protos.h +=================================================================== +--- src/dird/protos.h (revision 8699) ++++ src/dird/protos.h (working copy) +@@ -155,7 +155,8 @@ + /* msgchan.c */ + extern bool connect_to_storage_daemon(JCR *jcr, int retry_interval, + int max_retry_time, int verbose); +-extern bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore); ++extern bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, ++ bool send_bsr=false); + extern bool start_storage_daemon_message_thread(JCR *jcr); + extern int bget_dirmsg(BSOCK *bs); + extern void wait_for_storage_daemon_termination(JCR *jcr); +Index: src/dird/vbackup.c +=================================================================== +--- src/dird/vbackup.c (revision 8699) ++++ src/dird/vbackup.c (working copy) +@@ -50,8 +50,6 @@ + + static const int dbglevel = 10; + +-static char OKbootstrap[] = "3000 OK bootstrap\n"; +- + static bool create_bootstrap_file(JCR *jcr, POOLMEM *jobids); + void vbackup_cleanup(JCR *jcr, int TermCode); + +@@ -217,16 +215,11 @@ + /* + * Now start a job with the Storage daemon + */ +- if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage)) { ++ if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage, /*send_bsr*/true)) { + return false; + } + Dmsg0(100, "Storage daemon connection OK\n"); + +- if (!send_bootstrap_file(jcr, sd) || +- !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) { +- return false; +- } +- + /* + * We re-update the job start record so that the start + * time is set after the run before job. This avoids +Index: src/stored/fd_cmds.c +=================================================================== +--- src/stored/fd_cmds.c (revision 8699) ++++ src/stored/fd_cmds.c (working copy) +@@ -388,6 +388,8 @@ + if (debug_level >= 10) { + dump_bsr(jcr->bsr, true); + } ++ /* If we got a bootstrap, we are reading, so create read volume list */ ++ create_restore_volume_list(jcr); + ok = true; + + bail_out: +Index: src/stored/read.c +=================================================================== +--- src/stored/read.c (revision 8699) ++++ src/stored/read.c (working copy) +@@ -1,7 +1,7 @@ + /* + Bacula® - The Network Backup Solution + +- Copyright (C) 2000-2008 Free Software Foundation Europe e.V. ++ Copyright (C) 2000-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. +@@ -62,11 +62,8 @@ + return false; + } + +- +- create_restore_volume_list(jcr); + if (jcr->NumReadVolumes == 0) { + Jmsg(jcr, M_FATAL, 0, _("No Volume names found for restore.\n")); +- free_restore_volume_list(jcr); + fd->fsend(FD_error); + return false; + } +@@ -76,7 +73,6 @@ + + /* Ready device for reading */ + if (!acquire_device_for_read(dcr)) { +- free_restore_volume_list(jcr); + fd->fsend(FD_error); + return false; + } +@@ -92,7 +88,6 @@ + ok = false; + } + +- free_restore_volume_list(jcr); + Dmsg0(30, "Done reading.\n"); + return ok; + } +Index: src/stored/parse_bsr.c +=================================================================== +--- src/stored/parse_bsr.c (revision 8699) ++++ src/stored/parse_bsr.c (working copy) +@@ -1,7 +1,7 @@ + /* + Bacula® - The Network Backup Solution + +- Copyright (C) 2002-2008 Free Software Foundation Europe e.V. ++ Copyright (C) 2002-2009 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. +Index: src/stored/mac.c +=================================================================== +--- src/stored/mac.c (revision 8699) ++++ src/stored/mac.c (working copy) +@@ -84,8 +84,6 @@ + } + Dmsg2(100, "read_dcr=%p write_dcr=%p\n", jcr->read_dcr, jcr->dcr); + +- +- create_restore_volume_list(jcr); + if (jcr->NumReadVolumes == 0) { + Jmsg(jcr, M_FATAL, 0, _("No Volume names found for %s.\n"), Type); + goto bail_out; +@@ -161,11 +159,8 @@ + } + } + +- free_restore_volume_list(jcr); +- + dir_send_job_status(jcr); /* update director */ + +- + Dmsg0(30, "Done reading.\n"); + jcr->end_time = time(NULL); + dequeue_messages(jcr); /* send any queued messages */ +Index: src/stored/vol_mgr.c +=================================================================== +--- src/stored/vol_mgr.c (revision 8699) ++++ src/stored/vol_mgr.c (working copy) +@@ -529,6 +529,7 @@ + VOLRES vol, *fvol; + + if (read_vol_list->empty()) { ++ Dmsg0(dbglvl, "find_read_vol: read_vol_list empty.\n"); + return NULL; + } + /* Do not lock reservations here */ +Index: src/stored/job.c +=================================================================== +--- src/stored/job.c (revision 8699) ++++ src/stored/job.c (working copy) +@@ -371,6 +371,8 @@ + free_bsr(jcr->bsr); + jcr->bsr = NULL; + } ++ /* Free any restore volume list created */ ++ free_restore_volume_list(jcr); + if (jcr->RestoreBootstrap) { + unlink(jcr->RestoreBootstrap); + free_pool_memory(jcr->RestoreBootstrap); +Index: src/stored/acquire.c +=================================================================== +--- src/stored/acquire.c (revision 8699) ++++ src/stored/acquire.c (working copy) +@@ -187,7 +187,7 @@ + if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_READ)) { + Dmsg2(150, "dir_get_vol_info failed for vol=%s: %s\n", + dcr->VolumeName, jcr->errmsg); +- Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg); ++ Jmsg1(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg); + } + dev->set_load(); /* set to load volume */ + +@@ -241,7 +241,7 @@ + * error messages when nothing is mounted. + */ + if (tape_previously_mounted) { +- Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg); ++ Jmsg(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg); + } + goto default_path; + case VOL_NAME_ERROR: +@@ -257,7 +257,7 @@ + dev->set_load(); + /* Fall through */ + default: +- Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg); ++ Jmsg1(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg); + default_path: + Dmsg0(50, "default path\n"); + tape_previously_mounted = true; diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index fc49cb74ef..4521cf02aa 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -55,7 +55,6 @@ static const int dbglevel = 10; -static char OKbootstrap[] = "3000 OK bootstrap\n"; static int get_job_to_migrate(JCR *jcr); struct idpkt; static bool regex_find_jobids(JCR *jcr, idpkt *ids, const char *query1, @@ -353,15 +352,11 @@ bool do_migration(JCR *jcr) ((STORE *)jcr->rstorage->first())->name()); return false; } - if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage)) { + if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage, /*send_bsr*/true)) { return false; } Dmsg0(150, "Storage daemon connection OK\n"); - if (!send_bootstrap_file(jcr, sd) || - !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) { - return false; - } /* * We re-update the job start record so that the start diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index f9cc3a2113..1955ccc093 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -144,10 +144,12 @@ bool update_device_res(JCR *jcr, DEVICE *dev) } #endif +static char OKbootstrap[] = "3000 OK bootstrap\n"; + /* * Start a job with the Storage daemon */ -bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) +bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, bool send_bsr) { bool ok = true; STORE *storage; @@ -196,7 +198,7 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) &jcr->VolSessionTime, &auth_key) != 3) { Dmsg1(100, "BadJob=%s\n", sd->msg); Jmsg(jcr, M_FATAL, 0, _("Storage daemon rejected Job command: %s\n"), sd->msg); - return 0; + return false; } else { jcr->sd_auth_key = bstrdup(auth_key); Dmsg1(150, "sd_auth_key=%s\n", jcr->sd_auth_key); @@ -204,7 +206,12 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore) } else { Jmsg(jcr, M_FATAL, 0, _("bstrerror()); - return 0; + return false; + } + + if (send_bsr && (!send_bootstrap_file(jcr, sd) || + !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR))) { + return false; } /* diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index 26e5d71944..dc66f8d3c5 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -155,7 +155,8 @@ extern void mount_request(JCR *jcr, BSOCK *bs, char *buf); /* msgchan.c */ extern bool connect_to_storage_daemon(JCR *jcr, int retry_interval, int max_retry_time, int verbose); -extern bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore); +extern bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore, + bool send_bsr=false); extern bool start_storage_daemon_message_thread(JCR *jcr); extern int bget_dirmsg(BSOCK *bs); extern void wait_for_storage_daemon_termination(JCR *jcr); diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 9ae9c65d06..45a1f7e065 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -50,8 +50,6 @@ static const int dbglevel = 10; -static char OKbootstrap[] = "3000 OK bootstrap\n"; - static bool create_bootstrap_file(JCR *jcr, POOLMEM *jobids); void vbackup_cleanup(JCR *jcr, int TermCode); @@ -217,16 +215,11 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n") /* * Now start a job with the Storage daemon */ - if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage)) { + if (!start_storage_daemon_job(jcr, jcr->rstorage, jcr->wstorage, /*send_bsr*/true)) { return false; } Dmsg0(100, "Storage daemon connection OK\n"); - if (!send_bootstrap_file(jcr, sd) || - !response(jcr, sd, OKbootstrap, "Bootstrap", DISPLAY_ERROR)) { - return false; - } - /* * We re-update the job start record so that the start * time is set after the run before job. This avoids diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 06c280efd8..50e767b611 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -187,7 +187,7 @@ bool acquire_device_for_read(DCR *dcr) if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_READ)) { Dmsg2(150, "dir_get_vol_info failed for vol=%s: %s\n", dcr->VolumeName, jcr->errmsg); - Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg); + Jmsg1(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg); } dev->set_load(); /* set to load volume */ @@ -241,7 +241,7 @@ bool acquire_device_for_read(DCR *dcr) * error messages when nothing is mounted. */ if (tape_previously_mounted) { - Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg); + Jmsg(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg); } goto default_path; case VOL_NAME_ERROR: @@ -257,7 +257,7 @@ bool acquire_device_for_read(DCR *dcr) dev->set_load(); /* Fall through */ default: - Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg); + Jmsg1(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg); default_path: Dmsg0(50, "default path\n"); tape_previously_mounted = true; diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 993bf1a872..88223497b6 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -388,6 +388,8 @@ bool get_bootstrap_file(JCR *jcr, BSOCK *sock) if (debug_level >= 10) { dump_bsr(jcr->bsr, true); } + /* If we got a bootstrap, we are reading, so create read volume list */ + create_restore_volume_list(jcr); ok = true; bail_out: diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 8b5add3f58..de9b2bb50c 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -371,6 +371,8 @@ void stored_free_jcr(JCR *jcr) free_bsr(jcr->bsr); jcr->bsr = NULL; } + /* Free any restore volume list created */ + free_restore_volume_list(jcr); if (jcr->RestoreBootstrap) { unlink(jcr->RestoreBootstrap); free_pool_memory(jcr->RestoreBootstrap); diff --git a/bacula/src/stored/mac.c b/bacula/src/stored/mac.c index b7768a811f..ce2c370797 100644 --- a/bacula/src/stored/mac.c +++ b/bacula/src/stored/mac.c @@ -84,8 +84,6 @@ bool do_mac(JCR *jcr) } Dmsg2(100, "read_dcr=%p write_dcr=%p\n", jcr->read_dcr, jcr->dcr); - - create_restore_volume_list(jcr); if (jcr->NumReadVolumes == 0) { Jmsg(jcr, M_FATAL, 0, _("No Volume names found for %s.\n"), Type); goto bail_out; @@ -161,11 +159,8 @@ ok_out: } } - free_restore_volume_list(jcr); - dir_send_job_status(jcr); /* update director */ - Dmsg0(30, "Done reading.\n"); jcr->end_time = time(NULL); dequeue_messages(jcr); /* send any queued messages */ diff --git a/bacula/src/stored/parse_bsr.c b/bacula/src/stored/parse_bsr.c index 3798435217..f5e0108de2 100644 --- a/bacula/src/stored/parse_bsr.c +++ b/bacula/src/stored/parse_bsr.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2008 Free Software Foundation Europe e.V. + Copyright (C) 2002-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/stored/read.c b/bacula/src/stored/read.c index aa0ae70567..7d50550902 100644 --- a/bacula/src/stored/read.c +++ b/bacula/src/stored/read.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -62,11 +62,8 @@ bool do_read_data(JCR *jcr) return false; } - - create_restore_volume_list(jcr); if (jcr->NumReadVolumes == 0) { Jmsg(jcr, M_FATAL, 0, _("No Volume names found for restore.\n")); - free_restore_volume_list(jcr); fd->fsend(FD_error); return false; } @@ -76,7 +73,6 @@ bool do_read_data(JCR *jcr) /* Ready device for reading */ if (!acquire_device_for_read(dcr)) { - free_restore_volume_list(jcr); fd->fsend(FD_error); return false; } @@ -92,7 +88,6 @@ bool do_read_data(JCR *jcr) ok = false; } - free_restore_volume_list(jcr); Dmsg0(30, "Done reading.\n"); return ok; } diff --git a/bacula/src/stored/vol_mgr.c b/bacula/src/stored/vol_mgr.c index 54b00b8148..4e239fcd7c 100644 --- a/bacula/src/stored/vol_mgr.c +++ b/bacula/src/stored/vol_mgr.c @@ -529,6 +529,7 @@ static VOLRES *find_read_volume(const char *VolumeName) VOLRES vol, *fvol; if (read_vol_list->empty()) { + Dmsg0(dbglvl, "find_read_vol: read_vol_list empty.\n"); return NULL; } /* Do not lock reservations here */ diff --git a/bacula/src/version.h b/bacula/src/version.h index 451395303d..d73cbb05b4 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "3.0.0" -#define BDATE "06 April 2009" -#define LSMDATE "06Apr09" +#define BDATE "11 April 2009" +#define LSMDATE "11Apr09" #define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n" #define BYEAR "2009" /* year for copyright messages in progs */ diff --git a/bacula/technotes b/bacula/technotes index 6ee0b779f6..c6a118c0ce 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,12 @@ General: +11Apr09 +kes Modify insertion of read Volumes in SD to be done before the + drive reservation. This ensures that a Volume to be read will not + be reserved for writing. + +Release Version 3.0.0 06Apr09 kes Change default plugins dir to /usr/lib. 05Apr09