]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/wait.c
Make Attr/record FI non-fatal if different -- possibly temp + add new session record...
[bacula/bacula] / bacula / src / stored / wait.c
index b443fd335fd291ca171689cd46738b64174efa61..f8fbb970f65f85e39431936fe51902d82590cb5d 100644 (file)
@@ -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 @@ int wait_for_sysop(DCR *dcr)
 
    dev->dlock();  
    Dmsg1(dbglvl, "Enter blocked=%s\n", dev->print_blocked());
-   unmounted = is_device_unmounted(dev);
 
+   /*
+    * Since we want to mount a tape, make sure current one is
+    *  not marked as using this drive.
+    */
+   volume_unused(dcr);
+
+   unmounted = dev->is_device_unmounted();
    dev->poll = false;
    /*
     * Wait requested time (dev->rem_wait_sec).  However, we also wake up every
@@ -98,11 +104,12 @@ int wait_for_sysop(DCR *dcr)
       Dmsg4(dbglvl, "I'm going to sleep on device %s. HB=%d rem_wait=%d add_wait=%d\n", 
          dev->print_name(), (int)me->heartbeat_interval, dev->rem_wait_sec, add_wait);
       start = time(NULL);
+
       /* Wait required time */
       stat = pthread_cond_timedwait(&dev->wait_next_vol, &dev->m_mutex, &timeout);
+
       Dmsg2(dbglvl, "Wokeup from sleep on device stat=%d blocked=%s\n", stat,
          dev->print_blocked());
-
       now = time(NULL);
       total_waited = now - first_start;
       dev->rem_wait_sec -= (now - start);
@@ -129,7 +136,6 @@ int wait_for_sysop(DCR *dcr)
          break;
       }
 
-
       if (dev->rem_wait_sec <= 0) {  /* on exceeding wait time return */
          Dmsg0(dbglvl, "Exceed wait time.\n");
          stat = W_TIMEOUT;
@@ -139,7 +145,7 @@ int wait_for_sysop(DCR *dcr)
       /*
        * Check if user unmounted the device while we were waiting
        */
-      unmounted = is_device_unmounted(dev);
+      unmounted = dev->is_device_unmounted();
 
       if (!unmounted && dev->vol_poll_interval &&
           (total_waited >= dev->vol_poll_interval)) {