/*
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.
dev->clear_read(); /* clear read bit */
Dmsg0(100, "dir_update_vol_info. Release0\n");
dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
+ volume_unused(dcr);
} else if (dev->num_writers > 0) {
/*
if (!dev->num_writers && dev->can_write() && dev->block_num > 0) {
dev->weof(1);
write_ansi_ibm_labels(dcr, ANSI_EOF_LABEL, dev->VolHdr.VolumeName);
+ volume_unused(dcr);
}
if (!dev->at_weot()) {
dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */
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);
empty_block(dcr->block);
if (relabel) {
+ volume_unused(dcr); /* mark current volume unused */
/* Truncate device */
if (!dev->truncate(dcr)) {
goto bail_out;
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());
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 */
*/
if (strcmp(vol->vol_name, VolumeName) == 0) {
Dmsg1(dbglvl, "=== OK, vol=%s on device. set not released.\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 */
+ 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;
+ }
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);
Jmsg1(dcr->jcr, M_ERROR, 0, _("Hey! num_writers=%d!!!!\n"), dev->num_writers);
dev->num_writers = 0;
}
+ if (dev->reserved_device == 0 && dev->num_writers == 0) {
+ volume_unused(dcr);
+ }
}
-
- volume_unused(dcr);
}
/*
return false;
}
+#ifdef xxx
if (dev->is_busy()) {
Dmsg1(dbglvl, "vol_unused: busy on %s\n", dev->print_name());
debug_list_volumes("dev busy cannot unreserve_volume");
return false;
}
+#endif
#ifdef xxx
if (dev->num_writers > 0 || dev->reserved_device > 0) {
ASSERT(0);
Dmsg1(dbglvl, "looking for Volume=%s\n", rctx.VolumeName);
} else {
Dmsg0(dbglvl, "No next volume found\n");
+ rctx.have_volume = false;
+ rctx.VolumeName[0] = 0;
/*
* If there is at least one volume that is valid and in use,
* but we get here, check if we are running with prefers
}
goto bail_out;
}
- rctx.have_volume = false;
- rctx.VolumeName[0] = 0;
}
}
} else {