From: Kern Sibbald Date: Fri, 14 Mar 2008 17:14:57 +0000 (+0000) Subject: add reserved_volume flag in DCR to make maxvol2 test work X-Git-Tag: Release-7.0.0~4830 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e30e8d456f354e1110970e4dc2bc271db8c051c2;p=bacula%2Fbacula add reserved_volume flag in DCR to make maxvol2 test work git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6612 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 0a4d5a0c5e..24842f4f5a 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -70,6 +70,9 @@ Professional Needs: and http://www.openeyet.nl/scc/ for managing customer changes Priority: +- Re-check new dcr->reserved_volume +- Softlinks that point to non-existent file are not restored in restore all, + but are restored if the file is individually selected. BUG! - Doc Duplicate Jobs. - New directive "Delete purged Volumes" - Prune by Job diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 656044e323..2e21e16f22 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -437,6 +437,7 @@ public: bool WroteVol; /* set if Volume written */ bool NewFile; /* set when EOF written */ bool reserved_device; /* set if reserve done */ + bool reserved_volume; /* set if we reserved a volume */ bool any_volume; /* Any OK for dir_find_next... */ bool attached_to_dev; /* set when attached to dev */ bool volume_in_use; /* set in dir_find_next_appendable_volume() */ diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 7289fc3641..9afe9bd7d0 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -337,12 +337,14 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) * is not being used and is marked as released. */ if (strcmp(vol->vol_name, VolumeName) == 0) { - Dmsg1(dbglvl, "=== OK, vol=%s on device. set not released.\n", VolumeName); + Dmsg2(dbglvl, "=== set not released vol=%s dev=%s\n", VolumeName, + vol->dev->print_name()); vol->released = false; /* retake vol if released previously */ + dcr->reserved_volume = true; /* reserved volume */ goto get_out; /* Volume already on this device */ } else { /* Don't release a volume if it is in use */ - if (!vol->released) { + if (!vol->released && !dcr->reserved_volume) { Dmsg1(dbglvl, "Cannot free vol=%s. It is not released.\n", vol->vol_name); vol = NULL; /* vol in use */ goto get_out; @@ -408,8 +410,10 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) get_out: if (vol) { - Dmsg1(dbglvl, "=== set not released. vol=%s\n", vol->vol_name); + Dmsg2(dbglvl, "=== set not released. vol=%s dev=%s\n", vol->vol_name, + vol->dev->print_name()); vol->released = false; + dcr->reserved_volume = true; } debug_list_volumes("end new volume"); unlock_volumes(); @@ -475,9 +479,9 @@ void unreserve_device(DCR *dcr) DEVICE *dev = dcr->dev; if (dcr->reserved_device) { dcr->reserved_device = false; + dcr->reserved_volume = false; dev->reserved_device--; Dmsg2(dbglvl, "Dec reserve=%d dev=%s\n", dev->reserved_device, dev->print_name()); - dcr->reserved_device = false; /* If we set read mode in reserving, remove it */ if (dev->can_read()) { dev->clear_read(); @@ -534,6 +538,8 @@ bool volume_unused(DCR *dcr) Dmsg3(dbglvl, "=== mark released vol=%s num_writers=%d dev_reserved=%d\n", dev->vol->vol_name, dev->num_writers, dev->reserved_device); dev->vol->released = true; + Dmsg2(dbglvl, "=== set released. Vol=%s dev=%s\n", dev->vol->vol_name, + dev->print_name()); if (dev->is_tape()) { // || dev->is_autochanger()) { return true; } else { diff --git a/bacula/src/version.h b/bacula/src/version.h index 06b1344af7..759288cd91 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.12" -#define BDATE "13 March 2008" -#define LSMDATE "13Mar08" +#define BDATE "14 March 2008" +#define LSMDATE "14Mar08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index e3e4af05a4..632a8537de 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,12 @@ Technical notes on version 2.3 General: +14Mar08 +kes Add dcr->reserved_volume flag that allows us to release a volume + even if it is not vol->released. This allows maxvol2 to work when + Volumes expire and we are already writing to the device (i.e. a + volume is pulled out from under us by another job terminating after + we reserve the drive). 13Mar08 ebl Permit multiple command/console per runscript definition. RunScript { command = /bin/true ; command = /bin/false ... }