From 08c1016a80f84f5a5654d6eed6c180fb04b433bd Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 26 May 2003 13:35:56 +0000 Subject: [PATCH] More updates to btape fill command git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@547 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/block.c | 11 +++++------ bacula/src/stored/btape.c | 11 ++++------- bacula/src/stored/dev.c | 2 ++ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 18520cf21a..5e81ce5b87 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -347,7 +347,6 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) 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; @@ -361,6 +360,7 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) 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; } @@ -385,7 +385,6 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) * 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) { @@ -407,6 +406,7 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) 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 @@ -428,15 +428,14 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *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) { diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index e6a671801e..c20fad8df7 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -1351,20 +1351,17 @@ bail_out: */ 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) { diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 091382b6da..104e70cbf0 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -1040,6 +1040,8 @@ clrerror_dev(DEVICE *dev, int func) { /* 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 -- 2.39.5