From 9e8ab3486b345d8b2828c9065b005cbef4067334 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 12 Apr 2007 16:19:42 +0000 Subject: [PATCH] kes Locking debug level tweaks in SD. kes Tweak new Volume code. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4542 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/bat.conf.in | 10 ++++++++++ bacula/src/stored/reserve.c | 17 ++++++++++++++--- bacula/technotes-2.1 | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 bacula/src/qt-console/bat.conf.in diff --git a/bacula/src/qt-console/bat.conf.in b/bacula/src/qt-console/bat.conf.in new file mode 100644 index 0000000000..fcce04e3d4 --- /dev/null +++ b/bacula/src/qt-console/bat.conf.in @@ -0,0 +1,10 @@ +# +# Bacula Administration Tool (bat) configuration file +# + +Director { + Name = @hostname@-dir + DIRport = @dir_port@ + address = @hostname@ + Password = "@dir_password@" +} diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index bc590e210a..793f2a0b2b 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -202,6 +202,9 @@ static VOLRES *new_vol_item(DCR *dcr, const char *VolumeName) static void free_vol_item(VOLRES *vol) { free(vol->vol_name); + if (vol->dev) { + vol->dev->vol = NULL; + } free(vol); } @@ -316,16 +319,24 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) */ Dmsg3(100, "reserve_vol free-tmp vol=%s at %p JobId=%u\n", vol->vol_name, vol->vol_name, (int)dcr->jcr->JobId); + /* + * Clear dev pointer so that free_vol_item() doesn't + * take away our volume. + */ + nvol->dev = NULL; /* don't zap dev entry */ free_vol_item(nvol); /* Check if we are trying to use the Volume on a different drive */ if (dev != vol->dev) { /* Caller wants to switch Volume to another device */ - if (!dev->is_busy()) { - /* OK to move it */ + if (!vol->dev->is_busy()) { + /* OK to move it -- I'm not sure this will work */ Dmsg3(100, "Swap vol=%s from dev=%s to %s\n", VolumeName, dev->print_name(), dev->print_name()); - vol->dev = dev; + vol->dev->vol = NULL; /* take vol from old drive */ + vol->dev->VolHdr.VolumeName[0] = 0; + vol->dev = dev; /* point vol at new drive */ + dev->vol = vol; /* point dev at vol */ dev->VolHdr.VolumeName[0] = 0; } else { vol = NULL; /* device busy */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 37c7bd8dd8..2172a3a94b 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -3,6 +3,7 @@ General: 12Apr07 kes Locking debug level tweaks in SD. +kes Tweak new Volume code. 11Apr07 kes Add exec external-command [wait-seconds] to bconsole. This executes the external-command. Note! normally external-command -- 2.39.5