From: Nicolas Boichat Date: Sat, 15 Oct 2005 23:18:36 +0000 (+0000) Subject: Don't write empty part. (Fix 4GB crossing bug reported by Arno Lehmann) X-Git-Tag: Release-7.0.0~8393 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=da861ac1268161ce4b99d47121ae254147047978;p=bacula%2Fbacula Don't write empty part. (Fix 4GB crossing bug reported by Arno Lehmann) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2447 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/nb-1.37 b/bacula/nb-1.37 index 2d01f9d4f2..6396d9c5a1 100644 --- a/bacula/nb-1.37 +++ b/bacula/nb-1.37 @@ -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). diff --git a/bacula/src/stored/dvd.c b/bacula/src/stored/dvd.c index dfd20b751a..a6f79af564 100644 --- a/bacula/src/stored/dvd.c +++ b/bacula/src/stored/dvd.c @@ -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 */