bool do_mount = false;
bool release = false;
bool have_vol;
- DEVICE *dev = dcr->dev;
+ DEVICE * volatile dev = dcr->dev;
JCR *jcr = dcr->jcr;
init_device_wait_timers(dcr);
* dcr->VolumeName is what we pass into the routines, or
* get back from the subroutines.
*/
- if (!have_vol &&
- !(dir_find_next_appendable_volume(dcr) &&
- strcmp(dev->VolHdr.VolumeName, dcr->VolumeName) == 0)) { /* wrong tape mounted */
- /* Wrong tape mounted, release it, then fall through to get correct one */
- Dmsg3(50, "Wrong tape mounted. Wanted:%s, got:%s, dev=%s release and try mount.\n",
- dcr->VolumeName, dev->VolHdr.VolumeName, dev->print_name());
- /* Release drive only if tape really in drive */
+ do_mount = false;
+ release = false;
+ /* If we do not have a volume, see if we can find one */
+ if (!have_vol) {
+ have_vol = dir_find_next_appendable_volume(dcr);
+ dev = dcr->dev;
+ }
+ if (have_vol) {
+ do_mount = true;
+ /* Make sure it is what we we have on the drive */
if (dev->VolHdr.VolumeName[0]) {
- release = true;
+ /* If we already have the volume, mount/release are not needed */
+ do_mount = strcmp(dev->VolHdr.VolumeName, dcr->VolumeName) != 0;
+ if (do_mount) {
+ release = true;
+ }
}
- do_mount = true;
- } else {
+ }
+ if (have_vol && !do_mount) {
/*
* At this point, the correct tape is already mounted, so
* we do not need to do mount_next_write_volume(), unless
*/
int read_ansi_ibm_label(DCR *dcr)
{
- DEVICE *dev = dcr->dev;
+ DEVICE * volatile dev = dcr->dev;
JCR *jcr = dcr->jcr;
char label[80]; /* tape label */
int stat, i;
}
*q = 0;
reserve_volume(dcr, dev->VolHdr.VolumeName);
+ dev = dcr->dev; /* may have changed in reserve_volume */
Dmsg2(100, "Wanted ANSI Vol %s got %6s\n", VolName, dev->VolHdr.VolumeName);
Mmsg2(jcr->errmsg, _("Wanted ANSI Volume \"%s\" got \"%s\"\n"), VolName, dev->VolHdr.VolumeName);
return VOL_NAME_ERROR;
int autoload_device(DCR *dcr, int writing, BSOCK *dir)
{
JCR *jcr = dcr->jcr;
- DEVICE *dev = dcr->dev;
+ DEVICE * volatile dev = dcr->dev;
int slot;
int drive = dev->drive_index;
int rtn_stat = -1; /* error status */
int read_dev_volume_label(DCR *dcr)
{
JCR *jcr = dcr->jcr;
- DEVICE *dev = dcr->dev;
+ DEVICE * volatile dev = dcr->dev;
char *VolName = dcr->VolumeName;
DEV_RECORD *record;
bool ok = false;
stat = VOL_NAME_ERROR;
goto bail_out;
}
+ dev = dcr->dev; /* may have changed in reserve volume */
/* Compare Volume Names */
Dmsg2(130, "Compare Vol names: VolName=%s hdr=%s\n", VolName?VolName:"*", dev->VolHdr.VolumeName);
bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
const char *PoolName, bool relabel, bool dvdnow)
{
- DEVICE *dev = dcr->dev;
+ DEVICE * volatile dev = dcr->dev;
Dmsg0(150, "write_volume_label()\n");
dev->VolHdr.VolumeName, dev->print_name());
goto bail_out;
}
+ dev = dcr->dev; /* may have changed in reserve_volume */
dev->clear_append(); /* remove append since this is PRE_LABEL */
return true;
VOLRES *reserve_volume(DCR *dcr, const char *VolumeName)
{
VOLRES *vol, *nvol;
- DEVICE *dev = dcr->dev;
+ DEVICE * volatile dev = dcr->dev;
ASSERT(dev != NULL);
dcr->VolCatInfo.Slot = save_dcr.VolCatInfo.Slot;
bstrncpy(dcr->pool_name, save_dcr.pool_name, sizeof(dcr->pool_name));
bstrncpy(dcr->pool_type, save_dcr.pool_type, sizeof(dcr->pool_type));
- bstrncpy(dcr->dev_name, save_dcr.dev_name, sizeof(dcr->dev_name));
+ bstrncpy(dcr->dev_name, dev->dev_name, sizeof(dcr->dev_name));
dev->reserved_device++;
dcr->reserved_device = true;
Technical notes on version 2.3
General:
+12Mar08
+kes Second cut of drive switching during backup.
11Mar08
kes Fix Win32 build.
kes Update Win32 version of wxWidgets to most recent version.