From 8885bd30b2e7a847ee984be56ad8ef263fab3e3e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 24 May 2008 09:31:52 +0000 Subject: [PATCH] kes Enhance a couple of SD debug messages. kes Tweak unload flag setting and ensure it is set during swap. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7015 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/autochanger.c | 7 ++++--- bacula/src/stored/dircmd.c | 1 - bacula/src/stored/mount.c | 3 ++- bacula/src/stored/reserve.c | 18 +++++------------- bacula/src/version.h | 6 +++--- bacula/technotes-2.3 | 3 +++ 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 97c0e1fbc4..e798d9fa68 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -187,7 +187,7 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir) * Load the desired cassette */ lock_changer(dcr); - Dmsg1(100, "Doing changer load slot %d\n", slot); + Dmsg2(100, "Doing changer load slot %d %s\n", slot, dev->print_name()); Jmsg(jcr, M_INFO, 0, _("3304 Issuing autochanger \"load slot %d, drive %d\" command.\n"), slot, drive); @@ -338,6 +338,7 @@ bool unload_autochanger(DCR *dcr, int loaded) /* Virtual disk autochanger */ if (dcr->device->changer_command[0] == 0) { + dev->clear_unload(); return true; } @@ -371,12 +372,12 @@ bool unload_autochanger(DCR *dcr, int loaded) } else { dev->Slot = 0; /* nothing loaded */ } - dev->clear_unload(); unlock_changer(dcr); free_volume(dev); /* Free any volume associated with this drive */ free_pool_memory(changer); } + dev->clear_unload(); return ok; } @@ -481,8 +482,8 @@ bool unload_dev(DCR *dcr, DEVICE *dev) ok = false; dev->Slot = -1; /* unknown */ } else { + Dmsg2(100, "Slot %d unloaded %s\n", dev->Slot, dev->print_name()); dev->Slot = 0; /* nothing loaded */ - Dmsg0(100, "Slot unloaded\n"); } dev->clear_unload(); unlock_changer(dcr); diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 9387a4ac29..5891d6d0ec 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -917,7 +917,6 @@ static bool release_cmd(JCR *jcr) send_dir_busy_message(dir, dev); } else { /* device not being used */ Dmsg0(90, "Device not in use, releasing\n"); - unload_autochanger(dcr, -1); dcr->release_volume(); dir->fsend(_("3022 Device %s released.\n"), dev->print_name()); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 2f292de209..48a050b875 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -474,7 +474,6 @@ void DCR::do_swapping(bool is_writing) { if (dev->must_unload()) { Dmsg1(100, "swapping: unloading %s\n", dev->print_name()); - unload_autochanger(this, -1); release_volume(); dev->clear_unload(); } @@ -670,6 +669,8 @@ void DCR::mark_volume_not_inchanger() */ void DCR::release_volume() { + unload_autochanger(this, -1); + if (WroteVol) { Jmsg0(jcr, M_ERROR, 0, _("Hey!!!!! WroteVol non-zero !!!!!\n")); Dmsg0(190, "Hey!!!!! WroteVol non-zero !!!!!\n"); diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index b9ad674d2f..f3118d861d 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -187,17 +187,6 @@ void debug_list_volumes(const char *imsg) Dmsg1(dbglvl, "%s", msg.c_str()); } -#ifdef xxx - DEVICE *dev = NULL; - foreach_dlist(vol, vol_list) { - if (vol->dev == dev) { - Dmsg0(dbglvl, "Two Volumes on same device.\n"); - ASSERT(0); - dev = vol->dev; - } - } -#endif - unlock_volumes(); } @@ -358,6 +347,7 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) } Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name); free_volume(dev); +// volume_unused(dcr); dev->set_unload(); /* have to unload current volume */ debug_list_volumes("reserve_vol free"); } @@ -398,8 +388,10 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n", VolumeName, vol->dev->print_name(), dev->print_name()); free_volume(dev); /* free any volume attached to our drive */ +// volume_unused(dcr); + dev->set_unload(); /* Unload any volume that is on our drive */ dcr->dev = vol->dev; /* temp point to other dev */ - slot = get_autochanger_loaded_slot(dcr); /* get slot */ + slot = get_autochanger_loaded_slot(dcr); /* get slot on other drive */ dcr->dev = dev; /* restore dev */ vol->set_slot(slot); /* save slot */ vol->dev->set_unload(); /* unload the other drive */ @@ -600,7 +592,7 @@ bool free_volume(DEVICE *dev) if (!vol->is_swapping()) { dev->vol = NULL; vol_list->remove(vol); - Dmsg2(dbglvl, "=== free_volume %s dev=%s\n", vol->vol_name, dev->print_name()); + Dmsg2(dbglvl, "=== remove volume %s dev=%s\n", vol->vol_name, dev->print_name()); free_vol_item(vol); debug_list_volumes("free_volume"); } diff --git a/bacula/src/version.h b/bacula/src/version.h index 9f4b0157ed..fd666a695d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.3.21" -#define BDATE "21 May 2008" -#define LSMDATE "21May08" +#define VERSION "2.3.22" +#define BDATE "24 May 2008" +#define LSMDATE "24May08" #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 fdf992b50d..a6edbba14f 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -24,6 +24,9 @@ Add long term statistics job table General: +24May08 +kes Enhance a couple of SD debug messages. +kes Tweak unload flag setting and ensure it is set during swap. 23May08 ebl Fix #1091 about bad output in estimate command. 21May08 -- 2.39.5