]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/freebsd/pthreads-fix.txt
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / platforms / freebsd / pthreads-fix.txt
1 From bacula-users-admin@lists.sourceforge.net Mon Oct 20 23:44:13 2003
2 Return-Path: <bacula-users-admin@lists.sourceforge.net>
3 Received: from sc8-sf-list2.sourceforge.net (lists.sourceforge.net
4         [66.35.250.206]) by matou.sibbald.com (8.11.6/8.11.6) with ESMTP id
5         h9KLiDY13657 for <kern@sibbald.com>; Mon, 20 Oct 2003 23:44:13 +0200
6 Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13]
7         helo=sc8-sf-list1.sourceforge.net) by sc8-sf-list2.sourceforge.net with
8         esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 1ABhpS-00013k-00; Mon, 20 Oct 2003
9         14:44:42 -0700
10 Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.11]
11         helo=sc8-sf-mx1.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp
12          (Cipher TLSv1:DES-CBC3-SHA:168) (Exim 3.31-VA-mm2 #1 (Debian)) id
13         1ABhnp-0007qu-00 for <bacula-users@lists.sourceforge.net>; Mon, 20 Oct 2003
14         14:43:01 -0700
15 Received: from bast.unixathome.org ([66.11.174.150] ident=postfix) by
16         sc8-sf-mx1.sourceforge.net with esmtp (Exim 4.22) id 1ABfiR-0002Iv-Q8 for
17         bacula-users@lists.sourceforge.net; Mon, 20 Oct 2003 12:29:19 -0700
18 Received: from wocker (wocker.unixathome.org [192.168.0.99]) by
19         bast.unixathome.org (Postfix) with ESMTP id 258913F53 for
20         <bacula-users@lists.sourceforge.net>; Mon, 20 Oct 2003 15:25:33 -0400 (EDT)
21 From: "Dan Langille" <dan@langille.org>
22 To: bacula-users@lists.sourceforge.net
23 MIME-Version: 1.0
24 Message-ID: <3F93FF4E.14552.13ACB682@localhost>
25 Priority: normal
26 X-mailer: Pegasus Mail for Windows (v4.02a)
27 Content-type: text/plain; charset=US-ASCII
28 Content-description: Mail message body
29 X-Spam-Score: 0.0 (/)
30 X-Spam-Report: 0.0/5.0 Spam Filtering performed by sourceforge.net. See
31         http://spamassassin.org/tag/ for more details. Report problems to
32         https://sf.net/tracker/?func=add&group_id=1&atid=200001
33 Subject: [Bacula-users] FreeBSD - large backups to tape
34 Sender: bacula-users-admin@lists.sourceforge.net
35 Errors-To: bacula-users-admin@lists.sourceforge.net
36 X-BeenThere: bacula-users@lists.sourceforge.net
37 X-Mailman-Version: 2.0.9-sf.net
38 Precedence: bulk
39 List-Help: <mailto:bacula-users-request@lists.sourceforge.net?subject=help>
40 List-Post: <mailto:bacula-users@lists.sourceforge.net>
41 List-Subscribe:
42         <https://lists.sourceforge.net/lists/listinfo/bacula-users>,
43         <mailto:bacula-users-request@lists.sourceforge.net?subject=subscribe>
44 List-Id: Bacula user's email list for support and discussions
45         <bacula-users.lists.sourceforge.net>
46 List-Unsubscribe:
47         <https://lists.sourceforge.net/lists/listinfo/bacula-users>,
48         <mailto:bacula-users-request@lists.sourceforge.net?subject=unsubscribe>
49 List-Archive:
50         <http://sourceforge.net/mailarchive/forum.php?forum=bacula-users>
51 Date: Mon, 20 Oct 2003 15:29:18 -0400
52 Content-Transfer-Encoding: 8bit
53
54 Kern and I have been working on a FreeBSD/Bacula problem.  
55 He's asked me to post this to the list.  The problem was within the
56 FreeBSD pthreads library.  A solution has been found.
57
58 PROBLEM DESCRIPTION:
59
60 The FreeBSD pthreads library does not properly handle End Of Tape.
61 This problem will be fixed in FreeBSD 4.9.  The bug results in more
62 data being written to the tape than could be read.  Any backup which
63 involved more than one tape would be incomplete.
64
65 DEMONSTRATION:
66
67 To demonstrate the problem, tapetest.c can be obtained from 
68 http://www.freebsd.org/cgi/query-pr.cgi?pr=56274
69
70 This tests without pthreads:
71
72  *  If you build this program with:
73  *
74  *  c++ -g -O2 -Wall -c tapetest.c
75  *  c++ -g -O2 -Wall tapetest.o -o tapetest
76  *
77  *  Procedure for testing tape
78  *  ./tapetest /dev/your-tape-device
79  *  rewind
80  *  rawfill
81  *  rewind
82  *  scan
83  *
84  *  The output will be something like:
85  *
86  * ========
87  *  Rewound /dev/nsa0
88  *  *Begin writing blocks of 64512 bytes.
89  *  ++++++++++++++++++++ ...
90  *  Write failed.  Last block written=17294. stat=0 ERR=Unknown 
91 error: 0
92  *  weof_dev
93  *  Wrote EOF to /dev/nsa0
94  *  *Rewound /dev/nsa0
95  *  *Starting scan at file 0
96  *  17294 blocks of 64512 bytes in file 0
97  *  End of File mark.
98  *  End of File mark.
99  *  End of tape
100  *  Total files=1, blocks=17294, bytes = 1115670528
101  * ========
102  *
103  *  which is correct. Notice that the return status is
104  *  0, while in the example below, which fails, the return
105  *  status is -1.
106
107 This tests with pthreads:
108
109  *  If you build this program with:
110  *
111  *  c++ -g -O2 -Wall -pthread -c tapetest.c
112  *  c++ -g -O2 -Wall -pthread tapetest.o -o tapetest
113  *    Note, we simply added -pthread compared to the
114  *    previous example.
115  *
116  *  Procedure for testing tape
117  *  ./tapetest /dev/your-tape-device
118  *  rewind
119  *  rawfill
120  *  rewind
121  *  scan
122  *
123  *  The output will be something like:
124  *
125  * ========
126  *    Rewound /dev/nsa0
127  *    *Begin writing blocks of 64512 bytes.
128  *    +++++++++++++++++++++++++++++ ...
129  *    Write failed.  Last block written=17926. stat=-1 ERR=No space left on device
130  *    weof_dev
131  *    Wrote EOF to /dev/nsa0
132  *    *Rewound /dev/nsa0
133  *    *Starting scan at file 0
134  *    17913 blocks of 64512 bytes in file 0
135  *    End of File mark.
136  *    End of File mark.
137  *    End of tape
138  *    Total files=1, blocks=17913, bytes = 1155603456
139  * ========
140  *
141  * which is incroorect because it wrote 17,926 blocks but read
142  * back only 17,913 blocks
143
144 If you get the same number of blocks written and read WHEN using 
145 pthreads, then you've been correctly patched.
146
147 SOLUTION:
148
149 For FreeBSD prior to 4.9, you have two choices to ensure proper
150 backups.  These instructions assume you are familiar with patching
151 FreeBSD and already have the FreeBSD source code installed on your
152 machine.  
153
154 1 - cvsup and build your system to FreeBSD 4.8-STABLE
155
156 2 - Apply this patch.
157
158 http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc_r/uthread/uthread_write.c.diff?r1=1.16.2.6&r2=1.16.2.7
159
160 To apply the patch, follow these instructions as root.  
161
162 fetch -o pthread.diff http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc_r/uthread/uthread_write.c.diff?r1=1.16.2.6\&r2=1.16.2.7
163
164 cd /usr/src/lib/libc_r/uthread/
165 patch < /path/to/pthread.diff
166 cd ..
167 make all install
168
169 I recommend restarting Bacula.
170
171
172 TESTING:
173
174 I suggest running tapetest on your patched system and then
175 conducting a backup which spans two tapes.  Restore the data
176 and compare to the original.  If not identical, please let us know.
177
178 Thanks
179
180 -- 
181 Dan Langille : http://www.langille.org/
182
183
184
185 -------------------------------------------------------
186 This SF.net email is sponsored by OSDN developer relations
187 Here's your chance to show off your extensive product knowledge
188 We want to know what you know. Tell us and you have a chance to win $100
189 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
190 _______________________________________________
191 Bacula-users mailing list
192 Bacula-users@lists.sourceforge.net
193 https://lists.sourceforge.net/lists/listinfo/bacula-users