]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/mac.c
Tweak debug levels in reservations + Correct typo in UTF-8 error message as reported by:
[bacula/bacula] / bacula / src / stored / mac.c
index 27f3543872cdd6a9a728730e14358edcc6573702..dc4e20f1e6f43c9768b33596265a4d884e2410b2 100644 (file)
@@ -100,10 +100,12 @@ bool do_mac(JCR *jcr)
 
    Dmsg2(200, "===== After acquire pos %u:%u\n", jcr->dcr->dev->file, jcr->dcr->dev->block_num);
      
-
    set_jcr_job_status(jcr, JS_Running);
    dir_send_job_status(jcr);
 
+   begin_data_spool(jcr->dcr);
+   begin_attribute_spool(jcr);
+
    jcr->dcr->VolFirstIndex = jcr->dcr->VolLastIndex = 0;
    jcr->run_time = time(NULL);
 
@@ -127,12 +129,24 @@ ok_out:
          Dmsg2(200, "Flush block to device pos %u:%u\n", dev->file, dev->block_num);
       }  
 
+      if (!ok) {
+         discard_data_spool(jcr->dcr);
+      } else {
+         /* Note: if commit is OK, the device will remain locked */
+         commit_data_spool(jcr->dcr);
+      }
 
       if (ok && dev->is_dvd()) {
          ok = dvd_close_job(jcr->dcr);   /* do DVD cleanup if any */
       }
       /* Release the device -- and send final Vol info to DIR */
       release_device(jcr->dcr);
+
+      if (!ok || job_canceled(jcr)) {
+         discard_attribute_spool(jcr);
+      } else {
+         commit_attribute_spool(jcr);
+      }
    }
 
    if (jcr->read_dcr) {
@@ -143,13 +157,6 @@ ok_out:
 
    free_restore_volume_list(jcr);
 
-
-   if (!ok || job_canceled(jcr)) {
-      discard_attribute_spool(jcr);
-   } else {
-      commit_attribute_spool(jcr);
-   }
-
    dir_send_job_status(jcr);          /* update director */
 
 
@@ -233,16 +240,16 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
        crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) {
       if (!jcr->no_attributes) {
          if (are_attributes_spooled(jcr)) {
-            jcr->dir_bsock->spool = true;
+            jcr->dir_bsock->m_spool = true;
          }
          Dmsg0(850, "Send attributes to dir.\n");
          if (!dir_update_file_attributes(jcr->dcr, rec)) {
-            jcr->dir_bsock->spool = false;
+            jcr->dir_bsock->m_spool = false;
             Jmsg(jcr, M_FATAL, 0, _("Error updating file attributes. ERR=%s\n"),
                bnet_strerror(jcr->dir_bsock));
             return false;
          }
-         jcr->dir_bsock->spool = false;
+         jcr->dir_bsock->m_spool = false;
       }
    }