From: Eric Bollengier Date: Thu, 25 May 2023 12:42:44 +0000 (+0200) Subject: Fix issue with data spooling introduced in 16.0 X-Git-Tag: Beta-15.0.0~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb8b7ebdf93bf821dd8f08e8abf2ef12a23986c2;p=thirdparty%2Fbacula.git Fix issue with data spooling introduced in 16.0 --- diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index fe5b8eed2..f5f47fb24 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -2,6 +2,7 @@ Bacula(R) - The Network Backup Solution Copyright (C) 2000-2023 Kern Sibbald + All rights reserved. The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -238,8 +239,8 @@ static bool despool_data(DCR *dcr, bool commit) rdev->device = dcr->dev->device; rdcr = new_dcr(jcr, NULL, rdev, SD_READ); rdcr->spool_fd = dcr->spool_fd; - block = rdcr->block; /* save block */ - rdcr->block = dcr->block; /* make read and write block the same */ + block = dcr->block; /* save block */ + dcr->block = rdcr->block; /* make read and write block the same */ Dmsg1(800, "read/write block size = %d\n", block->buf_len); lseek(rdcr->spool_fd, 0, SEEK_SET); /* rewind */ @@ -302,7 +303,7 @@ static bool despool_data(DCR *dcr, bool commit) despool_elapsed / 3600, despool_elapsed % 3600 / 60, despool_elapsed % 60, edit_uint64_with_suffix(jcr->dcr->job_spool_size / despool_elapsed, ec1)); - rdcr->block = block; /* reset block */ + dcr->block = block; /* reset block */ #if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED) posix_fadvise(rdcr->spool_fd, 0, 0, POSIX_FADV_DONTNEED); @@ -437,6 +438,7 @@ bool write_block_to_spool_file(DCR *dcr) if (block->binbuf <= WRITE_BLKHDR_LENGTH) { /* Does block have data in it? */ return true; } + hlen = sizeof(spool_hdr); wlen = block->binbuf; P(dcr->dev->spool_mutex);