--- /dev/null
+ [label-failure.patch] IQ
+ This patch should fix the problems labeling a tape while
+ Bacula is requesting you to mount or label a new tape.
+ It should also fix problems where Bacula will not recognize
+ that a new tape is inserted or created and it keeps asking for
+ a different tape. It fixes bug #1227.
+
+ Apply it to 2.4.4 (possibly earlier versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.4-label-failure.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+ ...
+
+
+
+Index: src/stored/wait.c
+===================================================================
+--- src/stored/wait.c (revision 8605)
++++ src/stored/wait.c (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
++ Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+@@ -20,7 +20,7 @@
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+- Bacula® is a registered trademark of John Walker.
++ Bacula® is a registered trademark of Kern Sibbald.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+@@ -62,8 +62,14 @@
+
+ dev->dlock();
+ Dmsg1(dbglvl, "Enter blocked=%s\n", dev->print_blocked());
++
++ /*
++ * Since we want to mount a tape, make sure current one is
++ * not marked as using this drive.
++ */
++ volume_unused(dcr);
++
+ unmounted = is_device_unmounted(dev);
+-
+ dev->poll = false;
+ /*
+ * Wait requested time (dev->rem_wait_sec). However, we also wake up every
+Index: src/stored/reserve.c
+===================================================================
+--- src/stored/reserve.c (revision 8605)
++++ src/stored/reserve.c (working copy)
+@@ -20,7 +20,7 @@
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+- Bacula® is a registered trademark of John Walker.
++ Bacula® is a registered trademark of Kern Sibbald.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+@@ -346,8 +346,12 @@
+ goto get_out;
+ }
+ Dmsg3(dbglvl, "jid=%u reserve_vol free vol=%s at %p\n", jid(), vol->vol_name, vol->vol_name);
+- free_volume(dev);
+- dev->set_unload(); /* have to unload current volume */
++ /* If old Volume is still mounted, must unload it */
++ if (strcmp(vol->vol_name, dev->VolHdr.VolumeName) == 0) {
++ Dmsg0(50, "set_unload\n");
++ dev->set_unload(); /* have to unload current volume */
++ }
++ free_volume(dev); /* Release old volume entry */
+ debug_list_volumes("reserve_vol free");
+ }
+ }