]> git.sur5r.net Git - bacula/bacula/commitdiff
Don't write empty part. (Fix 4GB crossing bug reported by Arno Lehmann)
authorNicolas Boichat <nicolas@boichat.ch>
Sat, 15 Oct 2005 23:18:36 +0000 (23:18 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Sat, 15 Oct 2005 23:18:36 +0000 (23:18 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2447 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/nb-1.37
bacula/src/stored/dvd.c

index 2d01f9d4f2ef22492fca1dc3ef93f8034b8168ce..6396d9c5a149a71a12ca8db836bf9d61c3c4a582 100644 (file)
@@ -4,6 +4,8 @@
 General:
 
 Changes to 1.37.*:
+16Oct05
+ - dvd.c:dvd_write_part: Don't write empty part. (Fix 4GB crossing bug reported by Arno Lehmann)
 14Oct05
  - dvd.c:dvd_write_part: Use part_size and not max_part_size when setting write timeout.
  - dvd.c:do_mount_dev: When checking if the DVD is mounted, do not count ., .. and .keep (needed on Gentoo).
index dfd20b751a08f78fcb56f5ad8ff11270b4376ec5..a6f79af56400962752dec64ee143c269d4ffd2f0 100644 (file)
@@ -304,9 +304,32 @@ void update_free_space_dev(DEVICE* dev)
 bool dvd_write_part(DCR *dcr) 
 {
    DEVICE *dev = dcr->dev;
+   POOL_MEM archive_name(PM_FNAME);
+   
+   /* Don't write empty part files.
+    * This is only useful when growisofs does not support write beyond
+    * the 4GB boundary.
+    * Example :
+    *   - 3.9 GB on the volume, dvd-freespace reports 0.4 GB free
+    *   - Write 0.2 GB on the volume, Bacula thinks it could still
+    *     append data, it creates a new empty part.
+    *   - dvd-freespace reports 0 GB free, as the 4GB boundary has
+    *     been crossed
+    *   - Bacula thinks he must finish to write to the device, so it
+    *     tries to write the last part (0-byte), but dvd-writepart fails...
+    */
+   if (dev->part_size == 0) {
+      Dmsg3(29, "dvd_write_part: device is %s, won't write blank part %d\n", dev->print_name(), dev->part);
+      /* Delete spool file */
+      make_spooled_dvd_filename(dev, archive_name);
+      unlink(archive_name.c_str());
+      Dmsg1(29, "unlink(%s)\n", archive_name.c_str());
+      sm_check(__FILE__, __LINE__, false);
+      return true;
+   }
+   
    POOL_MEM ocmd(PM_FNAME);
    POOL_MEM results(PM_MESSAGE);
-   POOL_MEM archive_name(PM_FNAME);
    char* icmd;
    int status;
    int timeout;
@@ -340,7 +363,7 @@ bool dvd_write_part(DCR *dcr)
       sm_check(__FILE__, __LINE__, false);
       return false;
    } else {
-      dev->num_parts++;            /* there is no one more part on DVD */
+      dev->num_parts++;            /* there is now one more part on DVD */
    }
 
    /* Delete spool file */