]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.4.x/2.4.4-winvss.patch
Tweak keep readall error messages
[bacula/bacula] / bacula / patches / 2.4.x / 2.4.4-winvss.patch
1
2  This patch is fixes Fix bug #1246 Sometimes access with 
3  VSS enabled. UCS conversion cache was not properly flushed 
4  at the end of a Job.
5
6  Apply it to version 2.4.4 with:
7
8  cd <bacula-source>
9  patch -p0 <2.4.4-winvss.patch
10  ./configure <your options>
11  make
12  ...
13  make install
14
15
16 Index: src/filed/job.c
17 ===================================================================
18 --- src/filed/job.c     (revision 8733)
19 +++ src/filed/job.c     (working copy)
20 @@ -1,7 +1,7 @@
21  /*
22     Bacula® - The Network Backup Solution
23  
24 -   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
25 +   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
26  
27     The main author of Bacula is Kern Sibbald, with contributions from
28     many others, a complete list can be found in the file AUTHORS.
29 @@ -41,7 +41,7 @@
30  #include "vss.h"
31  
32  static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER;
33 -static int enable_vss;
34 +static int enable_vss = 0;
35  #endif
36  
37  extern CLIENT *me;                    /* our client resource */
38 @@ -1422,7 +1422,7 @@
39                 /* inform user about writer states */
40                 for (i=0; i < (int)g_pVSSClient->GetWriterCount(); i++)                
41                    if (g_pVSSClient->GetWriterState(i) < 1) {
42 -                     Jmsg(jcr, M_WARNING, 0, _("VSS Writer (PrepareForBackup): %s\n"), g_pVSSClient->GetWriterInfo(i));                    
43 +                     Jmsg(jcr, M_WARNING, 0, _("VSS Writer (PrepareForBackup): %s\n"), g_pVSSClient->GetWriterInfo(i));
44                       jcr->Errors++;
45                    }                            
46              }
47 @@ -1506,6 +1506,7 @@
48              Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i));
49           }
50        }
51 +      Win32ConvCleanupCache();
52        V(vss_mutex);
53     }
54  #endif
55 Index: src/win32/Makefile
56 ===================================================================
57 --- src/win32/Makefile  (revision 8733)
58 +++ src/win32/Makefile  (working copy)
59 @@ -30,7 +30,7 @@
60  Makefile.inc: Makefile.inc.in
61         @echo Creating $@
62         $(ECHO_CMD)TOPDIR=`(cd ../../..;pwd)`; \
63 -       if test -e ../../../cross-tools/mingw32/bin/mingw32-gcc; then \
64 +       if test -e $${TOPDIR}/cross-tools/mingw32/bin/mingw32-gcc; then \
65                 BINDIR=$${TOPDIR}/cross-tools/mingw32/bin; \
66                 INCDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/include; \
67                 DLLDIR=$${TOPDIR}/cross-tools/mingw32/mingw32/bin; \
68 @@ -43,7 +43,7 @@
69                 echo "You must run build-win32-cross-tools and build-dependencies first.\n"; \
70                 exit 1; \
71         fi ; \
72 -       $(ECHO_CMD)BUILDDIR=`(pwd)`; \
73 +       BUILDDIR=`(pwd)`; \
74         sed \
75                 -e "s^@BUILDDIR@^$${BUILDDIR}^" \
76                 -e "s^@TOPDIR@^$${TOPDIR}^" \
77 Index: src/win32/compat/compat.cpp
78 ===================================================================
79 --- src/win32/compat/compat.cpp (revision 8733)
80 +++ src/win32/compat/compat.cpp (working copy)
81 @@ -1,7 +1,7 @@
82  /*
83     Bacula® - The Network Backup Solution
84  
85 -   Copyright (C) 2004-2008 Free Software Foundation Europe e.V.
86 +   Copyright (C) 2004-2009 Free Software Foundation Europe e.V.
87  
88     The main author of Bacula is Kern Sibbald, with contributions from
89     many others, a complete list can be found in the file AUTHORS.
90 @@ -51,8 +51,8 @@
91     conversion is called 3 times (lstat, attribs, open),
92     by using the cache this is reduced to 1 time */
93  
94 -static POOLMEM *g_pWin32ConvUTF8Cache = get_pool_memory(PM_FNAME);
95 -static POOLMEM *g_pWin32ConvUCS2Cache = get_pool_memory(PM_FNAME);
96 +static POOLMEM *g_pWin32ConvUTF8Cache = NULL;
97 +static POOLMEM *g_pWin32ConvUCS2Cache = NULL;
98  static DWORD g_dwWin32ConvUTF8strlen = 0;
99  static pthread_mutex_t Win32Convmutex = PTHREAD_MUTEX_INITIALIZER;
100  
101 @@ -69,8 +69,19 @@
102     g_pVSSPathConvertW = pPathConvertW;
103  }
104  
105 +static void Win32ConvInitCache()
106 +{
107 +   if (g_pWin32ConvUTF8Cache) {
108 +      return;
109 +   }
110 +   g_pWin32ConvUTF8Cache = get_pool_memory(PM_FNAME);
111 +   g_pWin32ConvUCS2Cache = get_pool_memory(PM_FNAME);
112 +}
113 +
114 +
115  void Win32ConvCleanupCache()
116  {
117 +   P(Win32Convmutex);
118     if (g_pWin32ConvUTF8Cache) {
119        free_pool_memory(g_pWin32ConvUTF8Cache);
120        g_pWin32ConvUTF8Cache = NULL;
121 @@ -82,6 +93,7 @@
122     }
123  
124     g_dwWin32ConvUTF8strlen = 0;
125 +   V(Win32Convmutex);
126  }
127  
128  
129 @@ -451,11 +463,14 @@
130     /* if we find the utf8 string in cache, we use the cached ucs2 version.
131        we compare the stringlength first (quick check) and then compare the content.            
132     */
133 -   if (g_dwWin32ConvUTF8strlen == strlen(pszUTF)) {
134 +   if (!g_pWin32ConvUTF8Cache) {
135 +      Win32ConvInitCache();
136 +   } else if (g_dwWin32ConvUTF8strlen == strlen(pszUTF)) {
137        if (bstrcmp(pszUTF, g_pWin32ConvUTF8Cache)) {
138 +         /* Return cached value */
139           int32_t nBufSize = sizeof_pool_memory(g_pWin32ConvUCS2Cache);
140           *pszUCS = check_pool_memory_size(*pszUCS, nBufSize);      
141 -         wcscpy((LPWSTR) *pszUCS, (LPWSTR) g_pWin32ConvUCS2Cache);
142 +         wcscpy((LPWSTR) *pszUCS, (LPWSTR)g_pWin32ConvUCS2Cache);
143           V(Win32Convmutex);
144           return nBufSize / sizeof (WCHAR);
145        }
146 @@ -477,7 +492,7 @@
147     wcscpy((LPWSTR) g_pWin32ConvUCS2Cache, (LPWSTR) *pszUCS);
148     
149     g_dwWin32ConvUTF8strlen = strlen(pszUTF);
150 -   g_pWin32ConvUTF8Cache = check_pool_memory_size(g_pWin32ConvUTF8Cache, g_dwWin32ConvUTF8strlen+1);
151 +   g_pWin32ConvUTF8Cache = check_pool_memory_size(g_pWin32ConvUTF8Cache, g_dwWin32ConvUTF8strlen+2);
152     bstrncpy(g_pWin32ConvUTF8Cache, pszUTF, g_dwWin32ConvUTF8strlen+1);
153     V(Win32Convmutex);
154  
155 Index: src/win32/Makefile.inc.in
156 ===================================================================
157 --- src/win32/Makefile.inc.in   (revision 8733)
158 +++ src/win32/Makefile.inc.in   (working copy)
159 @@ -11,9 +11,9 @@
160  
161  BUILDDIR := @BUILDDIR@
162  TOPDIR := @TOPDIR@
163 -DEPKGS := $(TOPDIR)/depkgs-mingw32
164 +DEPKGS := @TOPDIR@/depkgs-mingw32
165  
166 -DOCDIR := $(TOPDIR)/docs
167 +DOCDIR := @TOPDIR@/docs
168  BINDIR := ../release
169  LIBDIR := ../release
170  OBJDIR := .