X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fblock.c;h=5efc332669f878680dc1585a0a2cc6f80ec77757;hb=ada27b1a435802523f568fd94b81e393dcbabe71;hp=9bca599f841db99ac0fa1fbba09900dd6de71a71;hpb=47a7f2dd6cbb70e6bfdf4e4bac0160ddea3e7825;p=bacula%2Fbacula diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 9bca599f84..5efc332669 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2007 Free Software Foundation Europe e.V. + Copyright (C) 2001-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -374,7 +374,6 @@ bool write_block_to_device(DCR *dcr) if (dcr->NewVol) { /* Note, setting a new volume also handles any pending new file */ set_new_volume_parameters(dcr); - dcr->NewFile = false; /* this handled for new file too */ } else { set_new_file_parameters(dcr); } @@ -576,9 +575,12 @@ bool write_block_to_dev(DCR *dcr) dev->VolCatInfo.VolCatName, dev->file, dev->block_num, dev->print_name(), wlen, stat); } - Dmsg7(100, "=== Write error. fd=%d size=%u rtn=%d dev_blk=%d blk_blk=%d errno=%d: ERR=%s\n", - dev->fd(), wlen, stat, dev->block_num, block->BlockNumber, - dev->dev_errno, strerror(dev->dev_errno)); + if (debug_level >= 100) { + berrno be; + Dmsg7(100, "=== Write error. fd=%d size=%u rtn=%d dev_blk=%d blk_blk=%d errno=%d: ERR=%s\n", + dev->fd(), wlen, stat, dev->block_num, block->BlockNumber, + dev->dev_errno, be.bstrerror(dev->dev_errno)); + } ok = terminate_writing_volume(dcr); if (!ok && !forge_on) { @@ -702,6 +704,11 @@ static void reread_last_block(DCR *dcr) #endif } +/* + * If this routine is called, we do our bookkeeping and + * then assure that the volume will not be written any + * more. + */ static bool terminate_writing_volume(DCR *dcr) { DEVICE *dev = dcr->dev; @@ -743,7 +750,7 @@ static bool terminate_writing_volume(DCR *dcr) dev->VolCatInfo.VolCatParts = dev->num_dvd_parts; } - if (!dir_update_volume_info(dcr, false)) { + if (!dir_update_volume_info(dcr, false, true)) { ok = false; } Dmsg1(100, "dir_update_volume_info terminate writing -- %s\n", ok?"OK":"ERROR"); @@ -767,9 +774,10 @@ static bool terminate_writing_volume(DCR *dcr) /* This may not be fatal since we already wrote an EOF */ Jmsg(dcr->jcr, M_ERROR, 0, "%s", dev->errmsg); } + bail_out: dev->set_ateot(); /* no more writing this tape */ - Dmsg1(100, "Leave terminate_writing_volume -- %s\n", ok?"OK":"ERROR"); + Dmsg1(50, "*** Leave terminate_writing_volume -- %s\n", ok?"OK":"ERROR"); return ok; } @@ -794,7 +802,7 @@ static bool do_new_file_bookkeeping(DCR *dcr) return false; } dev->VolCatInfo.VolCatFiles = dev->file; - if (!dir_update_volume_info(dcr, false)) { + if (!dir_update_volume_info(dcr, false, false)) { Dmsg0(190, "Error from update_vol_info.\n"); terminate_writing_volume(dcr); dev->dev_errno = EIO; @@ -852,7 +860,7 @@ static bool do_dvd_size_checks(DCR *dcr) dev->VolCatInfo.VolCatParts = dev->num_dvd_parts; - if (!dir_update_volume_info(dcr, false)) { + if (!dir_update_volume_info(dcr, false, false)) { Dmsg0(190, "Error from update_vol_info.\n"); dev->dev_errno = EIO; return false;