From 78d4fcb723bf780023451391c9536c6f7e9fbf00 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 9 Jun 2017 08:28:37 +0200 Subject: [PATCH] Use one MAX_BLOCK_SIZE and set to 20M --- bacula/src/stored/block.h | 2 +- bacula/src/stored/block_util.c | 2 +- bacula/src/stored/init_dev.c | 4 ++-- bacula/src/stored/record_read.c | 4 ++-- bacula/src/stored/stored_conf.c | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bacula/src/stored/block.h b/bacula/src/stored/block.h index 1e126823db..6b23d3ebe3 100644 --- a/bacula/src/stored/block.h +++ b/bacula/src/stored/block.h @@ -26,7 +26,7 @@ #ifndef __BLOCK_H #define __BLOCK_H 1 -#define MAX_BLOCK_LENGTH 20000000 /* this is a sort of sanity check */ +#define MAX_BLOCK_SIZE 20000000 /* this is a sort of sanity check */ #define DEFAULT_BLOCK_SIZE (512 * 126) /* 64,512 N.B. do not use 65,636 here */ #define MIN_DEDUP_BLOCK_SIZE (512 * 2) /* Minimum block (bucket) size */ diff --git a/bacula/src/stored/block_util.c b/bacula/src/stored/block_util.c index e18605345f..ed18bd8573 100644 --- a/bacula/src/stored/block_util.c +++ b/bacula/src/stored/block_util.c @@ -434,7 +434,7 @@ bool unser_block_header(DCR *dcr, DEVICE *dev, DEV_BLOCK *block) } /* Sanity check */ - if (block_len > MAX_BLOCK_LENGTH) { + if (block_len > MAX_BLOCK_SIZE) { dev->dev_errno = EIO; Mmsg3(dev->errmsg, _("Volume data error at %u:%u! Block length %u is insane (too large), probably due to a bad archive.\n"), dev->file, dev->block_num, block_len); diff --git a/bacula/src/stored/init_dev.c b/bacula/src/stored/init_dev.c index 01d6eb6f5f..9f4999a89e 100644 --- a/bacula/src/stored/init_dev.c +++ b/bacula/src/stored/init_dev.c @@ -312,10 +312,10 @@ void DEVICE::device_generic_init(JCR *jcr, DEVRES *device) Jmsg(jcr, M_ERROR_TERM, 0, _("[SA0005] Min block size > max on device %s\n"), dev->print_name()); } - if (dev->max_block_size > 4096000) { + if (dev->max_block_size > MAX_BLOCK_SIZE) { Jmsg3(jcr, M_ERROR, 0, _("[SA0006] 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; + dev->max_block_size = DEFAULT_BLOCK_SIZE ; } if (dev->max_block_size % TAPE_BSIZE != 0) { Jmsg3(jcr, M_WARNING, 0, _("[SW0007] Max block size %u not multiple of device %s block size=%d.\n"), diff --git a/bacula/src/stored/record_read.c b/bacula/src/stored/record_read.c index a08acbe2f7..3fd1f04432 100644 --- a/bacula/src/stored/record_read.c +++ b/bacula/src/stored/record_read.c @@ -159,7 +159,7 @@ static bool read_header(DCR *dcr, DEV_BLOCK *block, DEV_RECORD *rec) } /* Sanity check */ - if (rec->data_bytes >= MAX_BLOCK_LENGTH) { + if (rec->data_bytes >= MAX_BLOCK_SIZE) { Dmsg0(dbgep, "=== rpath 11b maxlen too big\n"); /* * Something is wrong, force read of next block, abort @@ -168,7 +168,7 @@ static bool read_header(DCR *dcr, DEV_BLOCK *block, DEV_RECORD *rec) rec->state_bits |= (REC_NO_HEADER | REC_BLOCK_EMPTY); empty_block(block); Jmsg2(dcr->jcr, M_WARNING, 0, _("Sanity check failed. maxlen=%d datalen=%d. Block discarded.\n"), - MAX_BLOCK_LENGTH, rec->data_bytes); + MAX_BLOCK_SIZE, rec->data_bytes); return false; } diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index 43a47d9a2a..19997f8c6a 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -439,15 +439,15 @@ void store_uri_style(LEX *lc, RES_ITEM *item, int index, int pass) /* - * Store Maximum Block Size, and check it is not greater than MAX_BLOCK_LENGTH + * Store Maximum Block Size, and check it is not greater than MAX_BLOCK_SIZE * */ void store_maxblocksize(LEX *lc, RES_ITEM *item, int index, int pass) { store_size32(lc, item, index, pass); - if (*(uint32_t *)(item->value) > MAX_BLOCK_LENGTH) { + if (*(uint32_t *)(item->value) > MAX_BLOCK_SIZE) { scan_err2(lc, _("Maximum Block Size configured value %u is greater than allowed maximum: %u"), - *(uint32_t *)(item->value), MAX_BLOCK_LENGTH ); + *(uint32_t *)(item->value), MAX_BLOCK_SIZE ); } } -- 2.39.5