- A bit of work on btape to keep if from going into infinite
loops when things do not work well, and to print a bit
better info.
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1685
91ce42f0-d328-0410-95d8-
f526ca767f89
+bacula-tray-monitor.desktop
bacula-tray-monior.desktop
.xvpics
logrotate
bacula-tray-monior.desktop
.xvpics
logrotate
$(INSTALL_SCRIPT) bacula $(DESTDIR)$(scriptdir)/bacula
@if test -f ${DESTDIR}${scriptdir}/mtx-changer; then \
echo " ==> Saving existing mtx-changer to mtx-changer.old"; \
$(INSTALL_SCRIPT) bacula $(DESTDIR)$(scriptdir)/bacula
@if test -f ${DESTDIR}${scriptdir}/mtx-changer; then \
echo " ==> Saving existing mtx-changer to mtx-changer.old"; \
- $(MV) -f ${DESTDIR}${scriptdir}/mtx-changer ${DESTDIR}${scriptdir}/mtx-changer.old
+ $(MV) -f ${DESTDIR}${scriptdir}/mtx-changer ${DESTDIR}${scriptdir}/mtx-changer.old; \
fi
$(INSTALL_SCRIPT) mtx-changer $(DESTDIR)$(scriptdir)/mtx-changer
$(INSTALL_DATA) btraceback.gdb $(DESTDIR)$(scriptdir)/btraceback.gdb
fi
$(INSTALL_SCRIPT) mtx-changer $(DESTDIR)$(scriptdir)/mtx-changer
$(INSTALL_DATA) btraceback.gdb $(DESTDIR)$(scriptdir)/btraceback.gdb
printf("%sFSR ", dev->capabilities & CAP_FSR ? "" : "!");
printf("%sFSF ", dev->capabilities & CAP_FSF ? "" : "!");
printf("%sFASTFSF ", dev->capabilities & CAP_FASTFSF ? "" : "!");
printf("%sFSR ", dev->capabilities & CAP_FSR ? "" : "!");
printf("%sFSF ", dev->capabilities & CAP_FSF ? "" : "!");
printf("%sFASTFSF ", dev->capabilities & CAP_FASTFSF ? "" : "!");
+ printf("%sBSFATEOM ", dev->capabilities & CAP_BSFATEOM ? "" : "!");
printf("%sEOM ", dev->capabilities & CAP_EOM ? "" : "!");
printf("%sREM ", dev->capabilities & CAP_REM ? "" : "!");
printf("%sRACCESS ", dev->capabilities & CAP_RACCESS ? "" : "!");
printf("%sEOM ", dev->capabilities & CAP_EOM ? "" : "!");
printf("%sREM ", dev->capabilities & CAP_REM ? "" : "!");
printf("%sRACCESS ", dev->capabilities & CAP_RACCESS ? "" : "!");
}
Pmsg0(0, "Backspace record OK.\n");
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
}
Pmsg0(0, "Backspace record OK.\n");
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
- Pmsg1(0, _("Read block failed! ERR=%s\n"), strerror(dev->dev_errno));
+ berrno be;
+ Pmsg1(0, _("Read block failed! ERR=%s\n"), be.strerror(dev->dev_errno));
goto bail_out;
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
goto bail_out;
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
- Pmsg1(0, _("Read block failed! ERR=%s\n"), strerror(dev->dev_errno));
+ berrno be;
+ Pmsg1(0, _("Read block failed! ERR=%s\n"), be.strerror(dev->dev_errno));
goto bail_out;
}
for (int i=0; i<len; i++) {
goto bail_out;
}
for (int i=0; i<len; i++) {
for (i=1; i<=2000; i++) {
read_again:
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
for (i=1; i<=2000; i++) {
read_again:
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
if (dev_state(dev, ST_EOF)) {
Pmsg0(-1, _("Got EOF on tape.\n"));
if (dev_state(dev, ST_EOF)) {
Pmsg0(-1, _("Got EOF on tape.\n"));
+ if (i == 1001) {
+ goto read_again;
+ }
- Pmsg1(0, _("Read block failed! ERR=%s\n"), strerror(dev->dev_errno));
+ Pmsg2(0, _("Read block %d failed! ERR=%s\n"), i, be.strerror(dev->dev_errno));
goto bail_out;
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
goto bail_out;
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
- Pmsg1(0, _("Read record failed! ERR=%s\n"), strerror(dev->dev_errno));
+ berrno be;
+ Pmsg2(0, _("Read record failed. Block %d! ERR=%s\n"), i, be.strerror(dev->dev_errno));
goto bail_out;
}
p = (int *)rec->data;
goto bail_out;
}
p = (int *)rec->data;
int recno = 0;
int file = 0, blk = 0;
int *p;
int recno = 0;
int file = 0, blk = 0;
int *p;
Pmsg0(-1, _("\n=== Write, rewind, and position test ===\n\n"
"I'm going to write 1000 records and an EOF\n"
Pmsg0(-1, _("\n=== Write, rewind, and position test ===\n\n"
"I'm going to write 1000 records and an EOF\n"
}
read_again:
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
}
read_again:
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
if (dev_state(dev, ST_EOF)) {
Pmsg0(-1, _("Got EOF on tape.\n"));
if (dev_state(dev, ST_EOF)) {
Pmsg0(-1, _("Got EOF on tape.\n"));
+ if (!got_eof) {
+ got_eof = true;
+ goto read_again;
+ }
- Pmsg1(0, _("Read block failed! ERR=%s\n\n"), strerror(dev->dev_errno));
+ Pmsg4(0, _("Read block %d failed! file=%d blk=%d. ERR=%s\n\n"),
+ recno, file, blk, be.strerror(dev->dev_errno));
Pmsg0(0, _("This may be because the tape drive block size is not\n"
" set to variable blocking as normally used by Bacula.\n"
" Please see the Tape Testing chapter in the manual and \n"
Pmsg0(0, _("This may be because the tape drive block size is not\n"
" set to variable blocking as normally used by Bacula.\n"
" Please see the Tape Testing chapter in the manual and \n"
- " look for using mt with defblksize and setoptions\n"));
+ " look for using mt with defblksize and setoptions\n"
+ "If your tape drive block size is correct, then perhaps\n"
+ " your SCSI driver is *really* stupid and does not\n"
+ " correctly report the file:block after a FSF. In this\n"
+ " case try setting:\n"
+ " Fast Forward Space File = no\n"
+ " in your Device resource.\n"));
+
goto bail_out;
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
goto bail_out;
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
- Pmsg1(0, _("Read record failed! ERR=%s\n"), strerror(dev->dev_errno));
+ berrno be;
+ Pmsg1(0, _("Read record failed! ERR=%s\n"), be.strerror(dev->dev_errno));
goto bail_out;
}
p = (int *)rec->data;
goto bail_out;
}
p = (int *)rec->data;
- Pmsg0(-1, _("Block re-read correctly.\n"));
+ Pmsg1(-1, _("Block %d re-read correctly.\n"), recno);
}
Pmsg0(-1, _("=== Test Succeeded. End Write, rewind, and re-read test ===\n\n"));
stat = 1;
}
Pmsg0(-1, _("=== Test Succeeded. End Write, rewind, and re-read test ===\n\n"));
stat = 1;
}
mt_com.mt_op = MTFSF;
/*
}
mt_com.mt_op = MTFSF;
/*
- * ***FIXEM*** fix code to handle case that INT16_MAX is
+ * ***FIXME*** fix code to handle case that INT16_MAX is
* not large enough.
*/
mt_com.mt_count = INT16_MAX; /* use big positive number */
* not large enough.
*/
mt_com.mt_count = INT16_MAX; /* use big positive number */
if (file_num == (int)dev->file) {
struct mtget mt_stat;
Dmsg1(100, "fsf_dev did not advance from file %d\n", file_num);
if (file_num == (int)dev->file) {
struct mtget mt_stat;
Dmsg1(100, "fsf_dev did not advance from file %d\n", file_num);
if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 &&
mt_stat.mt_fileno >= 0) {
Dmsg2(100, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno);
dev->file = mt_stat.mt_fileno;
}
if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 &&
mt_stat.mt_fileno >= 0) {
Dmsg2(100, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno);
dev->file = mt_stat.mt_fileno;
}
stat = 0;
break; /* we are not progressing, bail out */
}
stat = 0;
break; /* we are not progressing, bail out */
}
stat = bsf_dev(dev, 1);
/* If BSF worked and fileno is known (not -1), set file */
if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) {
stat = bsf_dev(dev, 1);
/* If BSF worked and fileno is known (not -1), set file */
if (ioctl(dev->fd, MTIOCGET, (char *)&mt_stat) == 0 && mt_stat.mt_fileno >= 0) {
- Dmsg2(100, "Adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno);
+ Dmsg2(100, "BSFATEOF adjust file from %d to %d\n", dev->file , mt_stat.mt_fileno);
dev->file = mt_stat.mt_fileno;
} else {
dev->file++; /* wing it -- not correct on all OSes */
dev->file = mt_stat.mt_fileno;
} else {
dev->file++; /* wing it -- not correct on all OSes */
Dmsg0(200, "ST_EOF set on entry to FSF\n");
}
Dmsg0(200, "ST_EOF set on entry to FSF\n");
}
- Dmsg0(29, "fsf_dev\n");
+ Dmsg0(100, "fsf_dev\n");
dev->block_num = 0;
/*
* If Fast forward space file is set, then we
* use MTFSF to forward space and MTIOCGET
* to get the file position. We assume that
* the SCSI driver will ensure that we do not
dev->block_num = 0;
/*
* If Fast forward space file is set, then we
* use MTFSF to forward space and MTIOCGET
* to get the file position. We assume that
* the SCSI driver will ensure that we do not
- * forward space over the end of data mark.
+ * forward space past the end of the medium.
*/
if (dev_cap(dev, CAP_FSF) && dev_cap(dev, CAP_FASTFSF)) {
mt_com.mt_op = MTFSF;
*/
if (dev_cap(dev, CAP_FSF) && dev_cap(dev, CAP_FASTFSF)) {
mt_com.mt_op = MTFSF;
mt_com.mt_op = MTFSF;
mt_com.mt_count = 1;
while (num-- && !(dev->state & ST_EOT)) {
mt_com.mt_op = MTFSF;
mt_com.mt_count = 1;
while (num-- && !(dev->state & ST_EOT)) {
- Dmsg0(200, "Doing read before fsf\n");
+ Dmsg0(100, "Doing read before fsf\n");
if ((stat = read(dev->fd, (char *)rbuf, rbuf_len)) < 0) {
if (errno == ENOMEM) { /* tape record exceeds buf len */
stat = rbuf_len; /* This is OK */
if ((stat = read(dev->fd, (char *)rbuf, rbuf_len)) < 0) {
if (errno == ENOMEM) { /* tape record exceeds buf len */
stat = rbuf_len; /* This is OK */
berrno be;
dev->state |= ST_EOT;
clrerror_dev(dev, -1);
berrno be;
dev->state |= ST_EOT;
clrerror_dev(dev, -1);
- Dmsg2(200, "Set ST_EOT read errno=%d. ERR=%s\n", dev->dev_errno,
+ Dmsg2(100, "Set ST_EOT read errno=%d. ERR=%s\n", dev->dev_errno,
be.strerror());
Mmsg2(dev->errmsg, _("read error on %s. ERR=%s.\n"),
dev->dev_name, be.strerror());
be.strerror());
Mmsg2(dev->errmsg, _("read error on %s. ERR=%s.\n"),
dev->dev_name, be.strerror());
- Dmsg1(200, "%s", dev->errmsg);
+ Dmsg1(100, "%s", dev->errmsg);
break;
}
}
if (stat == 0) { /* EOF */
update_pos_dev(dev);
break;
}
}
if (stat == 0) { /* EOF */
update_pos_dev(dev);
- Dmsg1(200, "End of File mark from read. File=%d\n", dev->file+1);
+ Dmsg1(100, "End of File mark from read. File=%d\n", dev->file+1);
/* Two reads of zero means end of tape */
if (dev->state & ST_EOF) {
dev->state |= ST_EOT;
/* Two reads of zero means end of tape */
if (dev->state & ST_EOF) {
dev->state |= ST_EOT;
- Dmsg0(200, "Set ST_EOT\n");
+ Dmsg0(100, "Set ST_EOT\n");
break;
} else {
dev->state |= ST_EOF;
break;
} else {
dev->state |= ST_EOF;
dev->state &= ~(ST_EOF|ST_EOT);
}
dev->state &= ~(ST_EOF|ST_EOT);
}
- Dmsg0(200, "Doing MTFSF\n");
+ Dmsg0(100, "Doing MTFSF\n");
stat = ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
if (stat < 0) { /* error => EOT */
berrno be;
dev->state |= ST_EOT;
stat = ioctl(dev->fd, MTIOCTOP, (char *)&mt_com);
if (stat < 0) { /* error => EOT */
berrno be;
dev->state |= ST_EOT;
- Dmsg0(200, "Set ST_EOT\n");
+ Dmsg0(100, "Set ST_EOT\n");
clrerror_dev(dev, MTFSF);
Mmsg2(&dev->errmsg, _("ioctl MTFSF error on %s. ERR=%s.\n"),
dev->dev_name, be.strerror());
clrerror_dev(dev, MTFSF);
Mmsg2(&dev->errmsg, _("ioctl MTFSF error on %s. ERR=%s.\n"),
dev->dev_name, be.strerror());
- Dmsg0(200, "Got < 0 for MTFSF\n");
- Dmsg1(200, "%s", dev->errmsg);
+ Dmsg0(100, "Got < 0 for MTFSF\n");
+ Dmsg1(100, "%s", dev->errmsg);
} else {
dev->state |= ST_EOF; /* just read EOF */
dev->file++;
} else {
dev->state |= ST_EOF; /* just read EOF */
dev->file++;
struct mtget mt_stat;
clrerror_dev(dev, MTFSR);
Dmsg1(100, "FSF fail: ERR=%s\n", be.strerror());
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 = mt_stat.mt_fileno;
dev->block_num = mt_stat.mt_blkno;
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 = mt_stat.mt_fileno;
dev->block_num = mt_stat.mt_blkno;
if (dev->state & ST_EOF) {
dev->state |= ST_EOT;
} else {
if (dev->state & ST_EOF) {
dev->state |= ST_EOT;
} else {
if (file > dev->file) {
Dmsg1(100, "fsf %d\n", file-dev->file);
if (!fsf_dev(dev, file-dev->file)) {
if (file > dev->file) {
Dmsg1(100, "fsf %d\n", file-dev->file);
if (!fsf_dev(dev, file-dev->file)) {
+ Dmsg1(100, "fsf failed! ERR=%s\n", strerror_dev(dev));
+ Dmsg2(100, "wanted_file=%d at_file=%d\n", file, dev->file);
}
if (block < dev->block_num) {
}
if (block < dev->block_num) {
+ Dmsg2(100, "wanted_blk=%d at_blk=%d\n", block, dev->block_num);
+ Dmsg0(100, "bsf_dev 1\n");
+ Dmsg0(100, "fsf_dev 1\n");
+ Dmsg2(100, "wanted_blk=%d at_blk=%d\n", block, dev->block_num);
}
if (dev_cap(dev, CAP_POSITIONBLOCKS) && block > dev->block_num) {
/* Ignore errors as Bacula can read to the correct block */
}
if (dev_cap(dev, CAP_POSITIONBLOCKS) && block > dev->block_num) {
/* Ignore errors as Bacula can read to the correct block */