]> git.sur5r.net Git - bacula/bacula/commitdiff
Force unload of volume when wrong volume mounted in SD.
authorKern Sibbald <kern@sibbald.com>
Sat, 19 Apr 2008 10:09:40 +0000 (10:09 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 19 Apr 2008 10:09:40 +0000 (10:09 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6843 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/acquire.c
bacula/src/stored/mount.c
bacula/src/version.h
bacula/technotes-2.3

index 5733a4b80386a149683bee959dc3e6f6ca0a405d..207e3415dc54e68cc8abebb05068156d4ae648a9 100644 (file)
@@ -238,7 +238,10 @@ bool acquire_device_for_read(DCR *dcr)
          } else {
              bstrncpy(dev->BadVolName, dev->VolHdr.VolumeName, sizeof(dev->BadVolName));
          }
          } else {
              bstrncpy(dev->BadVolName, dev->VolHdr.VolumeName, sizeof(dev->BadVolName));
          }
-         unload_autochanger(dcr, -1);
+         if (!unload_autochanger(dcr, -1)) {
+            /* at least free the device so we can re-open with correct volume */
+            dev->close();                                                          
+         }
          /* Fall through */
       default:
          Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
          /* Fall through */
       default:
          Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
@@ -262,6 +265,12 @@ default_path:
                try_autochanger = false;
                continue;              /* try reading volume mounted */
             }
                try_autochanger = false;
                continue;              /* try reading volume mounted */
             }
+            /* Try closing and re-opening */
+            dev->close();
+            dev->clear_unload();
+            if (dev->open(dcr, OPEN_READ_ONLY) >= 0) {
+               continue;
+            }
          }
          
          /* Mount a specific volume and no other */
          }
          
          /* Mount a specific volume and no other */
index 5b22b3fa6cf38821331e9b764a7d2cdb025a4887..f0d0baf8ee287a6f9435b3ecac1f3ccbc7c534a9 100644 (file)
@@ -633,11 +633,12 @@ void DCR::mark_volume_in_error()
 {
    Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"),
         VolumeName);
 {
    Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"),
         VolumeName);
-   dev->VolCatInfo = VolCatInfo;     /* structure assignment */
+   dev->VolCatInfo = VolCatInfo;       /* structure assignment */
    bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus));
    Dmsg0(150, "dir_update_vol_info. Set Error.\n");
    dir_update_volume_info(this, false, false);
    volume_unused(this);
    bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus));
    Dmsg0(150, "dir_update_vol_info. Set Error.\n");
    dir_update_volume_info(this, false, false);
    volume_unused(this);
+   dev->set_unload();                 /* must get a new volume */
 }
 
 /*
 }
 
 /*
@@ -690,6 +691,7 @@ void DCR::release_volume()
    if (dev->is_open()) {
       dev->offline_or_rewind();
    }
    if (dev->is_open()) {
       dev->offline_or_rewind();
    }
+   dev->set_unload();
    Dmsg0(190, "release_volume\n");
 }
 
    Dmsg0(190, "release_volume\n");
 }
 
index 938d63051a8656182575d7e01da74ff83ca26c9a..2aceda5db4cca5eb81f5460b8dc9a86dd1a52997 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.3.18"
 
 #undef  VERSION
 #define VERSION "2.3.18"
-#define BDATE   "16 April 2008"
-#define LSMDATE "16Apr08"
+#define BDATE   "19 April 2008"
+#define LSMDATE "19Apr08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index 12dcd636e63ba5195ccc7881fb9a4980d7f9227b..b5546ef249394deeac6f22549eb67a9eca77b8bb 100644 (file)
@@ -24,6 +24,8 @@ Add long term statistics job table
 
 
 General:
 
 
 General:
+19Apr08
+kes  Force unload of volume when wrong volume mounted in SD.
 17Apr08
 kes  Fix bat seg fault at termination.
 kes  Add Bacula generated version to bat about box.
 17Apr08
 kes  Fix bat seg fault at termination.
 kes  Add Bacula generated version to bat about box.