From 11c72789412b8ac698ac670b1f238f958f2d9db7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 5 Jul 2008 05:52:04 +0000 Subject: [PATCH] Do find_a_volume() each time an unload is done. This fixes the failure of maxvol2-test. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7309 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/label.c | 4 ++++ bacula/src/stored/mount.c | 16 +++++++++++----- bacula/technotes-2.4 | 4 ++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index e2b9f548ea..1c2d008360 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -324,6 +324,10 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, Dmsg0(150, "write_volume_label()\n"); empty_block(dcr->block); + if (*VolName == 0) { + Pmsg0(0, "=== ERROR: write_new_volume_label_to_dev called with NULL VolName\n"); + goto bail_out; + } if (relabel) { volume_unused(dcr); /* mark current volume unused */ diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index b6f0f02e6f..5cd93cf4dd 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -69,6 +69,7 @@ bool DCR::mount_next_write_volume() { int retry = 0; bool ask = false, recycle, autochanger; + bool do_find = true; int mode; DCR *dcr = this; @@ -104,12 +105,17 @@ mount_next_vol: } recycle = false; + if (retry >= 2) { + do_find = false; + } + if (dev->must_unload()) { ask = true; /* ask operator to mount tape */ + do_find = true; /* re-find a volume after unload */ } do_swapping(true /*writing*/); - if (retry < 2 && !find_a_volume()) { + if (do_find && !find_a_volume()) { goto no_lock_bail_out; } @@ -366,7 +372,7 @@ int DCR::check_volume_label(bool &ask, bool &autochanger) VOLUME_CAT_INFO dcrVolCatInfo, devVolCatInfo; char saveVolumeName[MAX_NAME_LENGTH]; - Dmsg1(150, "Vol NAME Error Name=%s\n", VolumeName); + Dmsg2(150, "Vol NAME Error Have=%s, want=%s\n", dev->VolHdr.VolumeName, VolumeName); if (dev->is_volume_to_unload()) { ask = true; goto check_next_volume; @@ -486,7 +492,6 @@ check_read_volume: bool DCR::is_suitable_volume_mounted() { - /* Volume mounted? */ if (dev->VolHdr.VolumeName[0] == 0 || dev->swap_dev || dev->must_unload()) { return false; /* no */ @@ -624,7 +629,8 @@ int DCR::try_autolabel(bool opened) /* Create a new Volume label and write it to the device */ if (!write_new_volume_label_to_dev(dcr, VolumeName, pool_name, false, /* no relabel */ false /* defer DVD label */)) { - Dmsg0(150, "!write_vol_label\n"); + Dmsg2(150, "write_vol_label failed. vol=%s, pool=%s\n", + VolumeName, pool_name); if (opened) { mark_volume_in_error(); } @@ -697,7 +703,7 @@ void DCR::release_volume() if (WroteVol) { Jmsg0(jcr, M_ERROR, 0, _("Hey!!!!! WroteVol non-zero !!!!!\n")); - Dmsg0(190, "Hey!!!!! WroteVol non-zero !!!!!\n"); + Pmsg0(190, "Hey!!!!! WroteVol non-zero !!!!!\n"); } /* * First erase all memory of the current volume diff --git a/bacula/technotes-2.4 b/bacula/technotes-2.4 index 5484897ca0..c1a82ac365 100644 --- a/bacula/technotes-2.4 +++ b/bacula/technotes-2.4 @@ -2,6 +2,10 @@ General: +05Jul08 +kes Do find_a_volume() each time an unload is done. This + fixes the failure of maxvol2-test. + Release Beta version 2.4.1-b2 04Jul08 kes Use Qmsg() in job.c watchdog callback. -- 2.39.5