bool WroteVol; /* set if Volume written */
bool NewFile; /* set when EOF written */
bool reserved_device; /* set if reserve done */
+ bool reserved_volume; /* set if we reserved a volume */
bool any_volume; /* Any OK for dir_find_next... */
bool attached_to_dev; /* set when attached to dev */
bool volume_in_use; /* set in dir_find_next_appendable_volume() */
* is not being used and is marked as released.
*/
if (strcmp(vol->vol_name, VolumeName) == 0) {
- Dmsg1(dbglvl, "=== OK, vol=%s on device. set not released.\n", VolumeName);
+ Dmsg2(dbglvl, "=== set not released vol=%s dev=%s\n", VolumeName,
+ vol->dev->print_name());
vol->released = false; /* retake vol if released previously */
+ dcr->reserved_volume = true; /* reserved volume */
goto get_out; /* Volume already on this device */
} else {
/* Don't release a volume if it is in use */
- if (!vol->released) {
+ if (!vol->released && !dcr->reserved_volume) {
Dmsg1(dbglvl, "Cannot free vol=%s. It is not released.\n", vol->vol_name);
vol = NULL; /* vol in use */
goto get_out;
get_out:
if (vol) {
- Dmsg1(dbglvl, "=== set not released. vol=%s\n", vol->vol_name);
+ Dmsg2(dbglvl, "=== set not released. vol=%s dev=%s\n", vol->vol_name,
+ vol->dev->print_name());
vol->released = false;
+ dcr->reserved_volume = true;
}
debug_list_volumes("end new volume");
unlock_volumes();
DEVICE *dev = dcr->dev;
if (dcr->reserved_device) {
dcr->reserved_device = false;
+ dcr->reserved_volume = false;
dev->reserved_device--;
Dmsg2(dbglvl, "Dec reserve=%d dev=%s\n", dev->reserved_device, dev->print_name());
- dcr->reserved_device = false;
/* If we set read mode in reserving, remove it */
if (dev->can_read()) {
dev->clear_read();
Dmsg3(dbglvl, "=== mark released vol=%s num_writers=%d dev_reserved=%d\n",
dev->vol->vol_name, dev->num_writers, dev->reserved_device);
dev->vol->released = true;
+ Dmsg2(dbglvl, "=== set released. Vol=%s dev=%s\n", dev->vol->vol_name,
+ dev->print_name());
if (dev->is_tape()) { // || dev->is_autochanger()) {
return true;
} else {
Technical notes on version 2.3
General:
+14Mar08
+kes Add dcr->reserved_volume flag that allows us to release a volume
+ even if it is not vol->released. This allows maxvol2 to work when
+ Volumes expire and we are already writing to the device (i.e. a
+ volume is pulled out from under us by another job terminating after
+ we reserve the drive).
13Mar08
ebl Permit multiple command/console per runscript definition.
RunScript { command = /bin/true ; command = /bin/false ... }