From 580cd012d8edbb560930a3c4de8f9214bd3c6c28 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 24 May 2008 09:31:05 +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/branches/Branch-2.2@7014 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 | 4 ++-- bacula/technotes-2.1 | 3 +++ 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 28caffb453..0dc882c631 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -186,7 +186,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); @@ -337,6 +337,7 @@ bool unload_autochanger(DCR *dcr, int loaded) /* Virtual disk autochanger */ if (dcr->device->changer_command[0] == 0) { + dev->clear_unload(); return true; } @@ -370,12 +371,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; } @@ -480,8 +481,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..58464b696e 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 99de0a72f8..90d65af51a 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -189,17 +189,6 @@ void debug_list_volumes(const char *imsg) Dmsg2(dbglvl, "jid=%u %s", jid(), 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(); } @@ -360,6 +349,7 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) } Dmsg3(dbglvl, "jid=%u reserve_vol free vol=%s at %p\n", jid(), 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"); } @@ -400,8 +390,10 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) Dmsg4(dbglvl, "==== jid=%u Swap vol=%s from dev=%s to %s\n", jid(), 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 */ @@ -602,7 +594,7 @@ bool free_volume(DEVICE *dev) if (!vol->is_swapping()) { dev->vol = NULL; vol_list->remove(vol); - Dmsg3(dbglvl, "jid=%u === free_volume %s dev=%s\n", jid(), vol->vol_name, dev->print_name()); + Dmsg3(dbglvl, "jid=%u === remove volume %s dev=%s\n", jid(), 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 8a7426aeb2..32f188bdec 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.2.10-b4" -#define BDATE "21 May 2008" -#define LSMDATE "21May08" +#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.1 b/bacula/technotes-2.1 index 89826094ab..c9304d218d 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,9 @@ 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.2