]> git.sur5r.net Git - bacula/bacula/commitdiff
Do find_a_volume() each time an unload is done. This
authorKern Sibbald <kern@sibbald.com>
Sat, 5 Jul 2008 05:52:04 +0000 (05:52 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 5 Jul 2008 05:52:04 +0000 (05:52 +0000)
     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
bacula/src/stored/mount.c
bacula/technotes-2.4

index e2b9f548ea89dde27a87343277a87dd14dd1dd3b..1c2d0083604423c769c346f4993fc77b4b45fc69 100644 (file)
@@ -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 */
index b6f0f02e6f0fb51c52528fd15912cf60d113e49a..5cd93cf4dde72f43e8538ff5500505971f3ec908 100644 (file)
@@ -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
index 5484897ca0ab90baf5c0e0c4297578815e23c35e..c1a82ac3657447f17200a687ed913cc98fa6909a 100644 (file)
@@ -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.