/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
edit_int64(jcr->JobId, ed1));
goto get_out;
}
+ volume_unused(dcr); /* release any current volume */
jcr->CurReadVolume++;
for (i=1; i<jcr->CurReadVolume; i++) {
vol = vol->next;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
}
bail_out:
+ volume_unused(dcr); /* mark volume unused */
dev->set_ateot(); /* no more writing this tape */
Dmsg1(50, "*** Leave terminate_writing_volume -- %s\n", ok?"OK":"ERROR");
return ok;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
Pmsg2(000, _("End of Volume \"%s\" %d records.\n"), dcr->VolumeName,
quickie_count);
+ volume_unused(dcr); /* mark volume no longer needed */
if (LastBlock != block->BlockNumber) {
VolBytes += block->block_len;
}
}
bail_out:
+ volume_unused(dcr); /* no longer using */
if (!dev->is_open()) {
dev->clear_volhdr();
}
ok = false;
break;
}
+ volume_unused(dcr);
give_back_device_lock(dev, &hold);
return ok;
}
return VOL_OK;
bail_out:
+ volume_unused(dcr); /* mark volume "released" */
empty_block(block);
dev->rewind(dcr);
Dmsg1(150, "return %d\n", stat);
Dmsg0(150, "write_volume_label()\n");
empty_block(dcr->block);
- /* If relabeling, truncate the device */
- if (relabel && !dev->truncate(dcr)) {
- goto bail_out;
- }
-
- if (relabel && !dev->is_tape()) {
- dev->close_part(dcr); /* make sure DVD/file closed for rename */
+ if (relabel) {
+ volume_unused(dcr); /* mark current volume unused */
+ /* Truncate device */
+ if (!dev->truncate(dcr)) {
+ goto bail_out;
+ }
+ if (!dev->is_tape()) {
+ dev->close_part(dcr); /* make sure DVD/file closed for rename */
+ }
}
/* Set the new filename for open, ... */
return false;
}
if (recycle) {
+ volume_unused(dcr); /* mark volume unused */
if (!dev->truncate(dcr)) {
Jmsg2(jcr, M_FATAL, 0, _("Truncate error on device %s: ERR=%s\n"),
dev->print_name(), dev->print_errmsg());
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
DEV_RECORD *trec = new_record();
Jmsg(jcr, M_INFO, 0, _("End of Volume at file %u on device %s, Volume \"%s\"\n"),
dev->file, dev->print_name(), dcr->VolumeName);
+ volume_unused(dcr); /* mark volume unused */
if (!mount_cb(dcr)) {
Jmsg(jcr, M_INFO, 0, _("End of all volumes.\n"));
ok = false; /* Stop everything */
vol = dev->vol;
/*
* Make sure we don't remove the current volume we are inserting
- * because it was probably inserted by another job.
+ * because it was probably inserted by another job, or it
+ * is not being used and is marked as released.
*/
if (strcmp(vol->vol_name, VolumeName) == 0) {
Dmsg1(dbglvl, "OK, vol=%s on device.\n", VolumeName);
+ vol->released = false; /* retake vol if released previously */
goto get_out; /* Volume already on this device */
} else {
/* Don't release a volume if it is in use */
-#ifdef xxx
if (!vol->released) {
+ Dmsg1(dbglvl, "Cannot free vol=%s. It is not released.\n", vol->vol_name);
vol = NULL; /* vol in use */
goto get_out;
}
-#endif
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
unload_autochanger(dcr, -1); /* unload the volume */
free_volume(dev);
dev->num_writers = 0;
}
}
-
volume_unused(dcr);
}
if (dev->is_tape() || dev->is_autochanger()) {
return true;
} else {
+ /*
+ * Note, this frees the volume reservation entry, but the
+ * file descriptor remains open with the OS.
+ */
return free_volume(dev);
}
}
Technical notes on version 2.3
General:
+06Jan08
+kes A few more tweaks to new reservation code. Make sure to clear
+ vol released flag when retaking volume. When reading label and
+ label is bad mark volume unused. When recycling, mark volume
+ unused so it can be renamed.
05Jan08
kes Fix reserve_volume() so it doesn't release a volume in use
(i.e. a volume entry not marked released). This should be