]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.2.8-jobmedia.patch
497c9c7dba82bb5cc99e8ba9e0726c12456eaf86
[bacula/bacula] / bacula / patches / 2.2.8-jobmedia.patch
1
2  This patch fixes a migration bug that always has a zero index entry
3  (JobMedia record) as the first entry. This causes Bacula to search
4  for the first record during a restore rather than seek directly to
5  it.
6
7  Apply this patch to Bacula 2.2.8 (and possibly any prior 2.2.x version) with:
8
9  cd <bacula-source>
10  patch -p0 <2.2.8-jobmedia.patch
11  ./configure <your-options>
12  make
13  ...
14  make install
15
16
17 Index: src/stored/device.c
18 ===================================================================
19 --- src/stored/device.c (revision 6391)
20 +++ src/stored/device.c (working copy)
21 @@ -1,7 +1,7 @@
22  /*
23     Bacula® - The Network Backup Solution
24  
25 -   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
26 +   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
27  
28     The main author of Bacula is Kern Sibbald, with contributions from
29     many others, a complete list can be found in the file AUTHORS.
30 @@ -200,6 +200,19 @@
31     return ok;                               /* device locked */
32  }
33  
34 +void set_start_vol_position(DCR *dcr)
35 +{
36 +   DEVICE *dev = dcr->dev;
37 +   /* Set new start position */
38 +   if (dev->is_tape()) {
39 +      dcr->StartBlock = dev->block_num;
40 +      dcr->StartFile = dev->file;
41 +   } else {
42 +      dcr->StartBlock = (uint32_t)dev->file_addr;
43 +      dcr->StartFile  = (uint32_t)(dev->file_addr >> 32);
44 +   }
45 +}
46 +
47  /*
48   * We have a new Volume mounted, so reset the Volume parameters
49   *  concerning this job.  The global changes were made earlier
50 @@ -208,24 +221,11 @@
51  void set_new_volume_parameters(DCR *dcr)
52  {
53     JCR *jcr = dcr->jcr;
54 -   DEVICE *dev = dcr->dev;
55     if (dcr->NewVol && !dir_get_volume_info(dcr, GET_VOL_INFO_FOR_WRITE)) {
56        Jmsg1(jcr, M_ERROR, 0, "%s", jcr->errmsg);
57     }
58 -   /* Set new start/end positions */
59 -   if (dev->is_tape()) {
60 -      dcr->StartBlock = dev->block_num;
61 -      dcr->StartFile = dev->file;
62 -   } else {
63 -      dcr->StartBlock = (uint32_t)dev->file_addr;
64 -      dcr->StartFile  = (uint32_t)(dev->file_addr >> 32);
65 -   }
66 -   /* Reset indicies */
67 -   dcr->VolFirstIndex = 0;
68 -   dcr->VolLastIndex = 0;
69 +   set_new_file_parameters(dcr);
70     jcr->NumWriteVolumes++;
71 -   dcr->NewVol = false;
72 -   dcr->WroteVol = false;
73  }
74  
75  /*
76 @@ -235,16 +235,8 @@
77   */
78  void set_new_file_parameters(DCR *dcr)
79  {
80 -   DEVICE *dev = dcr->dev;
81 +   set_start_vol_position(dcr);
82  
83 -   /* Set new start/end positions */
84 -   if (dev->is_tape()) {
85 -      dcr->StartBlock = dev->block_num;
86 -      dcr->StartFile = dev->file;
87 -   } else {
88 -      dcr->StartBlock = (uint32_t)dev->file_addr;
89 -      dcr->StartFile  = (uint32_t)(dev->file_addr >> 32);
90 -   }
91     /* Reset indicies */
92     dcr->VolFirstIndex = 0;
93     dcr->VolLastIndex = 0;
94 Index: src/stored/mac.c
95 ===================================================================
96 --- src/stored/mac.c    (revision 6391)
97 +++ src/stored/mac.c    (working copy)
98 @@ -1,15 +1,7 @@
99  /*
100 - * SD -- mac.c --  responsible for doing
101 - *     migration, archive, and copy jobs.
102 - *
103 - *     Kern Sibbald, January MMVI
104 - *
105 - *   Version $Id$
106 - */
107 -/*
108     Bacula® - The Network Backup Solution
109  
110 -   Copyright (C) 2006-2006 Free Software Foundation Europe e.V.
111 +   Copyright (C) 2006-2008 Free Software Foundation Europe e.V.
112  
113     The main author of Bacula is Kern Sibbald, with contributions from
114     many others, a complete list can be found in the file AUTHORS.
115 @@ -33,6 +25,14 @@
116     (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
117     Switzerland, email:ftf@fsfeurope.org.
118  */
119 +/*
120 + * SD -- mac.c --  responsible for doing
121 + *     migration, archive, and copy jobs.
122 + *
123 + *     Kern Sibbald, January MMVI
124 + *
125 + *   Version $Id$
126 + */
127  
128  #include "bacula.h"
129  #include "stored.h"
130 @@ -108,6 +108,7 @@
131  
132     jcr->dcr->VolFirstIndex = jcr->dcr->VolLastIndex = 0;
133     jcr->run_time = time(NULL);
134 +   set_start_vol_position(jcr->dcr);
135  
136     ok = read_records(jcr->read_dcr, record_cb, mount_next_read_volume);
137     goto ok_out;
138 Index: src/stored/protos.h
139 ===================================================================
140 --- src/stored/protos.h (revision 6391)
141 +++ src/stored/protos.h (working copy)
142 @@ -126,6 +126,7 @@
143  bool     open_device(DCR *dcr);
144  bool     first_open_device(DCR *dcr);
145  bool     fixup_device_block_write_error(DCR *dcr);
146 +void     set_start_vol_position(DCR *dcr);
147  void     set_new_volume_parameters(DCR *dcr);
148  void     set_new_file_parameters(DCR *dcr);
149  bool     is_device_unmounted(DEVICE *dev);