From f2a56312a5730848b32d9248cd81ab2f1fd7e3da Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 20 Sep 2007 13:00:11 +0000 Subject: [PATCH] kes Fix ANSI tape labeling. This fixes bug #954. kes Increase the max block size to 4MB fixes bug #957. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5608 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dev.c | 13 ++++++++++++- bacula/src/stored/label.c | 5 +++-- bacula/technotes-2.3 | 5 ++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index d858e387c5..6a5eb392ec 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -109,6 +109,7 @@ init_dev(JCR *jcr, DEVRES *device) int errstat; DCR *dcr = NULL; DEVICE *dev; + uint32_t max_bs; /* If no device type specified, try to guess */ @@ -199,7 +200,17 @@ init_dev(JCR *jcr, DEVRES *device) } } - if (dev->max_block_size > 1000000) { + /* Sanity check */ + if (dev->max_block_size == 0) { + max_bs = DEFAULT_BLOCK_SIZE; + } else { + max_bs = dev->max_block_size; + } + if (dev->min_block_size > max_bs) { + Jmsg(jcr, M_ERROR_TERM, 0, _("Min block size > max on device %s\n"), + dev->print_name()); + } + if (dev->max_block_size > 4096000) { Jmsg3(jcr, M_ERROR, 0, _("Block size %u on device %s is too large, using default %u\n"), dev->max_block_size, dev->print_name(), DEFAULT_BLOCK_SIZE); dev->max_block_size = 0; diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 19ca8badcd..089da8ebbe 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -344,6 +344,9 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, } } + /* Temporarily mark in append state to enable writing */ + dev->set_append(); + /* Create PRE_LABEL or VOL_LABEL if DVD */ create_volume_label(dev, VolName, PoolName, dvdnow); @@ -364,8 +367,6 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, create_volume_label_record(dcr, dcr->rec); dcr->rec->Stream = 0; - /* Temporarily mark in append state to enable writing */ - dev->set_append(); if (!write_record_to_block(dcr->block, dcr->rec)) { Dmsg2(130, "Bad Label write on %s: ERR=%s\n", dev->print_name(), dev->print_errmsg()); goto bail_out; diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index febe9b21ac..30b0d05ea1 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,7 +1,10 @@ Technical notes on version 2.3 General: -0Sep07 +20Sep07 +kes Fix ANSI tape labeling. This fixes bug #954. +kes Increase the max block size to 4MB fixes bug #957. +kes ERABT if user sets min block size > max block size. Fixes bug #956. kes Apply 2.2.4-poll-mount fix, that resolves bug #908 where a tape is not properly mounted (recognized) during a poll. kes Apply 2.2.4-verify patch that resolves bug #958. A Verify catalog -- 2.39.5