This patch fixes a race condition where a Job is terminating at the same
 time that another job reaches the end of Volume. In that case, sometimes
 the last block or two are not written to the Volume.  This seems to be 
 relatively rare, but does result in data loss.  This fixes bug #964.

 Apply the patch to Bacula version 2.2.4 (or possibly any previous 2.2.x 
 version) with:

 cd <bacula-source>
 patch -p0 <2.2.4-lost-block.patch
 ./configure (your options)
 make
 ...
 make install


Index: src/stored/append.c
===================================================================
--- src/stored/append.c	(revision 5602)
+++ src/stored/append.c	(working copy)
@@ -287,7 +287,7 @@
     * Check if we can still write. This may not be the case
     *  if we are at the end of the tape or we got a fatal I/O error.
     */
-   if (dev->can_write()) {
+   if (ok || dev->can_write()) {
       if (!write_session_label(dcr, EOS_LABEL)) {
          Jmsg1(jcr, M_FATAL, 0, _("Error writting end session label. ERR=%s\n"),
                dev->bstrerror());


syntax highlighted by Code2HTML, v. 0.9.1