if (hit_max1 || hit_max2) {
char ed1[50];
uint64_t max_cap;
- dev->state |= ST_WEOT;
Dmsg0(10, "==== Output bytes Triggered medium max capacity.\n");
if (hit_max1) {
max_cap = dev->max_volume_size;
dev->EndFile = dev->file;
weof_dev(dev, 1); /* end the tape */
weof_dev(dev, 1); /* write second eof */
+ dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
return 0;
}
* conditions. In any case, we probably want to
* simulate an End of Medium.
*/
- dev->state |= ST_EOF | ST_EOT | ST_WEOT;
clrerror_dev(dev, -1);
if (dev->dev_errno == 0) {
dev->EndFile = dev->file;
weof_dev(dev, 1); /* end the tape */
weof_dev(dev, 1); /* write second eof */
+ dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
ok = TRUE;
#define CHECK_LAST_BLOCK
if (ok && bsr_dev(dev, 1) != 0) {
ok = FALSE;
Jmsg(jcr, M_ERROR, 0, _("Back space record at EOT failed. ERR=%s\n"), strerror(dev->dev_errno));
- /* ****FIXME*****
+ /*
* On FreeBSD systems, if the user got here, it is likely that his/her
* tape drive is "frozen". The correct thing to do is a
* rewind(), but if we do that, higher levels in cleaning up, will
* most likely write the EOS record over the beginning of the
* tape. The rewind *is* done later in mount.c when another
- * tape is requested. However, it should be done here. In that
- * case, we need to send back some fatal error status to avoid
- * future writes.
+ * tape is requested. Note, the clrerror_dev() call in bsr_dev()
+ * calls ioctl(MTCERRSTAT), which *should* fix the problem.
*/
}
if (ok) {
*/
static void record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
{
-
SESSION_LABEL label;
- if (stop > 1) { /* on second tape */
+
+ if (stop > 1 && !dumped) { /* on second tape */
+ dumped = 1;
+ dump_block(block, "First block on second tape");
Pmsg4(-1, "Blk: FileIndex=%d: block=%u size=%d vol=%s\n",
rec->FileIndex, block->BlockNumber, block->block_len, dev->VolHdr.VolName);
Pmsg6(-1, " Rec: VId=%d VT=%d FI=%s Strm=%s len=%d state=%x\n",
rec->VolSessionId, rec->VolSessionTime,
FI_to_ascii(rec->FileIndex), stream_to_ascii(rec->Stream, rec->FileIndex),
rec->data_len, rec->state);
-
- if (!dumped) {
- dumped = 1;
- dump_block(block, "Block not written to previous tape");
- }
}
if (rec->FileIndex < 0) {
if (verbose > 1) {
{
/* Read and clear SCSI error status */
union mterrstat mt_errstat;
+ Pmsg2(000, "Doing MTIOCERRSTAT errno=%d ERR=%s\n", dev->dev_errno,
+ strerror(dev->dev_errno));
ioctl(dev->fd, MTIOCERRSTAT, (char *)&mt_errstat);
}
#endif