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