]> git.sur5r.net Git - bacula/bacula/commitdiff
Zero Slot if cannot mount volume
authorKern Sibbald <kern@sibbald.com>
Mon, 7 Jun 2004 10:49:02 +0000 (10:49 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 7 Jun 2004 10:49:02 +0000 (10:49 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1385 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/stored/askdir.c
bacula/src/stored/autochanger.c
bacula/src/stored/mount.c
bacula/src/version.h

index 51fbf5960ad5ade5e5966d70cd5fe47838e3f5ca..b4b21134380a5c4fd6a03cb604a6a4ace1619fd1 100644 (file)
@@ -48,6 +48,7 @@ For 1.33 Testing/Documentation:
 - Add regression of btape "fill" 
 - Document if absolute path specified extension must be specified
   on Win32.
+- Document vendor database repair.
 
 For version 1.35:
 - Do tape alerts -- see tapealert.txt
index 7de73ada443e152cf6708e7d126be42098b5de57..469d605510ce136196cbf9266cd1b51de77d5d4b 100644 (file)
@@ -474,8 +474,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev)
        *   Slot for an autochanger, otherwise wait
        *   for the operator to mount the media.
        */
-      if ((jcr->VolumeName[0] && !dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) ||
-         (jcr->VolumeName[0] && jcr->VolCatInfo.Slot)) {
+      if ((!dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) || jcr->VolCatInfo.Slot) {
          Dmsg0(100, "Return 1 from mount without wait.\n");
         return 1;
       }
index 60f428a2ce46fc5363d74f919ce8cfd6bce198e2..f8c35fecb587e7be5d156d23319a82632302dad2 100644 (file)
@@ -64,6 +64,8 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir)
       }
       if (dir_find_next_appendable_volume(jcr)) {
         slot = jcr->VolCatInfo.Slot; 
+      } else {
+        slot = 0;
       }
    }
    Dmsg1(400, "Want changer slot=%d\n", slot);
index 4effbc20d170a677a260692dcbd91e75f2c6ec40..5d411b743e5468061f6e0568bf67269192046adf 100644 (file)
@@ -59,16 +59,19 @@ int mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release
     */
 mount_next_vol:
    /* Ignore retry if this is poll request */
-   if (!dev->poll && retry++ > 8) {
-      Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), 
-          dev_name(dev));
-      return 0;
+   if (!dev->poll && retry++ > 4) {
+      /* Last ditch effort before giving up, force operator to respond */
+      jcr->VolCatInfo.Slot = 0;
+      if (!dir_ask_sysop_to_mount_volume(jcr, dev)) {
+         Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), 
+             dev_name(dev));
+        return 0;
+      }
    }
    if (job_canceled(jcr)) {
       Jmsg(jcr, M_FATAL, 0, _("Job %d canceled.\n"), jcr->JobId);
       return 0;
    }
-   autochanger = false;               /* Assume no autochanger */
    recycle = false;
    if (release) {
       Dmsg0(100, "mount_next_volume release=1\n");
@@ -111,6 +114,10 @@ mount_next_vol:
 
    if (autoload_device(jcr, dev, 1, NULL) > 0) {
       autochanger = true;
+      ask = false;
+   } else {
+      autochanger = false;
+      jcr->VolCatInfo.Slot = 0;
    }
    Dmsg1(100, "autoload_dev returns %d\n", autochanger);
    /*
@@ -119,7 +126,7 @@ mount_next_vol:
     *  and read the label. If there is no tape in the drive,
     *  we will err, recurse and ask the operator the next time.
     */
-   if (autochanger || (!release && dev_is_tape(dev) && dev_cap(dev, CAP_AUTOMOUNT))) {
+   if (!release && dev_is_tape(dev) && dev_cap(dev, CAP_AUTOMOUNT)) {
       ask = false;                 /* don't ask SYSOP this time */
    }
    Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger);
@@ -292,22 +299,6 @@ read_volume:
               dev_name(dev), strerror_dev(dev));
            goto mount_next_vol;
         }
-        /* 
-         * We do not return the label in the block, because if we are
-         *  running multiple simultaneous jobs, once we release the lock
-         *  some other thread may write his block over the label. So, 
-         *  we simply write it definitively now.
-         */
-#ifdef needed
-        if (!rewind_dev(dev)) {
-            Jmsg2(jcr, M_ERROR, 0, _("Unable to rewind device %s. ERR=%s\n"),
-              dev_name(dev), strerror_dev(dev));
-           goto mount_next_vol;
-        }
-
-        /* Recreate a correct volume label and return it in the block */
-        write_volume_label_to_block(jcr, dev, block);
-#endif
       }
       /* Set or reset Volume statistics */
       dev->VolCatInfo.VolCatJobs = 0;
index aeb118554efe8189ed683c08568d45f6a5fa19f0..e6edb1b8515b6a62e2bb9245e511a8090e2b4a77 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.34.3"
 #define VSTRING "1"
-#define BDATE   "05 June 2004"
-#define LSMDATE "05Jun04"
+#define BDATE   "06 June 2004"
+#define LSMDATE "06Jun04"
 
 /* Debug flags */
 #undef  DEBUG