- Doc to do unmount before removing magazine.
- Detect fixed tape block mode during positioning by looking at
block numbers in btape "test". Possibly adjust in Bacula.
+- Fix possible bug in update volumefrompool (email 9/28 from
+ jesk@killall.org
- Document a get out of jail procedure if everything breaks if
you lost/broke the Catalog -- do the same for "I know my
- Fix bscan so that it releases the drive when requesting a new tape.
- List verify options for DiskToCatalog in doc.
- Turn on transactions if multiple connections are on in DB.
-
status = errno;
}
if (status != 0) {
- berrno be(status);
+ berrno be;
Jmsg(jcr, M_INFO, 0, _("3997 Bad alert command: %s: ERR=%s.\n"),
- alert, be.strerror());
+ alert, be.strerror(status));
}
Dmsg1(400, "alert status=%d\n", status);
## Changer Command = "@scriptdir@/mtx-changer %c %o %S %a %d"
## Changer Device = /dev/sg0
## AutoChanger = yes
-## Alert Command = "sh -c 'tapeinfo -f %c | grep TapeAlert'"
+## Alert Command = "sh -c 'tapeinfo -f %c |grep TapeAlert|cat'"
#}
#
block->buf = get_memory(block->buf_len);
empty_block(block);
block->BlockVer = BLOCK_VER; /* default write version */
- Dmsg1(90, "Returning new block=%x\n", block);
+ Dmsg1(350, "Returning new block=%x\n", block);
return block;
}
{
bool stat;
DEVICE *dev = dcr->dev;
- Dmsg0(90, "Enter read_block_from_device\n");
+ Dmsg0(200, "Enter read_block_from_device\n");
lock_device(dev);
stat = read_block_from_dev(dcr, check_block_numbers);
unlock_device(dev);
- Dmsg0(90, "Leave read_block_from_device\n");
+ Dmsg0(200, "Leave read_block_from_device\n");
return stat;
}
return false;
}
looping = 0;
- Dmsg1(100, "Full read() in read_block_from_device() len=%d\n",
+ Dmsg1(200, "Full read() in read_block_from_device() len=%d\n",
block->buf_len);
reread:
if (looping > 1) {
if (stat < 0) {
berrno be;
clrerror_dev(dev, -1);
- Dmsg1(90, "Read device got: ERR=%s\n", be.strerror());
+ Dmsg1(200, "Read device got: ERR=%s\n", be.strerror());
block->read_len = 0;
Mmsg4(dev->errmsg, _("Read error at file:blk %u:%u on device %s. ERR=%s.\n"),
dev->file, dev->block_num, dev->dev_name, be.strerror());
}
return false;
}
- Dmsg1(90, "Read device got %d bytes\n", stat);
+ Dmsg1(200, "Read device got %d bytes\n", stat);
if (stat == 0) { /* Got EOF ! */
dev->block_num = block->read_len = 0;
Mmsg3(dev->errmsg, _("Read zero bytes at %u:%u on device %s.\n"),
Pmsg1(000, "%s", dev->errmsg);
/* Attempt to reposition to re-read the block */
if (dev->state & ST_TAPE) {
- Dmsg0(100, "Backspace record for reread.\n");
+ Dmsg0(200, "BSR for reread; block too big for buffer.\n");
if (!bsr_dev(dev, 1)) {
Jmsg(jcr, M_ERROR, 0, "%s", strerror_dev(dev));
block->read_len = 0;
loaded = atoi(results);
} else {
berrno be;
- be.set_errno(status);
Pmsg1(-1, _("3991 Bad autochanger command: %s\n"), changer);
- Pmsg2(-1, _("3991 result=\"%s\": ERR=%s\n"), results, be.strerror());
+ Pmsg2(-1, _("3991 result=\"%s\": ERR=%s\n"), results, be.strerror(status));
goto bail_out;
}
if (loaded) {
Pmsg2(-1, "unload status=%s %d\n", status==0?"OK":"Bad", status);
if (status != 0) {
berrno be;
- be.set_errno(status);
Pmsg1(-1, _("3992 Bad autochanger command: %s\n"), changer);
- Pmsg2(-1, _("3992 result=\"%s\": ERR=%s\n"), results, be.strerror());
+ Pmsg2(-1, _("3992 result=\"%s\": ERR=%s\n"), results, be.strerror(status));
}
}
slot, dev->drive_index);
} else {
berrno be;
- be.set_errno(status);
Pmsg1(-1, _("3993 Bad autochanger command: %s\n"), changer);
- Pmsg2(-1, _("3993 result=\"%s\": ERR=%s\n"), results, be.strerror());
+ Pmsg2(-1, _("3993 result=\"%s\": ERR=%s\n"), results, be.strerror(status));
goto bail_out;
}
if (stat > 0 && stat <= len) {
errno = 0;
}
+ berrno be;
Pmsg3(0, _("Read of %d bytes gives stat=%d. ERR=%s\n"),
- len, stat, strerror(errno));
+ len, stat, be.strerror());
free(buf);
}
Pmsg1(0, _("Starting scan at file %u\n"), dev->file);
for (;;) {
if ((stat = read(dev->fd, buf, sizeof(buf))) < 0) {
+ berrno be;
clrerror_dev(dev, -1);
Mmsg2(dev->errmsg, "read error on %s. ERR=%s.\n",
- dev->dev_name, strerror(dev->dev_errno));
+ dev->dev_name, be.strerror());
Pmsg2(0, "Bad status from read %d. ERR=%s\n", stat, strerror_dev(dev));
if (blocks > 0)
printf("%d block%s of %d bytes in file %d\n",
dev->min_block_size = dev->max_block_size;
set_volume_name("TestVolume1", 1);
+ rewind_dev(dev);
+ weof_dev(dev, 1);
+ dev->state &= ~ST_APPEND; /* force volume to be relabeled */
+
/*
* Acquire output device for writing. Note, after acquiring a
* device, we MUST release it, which is done at the end of this
strerror_dev(dev));
ok = false;
}
- Pmsg0(-1, "Wrote Start Of Session label.\n");
+ Pmsg0(-1, "Wrote Start of Session label.\n");
memset(&rec, 0, sizeof(rec));
rec.data = get_memory(100000); /* max record size */
Pmsg0(-1, _("Set ok=false after write_block_to_device.\n"));
ok = false;
}
- Pmsg0(-1, _("Wrote End Of Session label.\n"));
+ Pmsg0(-1, _("Wrote End of Session label.\n"));
/* Save last block info for second tape */
last_block_num2 = last_block_num;
Pmsg2(-1, "Wrote state file last_block_num1=%d last_block_num2=%d\n",
last_block_num1, last_block_num2);
} else {
+ berrno be;
Pmsg2(-1, _("Could not create state file: %s ERR=%s\n"), buf,
- strerror(errno));
+ be.strerror());
}
- /* Release the device if multiple tapes being used */
- if (!simple && !release_device(jcr)) {
- Pmsg0(-1, _("Error in release_device\n"));
- ok = false;
- }
+ Pmsg4(-1, _("\n\nDone filling tape%s at %d:%d. Now beginning re-read of %stape ...\n"),
+ simple?"":"s", jcr->dcr->dev->file, jcr->dcr->dev->block_num, simple?"":"first ");
- Pmsg2(-1, _("\n\nDone filling tape%s. Now beginning re-read of %stape ...\n"),
- simple?"":"s", simple?"":"first ");
+ jcr->dcr->block = block;
+ /* Release the device if multiple tapes being used */
+// if (!simple && !release_device(jcr)) {
+// Pmsg0(-1, _("Error in release_device\n"));
+// ok = false;
+// }
do_unfill();
return;
}
} else {
+ berrno be;
Pmsg2(-1, "\nCould not find the state file: %s ERR=%s\n"
- "You must redo the fill command.\n", buf, strerror(errno));
+ "You must redo the fill command.\n", buf, be.strerror());
return;
}
do_unfill();
jcr->bsr = NULL;
create_vol_list(jcr);
close_dev(dev);
- dev->state &= ~ST_READ;
+ dev->state &= ~(ST_READ|ST_APPEND);
+ dev->num_writers = 0;
if (!acquire_device_for_read(jcr)) {
Pmsg1(-1, "%s", dev->errmsg);
goto bail_out;
* Note, re-reading last block may have caused us to
* loose track of where we are (block number unknown).
*/
- rewind_dev(dev); /* get to a known place on tape */
+ if (!rewind_dev(dev)) { /* get to a known place on tape */
+ goto bail_out;
+ }
/* Read the first 1000 records */
Pmsg0(-1, _("Reading the first 1000 records.\n"));
+ quickie_count = 0;
read_records(dcr, quickie_cb, my_mount_next_read_volume);
Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
last_file, last_block_num);
if (!reposition_dev(dev, last_file, last_block_num)) {
Pmsg1(-1, "Reposition error. ERR=%s\n", strerror_dev(dev));
+ goto bail_out;
}
Pmsg1(-1, _("Reading block %u.\n"), last_block_num);
if (!read_block_from_device(dcr, NO_BLOCK_NUMBER_CHECK)) {
/* Read 1000 records then stop */
static bool quickie_cb(DCR *dcr, DEV_RECORD *rec)
{
+ DEVICE *dev = dcr->dev;
+ if (dev->file != 0) {
+ Pmsg3(-1, "ERROR! device at %d:%d count=%d\n", dev->file, dev->block_num,
+ quickie_count);
+ return false;
+ }
quickie_count++;
- return quickie_count <= 1000;
+ if (quickie_count == 1000) {
+ Pmsg2(-1, "1000 records read now at %d:%d\n", dev->file, dev->block_num);
+ }
+ return quickie_count < 1000;
}
static bool compare_blocks(DEV_BLOCK *last_block, DEV_BLOCK *block)
static int flush_block(DEV_BLOCK *block, int dump)
{
char ec1[50];
- lock_device(dev);
DEV_BLOCK *tblock;
uint32_t this_file, this_block_num;
+ lock_device(dev);
if (!this_block) {
this_block = new_block(dev);
}
}
kbs = (double)dev->VolCatInfo.VolCatBytes / (1000 * now);
vol_size = dev->VolCatInfo.VolCatBytes;
- Pmsg2(000, "End of tape. VolumeCapacity=%s. Write rate = %.1f KB/s\n",
+ Pmsg4(000, "End of tape %d:%d. VolumeCapacity=%s. Write rate = %.1f KB/s\n",
+ dev->file, dev->block_num,
edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), kbs);
if (simple) {
memcpy(this_block->buf, block->buf, this_block->buf_len);
/*
- * Toggle between two allocated blocks for efficiency.
+ * Note, we always read/write to block, but we toggle
+ * copying it to one or another of two allocated blocks.
* Switch blocks so that the block just successfully written is
* always in last_block.
*/
}
my_errno = errno;
printf("\n");
+ berrno be;
printf("Write failed at block %u. stat=%d ERR=%s\n", block_num, stat,
- strerror(my_errno));
+ be.strerror(my_errno));
weofcmd();
}
dev->dev_errno = EBADF;
Mmsg1(&dev->errmsg, _("Bad call to rewind_dev. Device %s not open\n"),
dev->dev_name);
- Emsg0(M_FATAL, 0, dev->errmsg);
+ Emsg0(M_ABORT, 0, dev->errmsg);
return false;
}
dev->state &= ~(ST_EOT|ST_EOF|ST_WEOT); /* remove EOF/EOT flags */
return false;
}
- Dmsg0(29, "fsr_dev\n");
+ Dmsg1(29, "fsr_dev %d\n", num);
mt_com.mt_op = MTFSR;
mt_com.mt_count = num;
stat = ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
} else {
berrno be;
struct mtget mt_stat;
+ clrerror_dev(dev, MTFSR);
+ Dmsg1(100, "FSF fail: ERR=%s\n", be.strerror());
if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) {
Dmsg4(100, "Adjust from %d:%d to %d:%d\n", dev->file,
dev->block_num, mt_stat.mt_fileno, mt_stat.mt_blkno);
dev->file_addr = 0;
}
}
- clrerror_dev(dev, MTFSR);
Mmsg2(dev->errmsg, _("ioctl MTFSR error on %s. ERR=%s.\n"),
dev->dev_name, be.strerror(dev->dev_errno));
}
Jmsg(jcr, M_INFO, 0, "Got EOF at file %u on device %s, Volume \"%s\"\n",
dev->file, dev_name(dev), dcr->VolumeName);
}
- Dmsg3(100, "Got EOF at file %u on device %s, Volume \"%s\"\n",
+ Dmsg3(200, "Got EOF at file %u on device %s, Volume \"%s\"\n",
dev->file, dev_name(dev), dcr->VolumeName);
continue;
} else if (dev_state(dev, ST_SHORT)) {
break;
}
}
- Dmsg2(100, "New block at position=(file:block) %d:%d\n", dev->file, dev->block_num);
+ Dmsg2(300, "New block at position=(file:block) %d:%d\n", dev->file, dev->block_num);
#ifdef if_and_when_FAST_BLOCK_REJECTION_is_working
/* this does not stop when file/block are too big */
if (!match_bsr_block(jcr->bsr, block)) {
if (!found) {
rec = new_record();
recs->prepend(rec);
- Dmsg2(100, "New record for SI=%d ST=%d\n",
+ Dmsg2(300, "New record for SI=%d ST=%d\n",
block->VolSessionId, block->VolSessionTime);
} else {
#ifdef xxx
}
#endif
}
- Dmsg3(100, "After mount next vol. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec),
+ Dmsg3(300, "After mount next vol. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec),
block->BlockNumber, rec->remainder);
record = 0;
rec->state = 0;
- Dmsg1(100, "Block empty %d\n", is_block_empty(rec));
+ Dmsg1(300, "Block empty %d\n", is_block_empty(rec));
for (rec->state=0; !is_block_empty(rec); ) {
if (!read_record_from_block(block, rec)) {
- Dmsg3(100, "!read-break. state=%s blk=%d rem=%d\n", rec_state_to_str(rec),
+ Dmsg3(400, "!read-break. state=%s blk=%d rem=%d\n", rec_state_to_str(rec),
block->BlockNumber, rec->remainder);
break;
}
- Dmsg5(100, "read-OK. state=%s blk=%d rem=%d file:block=%d:%d\n",
+ Dmsg5(300, "read-OK. state=%s blk=%d rem=%d file:block=%d:%d\n",
rec_state_to_str(rec), block->BlockNumber, rec->remainder,
dev->file, dev->block_num);
/*
* get all the data.
*/
record++;
- Dmsg6(100, "recno=%d state=%s blk=%d SI=%d ST=%d FI=%d\n", record,
+ Dmsg6(300, "recno=%d state=%s blk=%d SI=%d ST=%d FI=%d\n", record,
rec_state_to_str(rec), block->BlockNumber,
rec->VolSessionId, rec->VolSessionTime, rec->FileIndex);
handle_session_record(dev, rec, &sessrec);
ok = record_cb(dcr, rec);
if (rec->FileIndex == EOS_LABEL) {
- Dmsg2(100, "Remove rec. SI=%d ST=%d\n", rec->VolSessionId,
+ Dmsg2(300, "Remove rec. SI=%d ST=%d\n", rec->VolSessionId,
rec->VolSessionTime);
recs->remove(rec);
free_record(rec);
int stat = match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec);
if (stat == -1) { /* no more possible matches */
done = true; /* all items found, stop */
- Dmsg2(100, "All done=(file:block) %d:%d\n", dev->file, dev->block_num);
+ Dmsg2(300, "All done=(file:block) %d:%d\n", dev->file, dev->block_num);
break;
} else if (stat == 0) { /* no match */
- Dmsg4(100, "Clear rem=%d FI=%d before set_eof pos %d:%d\n",
+ Dmsg4(300, "Clear rem=%d FI=%d before set_eof pos %d:%d\n",
rec->remainder, rec->FileIndex, dev->file, dev->block_num);
rec->remainder = 0;
rec->state &= ~REC_PARTIAL_RECORD;
}
}
if (is_partial_record(rec)) {
- Dmsg6(100, "Partial, break. recno=%d state=%s blk=%d SI=%d ST=%d FI=%d\n", record,
+ Dmsg6(300, "Partial, break. recno=%d state=%s blk=%d SI=%d ST=%d FI=%d\n", record,
rec_state_to_str(rec), block->BlockNumber,
rec->VolSessionId, rec->VolSessionTime, rec->FileIndex);
break; /* read second part of record */
}
ok = record_cb(dcr, rec);
if (rec->Stream == STREAM_MD5_SIGNATURE || rec->Stream == STREAM_SHA1_SIGNATURE) {
- Dmsg3(100, "Done FI=%d before set_eof pos %d:%d\n", rec->FileIndex,
+ Dmsg3(300, "Done FI=%d before set_eof pos %d:%d\n", rec->FileIndex,
dev->file, dev->block_num);
if (match_set_eof(jcr->bsr, rec) && try_repositioning(jcr, rec, dev)) {
- Dmsg2(100, "Break after match_set_eof pos %d:%d\n",
+ Dmsg2(300, "Break after match_set_eof pos %d:%d\n",
dev->file, dev->block_num);
break;
}
- Dmsg2(100, "After set_eof pos %d:%d\n", dev->file, dev->block_num);
+ Dmsg2(300, "After set_eof pos %d:%d\n", dev->file, dev->block_num);
}
} /* end for loop over records */
- Dmsg2(100, "After end records position=(file:block) %d:%d\n", dev->file, dev->block_num);
+ Dmsg2(300, "After end records position=(file:block) %d:%d\n", dev->file, dev->block_num);
} /* end for loop over blocks */
-// Dmsg2(100, "Position=(file:block) %d:%d\n", dev->file, dev->block_num);
+// Dmsg2(300, "Position=(file:block) %d:%d\n", dev->file, dev->block_num);
/* Walk down list and free all remaining allocated recs */
while (!recs->empty()) {
BSR *bsr;
bsr = find_next_bsr(jcr->bsr, dev);
if (bsr == NULL && jcr->bsr->mount_next_volume) {
- Dmsg0(100, "Would mount next volume here\n");
- Dmsg2(100, "Current postion (file:block) %d:%d\n",
+ Dmsg0(300, "Would mount next volume here\n");
+ Dmsg2(300, "Current postion (file:block) %d:%d\n",
dev->file, dev->block_num);
jcr->bsr->mount_next_volume = false;
dev->state |= ST_EOT;
dev->file, dev->block_num, bsr->volfile->sfile,
bsr->volblock->sblock);
}
- Dmsg4(100, "Try_Reposition from (file:block) %d:%d to %d:%d\n",
+ Dmsg4(300, "Try_Reposition from (file:block) %d:%d to %d:%d\n",
dev->file, dev->block_num, bsr->volfile->sfile,
bsr->volblock->sblock);
reposition_dev(dev, bsr->volfile->sfile, bsr->volblock->sblock);
if (bsr && (bsr->volfile->sfile != 0 || bsr->volblock->sblock != 0)) {
Jmsg(jcr, M_INFO, 0, _("Forward spacing to file:block %u:%u.\n"),
bsr->volfile->sfile, bsr->volblock->sblock);
- Dmsg2(100, "Forward spacing to file:block %u:%u.\n",
+ Dmsg2(300, "Forward spacing to file:block %u:%u.\n",
bsr->volfile->sfile, bsr->volblock->sblock);
reposition_dev(dev, bsr->volfile->sfile, bsr->volblock->sblock);
}
rtype = buf;
break;
}
- Dmsg5(100, "%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n",
+ Dmsg5(300, "%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n",
rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len);
}
/* */
#undef VERSION
#define VERSION "1.35.5"
-#define BDATE "26 September 2004"
-#define LSMDATE "26Sep04"
+#define BDATE "29 September 2004"
+#define LSMDATE "29Sep04"
/* Debug flags */
#undef DEBUG