} else if (S_ISCHR(statp.st_mode)) {
device->dev_type = B_TAPE_DEV;
} else if (S_ISFIFO(statp.st_mode)) {
- device->dev_type = B_FILE_DEV;
+ device->dev_type = B_FIFO_DEV;
} else if (!(device->cap_bits & CAP_REQMOUNT)) {
Jmsg2(jcr, M_ERROR, 0, _("%s is an unknown device type. Must be tape or directory\n"
" or have RequiresMount=yes for DVD. st_mode=%x\n"),
/*
* Avoid infinite loop by ensuring we advance.
*/
- if (file_num == (int)file) {
+ if (!at_eot() && file_num == (int)file) {
struct mtget mt_stat;
Dmsg1(100, "fsf did not advance from file %d\n", file_num);
set_ateof();
if (dev_get_os_pos(this, &mt_stat)) {
- Dmsg2(100, "Adjust file from %d to %d\n", file , mt_stat.mt_fileno);
+ Dmsg2(100, "Adjust file from %d to %d\n", file_num, mt_stat.mt_fileno);
file = mt_stat.mt_fileno;
}
break;
}
/* After this point, we are tape only */
- Dmsg4(100, "reposition from %u:%u to %u:%u\n",
- file, block_num, rfile, rblock);
+ Dmsg4(100, "reposition from %u:%u to %u:%u\n", file, block_num, rfile, rblock);
if (rfile < file) {
Dmsg0(100, "Rewind\n");
if (!rewind(NULL)) {
/* Ignore errors as Bacula can read to the correct block */
Dmsg1(100, "fsr %d\n", rblock-block_num);
return fsr(rblock-block_num);
+ } else {
+ while (rblock > block_num) {
+ if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
+ berrno be;
+ dev_errno = errno;
+ Dmsg2(30, "Failed to find requested block on %s: ERR=%s",
+ print_name(), be.strerror());
+ return false;
+ }
+ Dmsg2(300, "moving forward wanted_blk=%d at_blk=%d\n", rblock, block_num);
+ }
}
return true;
}
switch (dev_type) {
case B_TAPE_DEV:
- tape_close(fd);
unlock_door();
+ tape_close(fd);
break;
default:
::close(fd);
Technical notes on version 1.39
General:
+12Oct06
+kes Apply the three patches from Richard Mortimer.
+ bacula-reposition.patch, bacula-tape-reopen.patch, and
+ bacula-eod.patch. This corrects tape positioning on older devices,
+ and also a problem with btape.
+kes Apply fix from bug report #696 where writing to a FIFO does not
+ work due to a dumb typo.
+kes Unlock the tape door before the file descriptor is released. This
+ should fix lots of somewhat subtle failures when using an autochanger.
11Oct06
kes Correct mtx-changer bug that I introduced in a recent commit, and
pointed out by Robert Nelson -- thanks.