dev->set_mounted(mount); /* set/clear mounted flag */
free_pool_memory(results);
- /* Do not check free space when unmounting (otherwise it will mount it again) */
+ /* Do not check free space when unmounting */
if (mount) {
update_free_space_dev(dev);
}
* 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...
+ *
+ * There is one exception: when recycling a volume, we write a blank part
+ * file, so, then, we need to accept to write it.
*/
- 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);
+ if ((dev->part_size == 0) && (dev->part > 0)) {
+ Dmsg2(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());
* timeout = dev->max_open_wait + (dev->max_part_size/(1350*1024/2));
* I modified this for a longer timeout; pre-formatting, blanking and
* writing can take quite a while
- *
- * NB: Use part_size and not max_part_size, needed when you don't set max part size (so it defaults to 0)
*/
- timeout = dev->max_open_wait + (dev->part_size/(1350*1024)*8);
+
+ /* Explanation of the timeout value, when writing the first part,
+ * by Arno Lehmann :
+ * 9 GB, write speed 1x: 6990 seconds (almost 2 hours...)
+ * Overhead: 900 seconds (starting, initializing, finalizing,probably
+ * reloading 15 minutes)
+ * Sum: 15780.
+ * A reasonable last-exit timeout would be 16000 seconds. Quite long -
+ * almost 4.5 hours, but hopefully, that timeout will only ever be needed
+ * in case of a serious emergency.
+ */
+
+ if (dev->part == 0)
+ timeout = 16000;
+ else
+ timeout = dev->max_open_wait + (dev->part_size/(1350*1024/4));
Dmsg2(29, "dvd_write_part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout);
* needed. If num_parts represents what is on the DVD
* we should only need to change it when writing a part
* to the DVD.
+ * NB. As dvd_write_part increments dev->num_parts, I also
+ * think it is not needed.
*/
if (dev->num_parts < dev->part) {
Dmsg2(100, "Set npart=%d to part=%d\n", dev->num_parts, dev->part);
{
DEVICE *dev = dcr->dev;
- Dmsg4(29, "Enter: ==== open_first_part dev=%s Vol=%s mode=%d num_parts=%d\n", dev->print_name(),
- dev->VolCatInfo.VolCatName, dev->openmode, dev->num_parts);
+ Dmsg5(29, "Enter: ==== open_first_part dev=%s Vol=%s mode=%d num_parts=%d append=%d\n", dev->print_name(),
+ dev->VolCatInfo.VolCatName, dev->openmode, dev->num_parts, dev->can_append());
if (dev->fd >= 0) {
close(dev->fd);
Dmsg2(50, "Call dev->open(vol=%s, mode=%d)\n", dcr->VolCatInfo.VolCatName,
mode);
+ int append = dev->can_append();
if (dev->open(dcr, mode) < 0) {
Dmsg0(50, "open dev() failed\n");
return -1;
}
- Dmsg1(50, "Leave open_first_part state=%s\n", dev->is_open()?"open":"not open");
+ if (append && (dev->part == dev->num_parts)) { /* If needed, set the append flag back */
+ dev->set_append();
+ }
+ Dmsg2(50, "Leave open_first_part state=%s append=%d\n", dev->is_open()?"open":"not open", dev->can_append());
+
return dev->fd;
}
return false;
}
+ /* Set num_parts to zero (on disk) */
+ dev->num_parts = 0;
+ dcr->VolCatInfo.VolCatParts = 0;
+ dev->VolCatInfo.VolCatParts = 0;
+
if (dvd_open_first_part(dcr, OPEN_READ_WRITE) < 0) {
Dmsg0(100, "truncate_dvd_dev: Error while opening first part (2).\n");
return false;
if (name_max < 1024) {
name_max = 1024;
}
-
+
if (!(dp = opendir(dev->device->mount_point))) {
berrno be;
dev->dev_errno = errno;