From 19c9de2cc8114e038117f708a80fb41c91059831 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 9 Sep 2007 13:23:21 +0000 Subject: [PATCH] 09Sep07 kes Fix bug #935, and probably also bug #903 where files were not restored. MediaId was not properly set in JobMedia record after a Volume change. 08Sep07 kes Suppress chown and chmod error messages if the FD is not running as root. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5505 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/askdir.c | 2 +- bacula/src/stored/block.c | 2 ++ bacula/src/stored/bscan.c | 3 +++ bacula/src/stored/dev.h | 1 + bacula/src/stored/fd_cmds.c | 28 ++++++++++++++-------------- bacula/technotes-2.3 | 4 ++++ 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index f6fd066898..e533d76f83 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -398,7 +398,7 @@ bool dir_create_jobmedia_record(DCR *dcr) dcr->StartFile, dcr->EndFile, dcr->StartBlock, dcr->EndBlock, dcr->Copy, dcr->Stripe, - edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1)); + edit_uint64(dcr->VolMediaId, ed1)); Dmsg1(100, ">dird: %s", dir->msg); if (bnet_recv(dir) <= 0) { Dmsg0(190, "create_jobmedia error bnet_recv\n"); diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 447d57b5da..eb16996014 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -611,6 +611,7 @@ bool write_block_to_dev(DCR *dcr) dev->block_num = dcr->EndBlock; dev->file = dcr->EndFile; } + dcr->VolMediaId = dev->VolCatInfo.VolMediaId; if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) { dcr->VolFirstIndex = block->FirstIndex; } @@ -1098,6 +1099,7 @@ reread: dev->block_num = dcr->EndBlock; dev->file = dcr->EndFile; } + dcr->VolMediaId = dev->VolCatInfo.VolMediaId; dev->file_addr += block->read_len; dev->file_size += block->read_len; diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 8efbac2f7e..71254e5bbf 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -326,6 +326,7 @@ static bool bscan_mount_next_read_volume(DCR *dcr) mdcr->StartFile = dcr->StartFile; mdcr->EndBlock = dcr->EndBlock; mdcr->EndFile = dcr->EndFile; + mdcr->VolMediaId = dcr->VolMediaId; mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex; if (!create_jobmedia_record(db, mjcr)) { Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"), @@ -476,6 +477,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) dcr->VolFirstIndex = dcr->FileIndex = 0; dcr->StartBlock = dcr->EndBlock = 0; dcr->StartFile = dcr->EndFile = 0; + dcr->VolMediaId = 0; } Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName); @@ -1177,6 +1179,7 @@ static int create_jobmedia_record(B_DB *db, JCR *mjcr) dcr->EndBlock = dev->EndBlock; dcr->EndFile = dev->EndFile; + dcr->VolMediaId = dev->VolCatInfo.VolMediaId; memset(&jmr, 0, sizeof(jmr)); jmr.JobId = mjcr->JobId; diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 39f4306b5d..f51f3ce160 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -447,6 +447,7 @@ public: uint32_t StartFile; /* Start write file */ uint32_t StartBlock; /* Start write block */ uint32_t EndBlock; /* Ending block written */ + int64_t VolMediaId; /* MediaId */ int64_t job_spool_size; /* Current job spool size */ int64_t max_job_spool_size; /* Max job spool size */ char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 1c16b0f24c..e6e35a0953 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -1,17 +1,3 @@ -/* - * This file handles commands from the File daemon. - * - * Kern Sibbald, MM - * - * We get here because the Director has initiated a Job with - * the Storage daemon, then done the same with the File daemon, - * then when the Storage daemon receives a proper connection from - * the File daemon, control is passed here to handle the - * subsequent File daemon commands. - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution @@ -39,6 +25,20 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * This file handles commands from the File daemon. + * + * Kern Sibbald, MM + * + * We get here because the Director has initiated a Job with + * the Storage daemon, then done the same with the File daemon, + * then when the Storage daemon receives a proper connection from + * the File daemon, control is passed here to handle the + * subsequent File daemon commands. + * + * Version $Id$ + * + */ #include "bacula.h" #include "stored.h" diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 5e2741d8d6..f25a2d15ed 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,10 @@ Technical notes on version 2.3 General: +09Sep07 +kes Fix bug #935, and probably also bug #903 where files were not + restored. MediaId was not properly set in JobMedia record after + a Volume change. 08Sep07 kes Suppress chown and chmod error messages if the FD is not running as root. -- 2.39.5