From: Kern Sibbald Date: Sun, 23 Aug 2009 07:58:19 +0000 (+0200) Subject: Add SD Volume debug code X-Git-Tag: Release-5.0.0~332^2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3f5298cda4f6b74cdfc646b7726b6425f56a2d6d;p=bacula%2Fbacula Add SD Volume debug code --- diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 765c4ac528..3cec6dd19d 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -427,8 +427,8 @@ static bool unload_other_drive(DCR *dcr, int slot) break; } if (dev->is_busy()) { - Jmsg(dcr->jcr, M_WARNING, 0, _("Volume \"%s\" is in use by device %s\n"), - dcr->VolumeName, dev->print_name()); + Jmsg(dcr->jcr, M_WARNING, 0, _("Volume \"%s\" wanted on %s is in use by device %s\n"), + dcr->VolumeName, dcr->dev->print_name(), dev->print_name()); Dmsg4(100, "Vol %s for dev=%s is busy dev=%s slot=%d\n", dcr->VolumeName, dcr->dev->print_name(), dev->print_name(), dev->get_slot()); Dmsg2(100, "num_writ=%d reserv=%d\n", dev->num_writers, dev->num_reserved()); diff --git a/bacula/src/stored/vol_mgr.c b/bacula/src/stored/vol_mgr.c index 0d6b088912..55b7001e8b 100644 --- a/bacula/src/stored/vol_mgr.c +++ b/bacula/src/stored/vol_mgr.c @@ -416,6 +416,10 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) nvol->dev = NULL; /* don't zap dev entry */ free_vol_item(nvol); + if (vol->dev) { + Dmsg2(dbglvl, "dev=%s vol->dev=%s\n", dev->print_name(), vol->dev->print_name()); + } + /* * Check if we are trying to use the Volume on a different drive * dev is our device @@ -442,8 +446,15 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) vol->dev = dev; /* point the Volume at our drive */ dev->vol = vol; /* point our drive at the Volume */ } else { - Dmsg3(dbglvl, "==== Swap not possible Vol busy vol=%s from dev=%s to %s\n", + Dmsg5(dbglvl, "==== Swap not possible Vol busy=%d swap=%d vol=%s from dev=%s to %s\n", + vol->dev->is_busy(), vol->is_swapping(), VolumeName, vol->dev->print_name(), dev->print_name()); + if (vol->is_swapping() && dev->swap_dev) { + Dmsg2(dbglvl, "Swap vol=%s dev=%s\n", vol->vol_name, dev->swap_dev->print_name()); + } else { + Dmsg1(dbglvl, "swap_dev=%p\n", dev->swap_dev); + } + debug_list_volumes("failed swap"); vol = NULL; /* device busy */ goto get_out; } @@ -610,12 +621,14 @@ bool free_volume(DEVICE *dev) vol = dev->vol; /* Don't free a volume while it is being swapped */ if (!vol->is_swapping()) { - Dmsg1(dbglvl, "=== clear in_use vol=%s\n", dev->vol->vol_name); + Dmsg1(dbglvl, "=== clear in_use vol=%s\n", vol->vol_name); dev->vol = NULL; vol_list->remove(vol); Dmsg2(dbglvl, "=== remove volume %s dev=%s\n", vol->vol_name, dev->print_name()); free_vol_item(vol); debug_list_volumes("free_volume"); + } else { + Dmsg1(dbglvl, "=== cannot clear swapping vol=%s\n", vol->vol_name); } unlock_volumes(); return true;