Merge lp:~logan/ubuntu/raring/nbd/debian-merge into lp:ubuntu/raring/nbd
- Raring (13.04)
- debian-merge
- Merge into raring
Proposed by
Logan Rosen
Status: | Merged |
---|---|
Merged at revision: | 39 |
Proposed branch: | lp:~logan/ubuntu/raring/nbd/debian-merge |
Merge into: | lp:ubuntu/raring/nbd |
Diff against target: |
961 lines (+296/-153) 13 files modified
Makefile.am (+2/-1) Makefile.in (+3/-2) README.md (+0/-8) config.sub (+10/-1) configure (+10/-10) configure.ac (+1/-1) debian/changelog (+25/-0) debian/po/cs.po (+27/-24) man/nbd-client.8.in.sgml (+4/-3) man/nbd-client.8.sh.in (+4/-3) nbd-client.c (+49/-5) nbd-server.c (+131/-94) simple_test (+30/-1) |
To merge this branch: | bzr merge lp:~logan/ubuntu/raring/nbd/debian-merge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Holbach (community) | Approve | ||
Ubuntu branches | Pending | ||
Review via email: mp+138326@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2012-06-17 07:29:43 +0000 |
3 | +++ Makefile.am 2012-12-05 21:52:21 +0000 |
4 | @@ -3,7 +3,7 @@ |
5 | sbin_PROGRAMS = @NBD_CLIENT_NAME@ |
6 | EXTRA_PROGRAMS = nbd-client make-integrityhuge |
7 | TESTS_ENVIRONMENT=$(srcdir)/simple_test |
8 | -TESTS = cmd cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig #integrityhuge |
9 | +TESTS = cmd cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list #integrityhuge |
10 | check_PROGRAMS = nbd-tester-client |
11 | nbd_client_SOURCES = nbd-client.c cliserv.h |
12 | nbd_server_SOURCES = nbd-server.c cliserv.h lfs.h nbd.h |
13 | @@ -28,3 +28,4 @@ |
14 | integrity: |
15 | integrityhuge: |
16 | dirconfig: |
17 | +list: |
18 | |
19 | === modified file 'Makefile.in' |
20 | --- Makefile.in 2012-06-17 07:29:43 +0000 |
21 | +++ Makefile.in 2012-12-05 21:52:21 +0000 |
22 | @@ -58,7 +58,7 @@ |
23 | DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ |
24 | $(srcdir)/Makefile.in $(srcdir)/config.h.in \ |
25 | $(top_srcdir)/configure $(top_srcdir)/doc/Doxyfile.in \ |
26 | - config.guess config.sub depcomp install-sh missing |
27 | + ChangeLog config.guess config.sub depcomp install-sh missing |
28 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
29 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac |
30 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
31 | @@ -278,7 +278,7 @@ |
32 | SUBDIRS = man |
33 | sbin_PROGRAMS = @NBD_CLIENT_NAME@ |
34 | TESTS_ENVIRONMENT = $(srcdir)/simple_test |
35 | -TESTS = cmd cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig #integrityhuge |
36 | +TESTS = cmd cfg1 cfgmulti cfgnew cfgsize write flush integrity dirconfig list #integrityhuge |
37 | nbd_client_SOURCES = nbd-client.c cliserv.h |
38 | nbd_server_SOURCES = nbd-server.c cliserv.h lfs.h nbd.h |
39 | nbd_tester_client_SOURCES = nbd-tester-client.c cliserv.h netdb-compat.h |
40 | @@ -1079,6 +1079,7 @@ |
41 | integrity: |
42 | integrityhuge: |
43 | dirconfig: |
44 | +list: |
45 | |
46 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
47 | # Otherwise a system limit (for SysV at least) may be exceeded. |
48 | |
49 | === removed file 'README.md' |
50 | --- README.md 2012-05-25 10:30:54 +0000 |
51 | +++ README.md 1970-01-01 00:00:00 +0000 |
52 | @@ -1,8 +0,0 @@ |
53 | -# NBD 3.1.1 |
54 | - |
55 | -There isn't much difference between nbd-3.1 and nbd-3.1.1, except for: |
56 | - |
57 | -- I forgot to initialize a few variables, which meant that, depending on |
58 | - the platform, nbd-client would sometimes just not work |
59 | -- Compatibility was added back for platforms that don't yet support the |
60 | - `NI_NUMERICHOST` variable. |
61 | |
62 | === modified file 'config.sub' |
63 | --- config.sub 2012-05-15 21:58:25 +0000 |
64 | +++ config.sub 2012-12-05 21:52:21 +0000 |
65 | @@ -4,7 +4,7 @@ |
66 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, |
67 | # 2011, 2012 Free Software Foundation, Inc. |
68 | |
69 | -timestamp='2012-02-10' |
70 | +timestamp='2012-04-18' |
71 | |
72 | # This file is (in principle) common to ALL GNU software. |
73 | # The presence of a machine in this file suggests that SOME GNU software |
74 | @@ -225,6 +225,12 @@ |
75 | -isc*) |
76 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` |
77 | ;; |
78 | + -lynx*178) |
79 | + os=-lynxos178 |
80 | + ;; |
81 | + -lynx*5) |
82 | + os=-lynxos5 |
83 | + ;; |
84 | -lynx*) |
85 | os=-lynxos |
86 | ;; |
87 | @@ -1537,6 +1543,9 @@ |
88 | c4x-* | tic4x-*) |
89 | os=-coff |
90 | ;; |
91 | + hexagon-*) |
92 | + os=-elf |
93 | + ;; |
94 | tic54x-*) |
95 | os=-coff |
96 | ;; |
97 | |
98 | === modified file 'configure' |
99 | --- configure 2012-06-17 07:29:43 +0000 |
100 | +++ configure 2012-12-05 21:52:21 +0000 |
101 | @@ -1,6 +1,6 @@ |
102 | #! /bin/sh |
103 | # Guess values for system-dependent variables and create Makefiles. |
104 | -# Generated by GNU Autoconf 2.69 for nbd 3.1.1. |
105 | +# Generated by GNU Autoconf 2.69 for nbd 3.2. |
106 | # |
107 | # Report bugs to <wouter@debian.org>. |
108 | # |
109 | @@ -580,8 +580,8 @@ |
110 | # Identity of this package. |
111 | PACKAGE_NAME='nbd' |
112 | PACKAGE_TARNAME='nbd' |
113 | -PACKAGE_VERSION='3.1.1' |
114 | -PACKAGE_STRING='nbd 3.1.1' |
115 | +PACKAGE_VERSION='3.2' |
116 | +PACKAGE_STRING='nbd 3.2' |
117 | PACKAGE_BUGREPORT='wouter@debian.org' |
118 | PACKAGE_URL='' |
119 | |
120 | @@ -1291,7 +1291,7 @@ |
121 | # Omit some internal or obsolete options to make the list less imposing. |
122 | # This message is too long to be a string in the A/UX 3.1 sh. |
123 | cat <<_ACEOF |
124 | -\`configure' configures nbd 3.1.1 to adapt to many kinds of systems. |
125 | +\`configure' configures nbd 3.2 to adapt to many kinds of systems. |
126 | |
127 | Usage: $0 [OPTION]... [VAR=VALUE]... |
128 | |
129 | @@ -1361,7 +1361,7 @@ |
130 | |
131 | if test -n "$ac_init_help"; then |
132 | case $ac_init_help in |
133 | - short | recursive ) echo "Configuration of nbd 3.1.1:";; |
134 | + short | recursive ) echo "Configuration of nbd 3.2:";; |
135 | esac |
136 | cat <<\_ACEOF |
137 | |
138 | @@ -1463,7 +1463,7 @@ |
139 | test -n "$ac_init_help" && exit $ac_status |
140 | if $ac_init_version; then |
141 | cat <<\_ACEOF |
142 | -nbd configure 3.1.1 |
143 | +nbd configure 3.2 |
144 | generated by GNU Autoconf 2.69 |
145 | |
146 | Copyright (C) 2012 Free Software Foundation, Inc. |
147 | @@ -2115,7 +2115,7 @@ |
148 | This file contains any messages produced by compilers while |
149 | running configure, to aid debugging if configure makes a mistake. |
150 | |
151 | -It was created by nbd $as_me 3.1.1, which was |
152 | +It was created by nbd $as_me 3.2, which was |
153 | generated by GNU Autoconf 2.69. Invocation command line was |
154 | |
155 | $ $0 $@ |
156 | @@ -2930,7 +2930,7 @@ |
157 | |
158 | # Define the identity of the package. |
159 | PACKAGE='nbd' |
160 | - VERSION='3.1.1' |
161 | + VERSION='3.2' |
162 | |
163 | |
164 | cat >>confdefs.h <<_ACEOF |
165 | @@ -6665,7 +6665,7 @@ |
166 | # report actual input values of CONFIG_FILES etc. instead of their |
167 | # values after options handling. |
168 | ac_log=" |
169 | -This file was extended by nbd $as_me 3.1.1, which was |
170 | +This file was extended by nbd $as_me 3.2, which was |
171 | generated by GNU Autoconf 2.69. Invocation command line was |
172 | |
173 | CONFIG_FILES = $CONFIG_FILES |
174 | @@ -6731,7 +6731,7 @@ |
175 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
176 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
177 | ac_cs_version="\\ |
178 | -nbd config.status 3.1.1 |
179 | +nbd config.status 3.2 |
180 | configured by $0, generated by GNU Autoconf 2.69, |
181 | with options \\"\$ac_cs_config\\" |
182 | |
183 | |
184 | === modified file 'configure.ac' |
185 | --- configure.ac 2012-06-17 07:29:43 +0000 |
186 | +++ configure.ac 2012-12-05 21:52:21 +0000 |
187 | @@ -1,7 +1,7 @@ |
188 | dnl Configure script for NBD system |
189 | dnl (c) 1998 Martin Mares <mj@ucw.cz>, (c) 2000 Pavel Machek <pavel@ucw.cz>, |
190 | dnl (c) 2003-2006 Wouter Verhelst <wouter@debian.org> |
191 | -AC_INIT([nbd],[3.1.1],[wouter@debian.org]) |
192 | +AC_INIT([nbd],[3.2],[wouter@debian.org]) |
193 | AM_INIT_AUTOMAKE(foreign dist-bzip2) |
194 | AM_MAINTAINER_MODE |
195 | |
196 | |
197 | === modified file 'debian/changelog' |
198 | --- debian/changelog 2012-06-17 07:29:43 +0000 |
199 | +++ debian/changelog 2012-12-05 21:52:21 +0000 |
200 | @@ -1,3 +1,28 @@ |
201 | +nbd (1:3.2-1.1ubuntu1) raring; urgency=low |
202 | + |
203 | + * Merge from Debian unstable. Remaining changes: |
204 | + - Drop /etc/modprobe.d/nbd-client; the kernel default is already |
205 | + appropriate. Ubuntu-specific change. |
206 | + + Modify debian/nbd-client.dirs. |
207 | + + Remove debian/nbd-client.modprobe. |
208 | + |
209 | + -- Logan Rosen <logatronico@gmail.com> Wed, 05 Dec 2012 16:47:29 -0500 |
210 | + |
211 | +nbd (1:3.2-1.1) unstable; urgency=low |
212 | + |
213 | + * Non-maintainer upload. |
214 | + * Fix pending l10n issues. Debconf translations: |
215 | + * Czech (Miroslav Kure). Closes: #681702 |
216 | + |
217 | + -- Christian Perrier <bubulle@debian.org> Sun, 05 Aug 2012 09:49:21 +0200 |
218 | + |
219 | +nbd (1:3.2-1) unstable; urgency=low |
220 | + |
221 | + * New upstream release. Includes many stability fixes, so hopefully |
222 | + this will get a freeze exception. |
223 | + |
224 | + -- Wouter Verhelst <wouter@debian.org> Tue, 03 Jul 2012 16:53:20 -0600 |
225 | + |
226 | nbd (1:3.1.1-1ubuntu1) quantal; urgency=low |
227 | |
228 | * Merge from Debian unstable. (LP: #1014184) Remaining changes: |
229 | |
230 | === modified file 'debian/po/cs.po' |
231 | --- debian/po/cs.po 2011-01-26 15:59:24 +0000 |
232 | +++ debian/po/cs.po 2012-12-05 21:52:21 +0000 |
233 | @@ -16,7 +16,7 @@ |
234 | "Project-Id-Version: nbd\n" |
235 | "Report-Msgid-Bugs-To: nbd@packages.debian.org\n" |
236 | "POT-Creation-Date: 2011-01-05 18:59+0100\n" |
237 | -"PO-Revision-Date: 2010-08-05 22:51+0200\n" |
238 | +"PO-Revision-Date: 2012-07-15 20:23+0200\n" |
239 | "Last-Translator: Miroslav Kure <kurem@debian.cz>\n" |
240 | "Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n" |
241 | "Language: cs\n" |
242 | @@ -140,20 +140,18 @@ |
243 | #. Type: string |
244 | #. Description |
245 | #: ../nbd-client.templates:6001 |
246 | -#, fuzzy |
247 | -#| msgid "Hostname of the server (number: ${number})?" |
248 | msgid "Port or name for nbd export (number: ${number})?" |
249 | -msgstr "Jméno serveru (číslo ${number})?" |
250 | +msgstr "Port nebo jméno nbd exportu (číslo ${number})?" |
251 | |
252 | #. Type: string |
253 | #. Description |
254 | #: ../nbd-client.templates:6001 |
255 | -#, fuzzy |
256 | -#| msgid "Please enter the TCP port number to access nbd-server." |
257 | msgid "" |
258 | "Please enter the TCP port number or NBD export name needed to access nbd-" |
259 | "server." |
260 | -msgstr "Zadejte číslo TCP portu, které se použije pro přístup k nbd-serveru." |
261 | +msgstr "" |
262 | +"Zadejte číslo TCP portu nebo název NBD exportu, které se použije pro přístup " |
263 | +"k nbd-serveru." |
264 | |
265 | #. Type: string |
266 | #. Description |
267 | @@ -164,6 +162,9 @@ |
268 | "enter the TCP port number here, and should make sure not to enter any non-" |
269 | "numeric characters in the field." |
270 | msgstr "" |
271 | +"nbd-servery verze 2.9.16 a nižší nepodporovaly přístup přes jméno NBD " |
272 | +"exportu. Jestliže je váš NBD server starší verze, měli byste zde zadat pouze " |
273 | +"číslo TCP portu." |
274 | |
275 | #. Type: string |
276 | #. Description |
277 | @@ -174,6 +175,9 @@ |
278 | "this configuration system will accept that as a name and provide it to nbd-" |
279 | "client as a name-based export rather than a port-based one." |
280 | msgstr "" |
281 | +"Novější verze nbd-serveru podporují kromě čísla TCP portu i jméno exportu. " |
282 | +"Pokud so pole zadáte i jiný znak než číslici, bude to konfigurační systém " |
283 | +"považovat za název exportu a takto to i předá NBD klientovi." |
284 | |
285 | #. Type: string |
286 | #. Description |
287 | @@ -251,7 +255,7 @@ |
288 | "If you wish to add any extra parameters to nbd-client, then please enter " |
289 | "them here." |
290 | msgstr "" |
291 | -"Chcete-li si zadatf nbd-klientu dodatečné parametry, zadejte je prosím zde." |
292 | +"Chcete-li zadat nbd-klientu dodatečné parametry, zadejte je prosím zde." |
293 | |
294 | #. Type: string |
295 | #. Description |
296 | @@ -290,32 +294,24 @@ |
297 | #. Type: string |
298 | #. Description |
299 | #: ../nbd-server.templates:3001 |
300 | -#, fuzzy |
301 | -#| msgid "" |
302 | -#| "Please specify the TCP port this instance of nbd server will use for " |
303 | -#| "listening. As NBD is likely to use more than one port, no dedicated port " |
304 | -#| "has been assigned in IANA lists." |
305 | msgid "" |
306 | "Please specify the TCP port this instance of nbd server will use for " |
307 | "backwards compatibility with older clients." |
308 | msgstr "" |
309 | -"Zadejte TCP port, na kterém bude tato instance nbd-serveru naslouchat " |
310 | -"příchozím požadavkům. Protože je pravděpodobné, že bude NBD používat více " |
311 | -"než jeden port, nebyl mu v IANA registrech přiřazen specifický port." |
312 | +"Zadejte TCP port, který bude tato instance nbd-serveru používat pro zpětnou " |
313 | +"kompatibilitu se staršími klienty." |
314 | |
315 | #. Type: string |
316 | #. Description |
317 | #: ../nbd-server.templates:4001 |
318 | -#, fuzzy |
319 | -#| msgid "File to export (server number ${number}):" |
320 | msgid "Name of export ${number}:" |
321 | -msgstr "Soubor, který se má exportovat (server číslo ${number}):" |
322 | +msgstr "Název exportu ${number}:" |
323 | |
324 | #. Type: string |
325 | #. Description |
326 | #: ../nbd-server.templates:4001 |
327 | msgid "Please specify a name for this export." |
328 | -msgstr "" |
329 | +msgstr "Zadejte jméno tohoto exportu." |
330 | |
331 | #. Type: string |
332 | #. Description |
333 | @@ -409,8 +405,8 @@ |
334 | "current nbd-server package no longer supports this file and will not work if " |
335 | "it is kept as is." |
336 | msgstr "" |
337 | -"V systému byl nalezen konfigurační soubor nbd-serveru < 2...9. Současný " |
338 | -"balík nbd-server již tento soubor nepodporuje a pokud soubor nepřevedete na " |
339 | +"V systému byl nalezen konfigurační soubor nbd-serveru < 2.9. Současný balík " |
340 | +"nbd-server již tento soubor nepodporuje a pokud soubor nepřevedete na " |
341 | "novější formát, nebude nbd-server fungovat." |
342 | |
343 | #. Type: boolean |
344 | @@ -434,14 +430,14 @@ |
345 | "If a new-style configuration file already exists and you choose this option, " |
346 | "you will shortly see a \"modified configuration file\" prompt, as usual." |
347 | msgstr "" |
348 | -"Pokud již nový konfigurační soubor existuje a na tuto otázku povolíte " |
349 | +"Pokud již nový konfigurační soubor existuje a na tuto otázku odpovíte " |
350 | "kladně, zobrazí se klasická výzva „změněný konfigurační soubor“." |
351 | |
352 | #. Type: boolean |
353 | #. Description |
354 | #: ../nbd-server.templates:8001 |
355 | msgid "Support port-based exports?" |
356 | -msgstr "" |
357 | +msgstr "Podporovat exporty založené na portech?" |
358 | |
359 | #. Type: boolean |
360 | #. Description |
361 | @@ -453,6 +449,11 @@ |
362 | "a lot of trouble to update your older configurations in order to migrate to " |
363 | "name-based exports. In either of those cases, you should accept this option." |
364 | msgstr "" |
365 | +"Od verze 2.9.18 podporuje nbd-server exporty založené na jménech, které jsou " |
366 | +"preferovány před staršími exporty založenými na portech. Je však možné, že " |
367 | +"musíte podporovat nějaké starší nbd-klienty, nebo zrovna teď nechcete " |
368 | +"migrovat na exporty založené na jménech a aktualizovat své starší " |
369 | +"konfigurace. V obou případech byste měli tuto možnost přijmout." |
370 | |
371 | #. Type: boolean |
372 | #. Description |
373 | @@ -461,6 +462,8 @@ |
374 | "Everyone else should leave the option at the default setting, which will " |
375 | "cause nbd-server to only support name-based exports." |
376 | msgstr "" |
377 | +"Všichni ostatní by měli ponechat výchozí možnost a nechat nbd-server " |
378 | +"podporovat pouze exporty založené na jménech." |
379 | |
380 | #~ msgid "Port on which the nbd-server is running (number: ${number})?" |
381 | #~ msgstr "Port, na kterém běží nbd-server (číslo ${number})?" |
382 | |
383 | === modified file 'man/nbd-client.8.in.sgml' |
384 | --- man/nbd-client.8.in.sgml 2012-05-15 21:58:25 +0000 |
385 | +++ man/nbd-client.8.in.sgml 2012-12-05 21:52:21 +0000 |
386 | @@ -201,7 +201,7 @@ |
387 | <term><option>-S</option></term> |
388 | <listitem> |
389 | <para>Connect to the server using the Socket Direct Protocol |
390 | - (SDP), rather than IP. See nbd-server(1) for details. |
391 | + (SDP), rather than IP. See nbd-server(5) for details. |
392 | </para> |
393 | </listitem> |
394 | </varlistentry> |
395 | @@ -211,8 +211,9 @@ |
396 | <listitem> |
397 | <para>Specifies that this NBD device will be used as |
398 | swapspace. This option attempts to prevent deadlocks by |
399 | - performing mlockall() at an appropriate time. It does not |
400 | - however guarantee that such deadlocks can be avoided.</para> |
401 | + performing mlockall() and adjusting the oom-killer score |
402 | + at an appropriate time. It does not however guarantee |
403 | + that such deadlocks can be avoided.</para> |
404 | </listitem> |
405 | </varlistentry> |
406 | <varlistentry> |
407 | |
408 | === modified file 'man/nbd-client.8.sh.in' |
409 | --- man/nbd-client.8.sh.in 2012-06-17 07:29:43 +0000 |
410 | +++ man/nbd-client.8.sh.in 2012-12-05 21:52:21 +0000 |
411 | @@ -125,15 +125,16 @@ |
412 | .TP |
413 | \fB-S\fR |
414 | Connect to the server using the Socket Direct Protocol |
415 | -(SDP), rather than IP. See nbd-server(1) for details. |
416 | +(SDP), rather than IP. See nbd-server(5) for details. |
417 | .TP |
418 | \fB-swap\fR |
419 | .TP |
420 | \fB-s\fR |
421 | Specifies that this NBD device will be used as |
422 | swapspace. This option attempts to prevent deadlocks by |
423 | -performing mlockall() at an appropriate time. It does not |
424 | -however guarantee that such deadlocks can be avoided. |
425 | +performing mlockall() and adjusting the oom-killer score |
426 | +at an appropriate time. It does not however guarantee |
427 | +that such deadlocks can be avoided. |
428 | .TP |
429 | \fB-nofork\fR |
430 | .TP |
431 | |
432 | === modified file 'nbd-client.c' |
433 | --- nbd-client.c 2012-06-17 07:29:43 +0000 |
434 | +++ nbd-client.c 2012-12-05 21:52:21 +0000 |
435 | @@ -35,6 +35,7 @@ |
436 | #include <stdlib.h> |
437 | #include <sys/mount.h> |
438 | #include <sys/mman.h> |
439 | +#include <signal.h> |
440 | #include <errno.h> |
441 | #include <getopt.h> |
442 | #include <stdarg.h> |
443 | @@ -94,7 +95,7 @@ |
444 | if(e != 0) { |
445 | fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(e)); |
446 | freeaddrinfo(ai); |
447 | - exit(EXIT_FAILURE); |
448 | + return -1; |
449 | } |
450 | |
451 | if(sdp) { |
452 | @@ -118,8 +119,10 @@ |
453 | break; /* success */ |
454 | } |
455 | |
456 | - if (rp == NULL) |
457 | - err("Socket failed: %m"); |
458 | + if (rp == NULL) { |
459 | + err_nonfatal("Socket failed: %m"); |
460 | + return -1; |
461 | + } |
462 | |
463 | setmysockopt(sock); |
464 | |
465 | @@ -371,6 +374,21 @@ |
466 | mlockall(MCL_CURRENT | MCL_FUTURE); |
467 | } |
468 | |
469 | +static int |
470 | +oom_adjust(const char *file, const char *value) |
471 | +{ |
472 | + int fd, rc; |
473 | + size_t len; |
474 | + |
475 | + fd = open(file, O_WRONLY); |
476 | + if (fd < 0) |
477 | + return -1; |
478 | + len = strlen(value); |
479 | + rc = write(fd, value, len) != (ssize_t) len; |
480 | + close(fd); |
481 | + return rc ? -1 : 0; |
482 | +} |
483 | + |
484 | void usage(char* errmsg, ...) { |
485 | if(errmsg) { |
486 | char tmp[256]; |
487 | @@ -550,6 +568,8 @@ |
488 | } |
489 | |
490 | sock = opennet(hostname, port, sdp); |
491 | + if (sock < 0) |
492 | + exit(EXIT_FAILURE); |
493 | |
494 | negotiate(sock, &size64, &flags, name, needed_flags, cflags, opts); |
495 | |
496 | @@ -560,6 +580,13 @@ |
497 | setsizes(nbd, size64, blocksize, flags); |
498 | set_timeout(nbd, timeout); |
499 | finish_sock(sock, nbd, swap); |
500 | + if (swap) { |
501 | + /* try linux >= 2.6.36 interface first */ |
502 | + if (oom_adjust("/proc/self/oom_score_adj", "-1000")) { |
503 | + /* fall back to linux <= 2.6.35 interface */ |
504 | + oom_adjust("/proc/self/oom_adj", "-17"); |
505 | + } |
506 | + } |
507 | |
508 | /* Go daemon */ |
509 | |
510 | @@ -571,6 +598,16 @@ |
511 | #endif |
512 | do { |
513 | #ifndef NOFORK |
514 | +#ifdef SA_NOCLDWAIT |
515 | + struct sigaction sa; |
516 | + |
517 | + sa.sa_handler = SIG_DFL; |
518 | + sigemptyset(&sa.sa_mask); |
519 | + sa.sa_flags = SA_NOCLDWAIT; |
520 | + if (sigaction(SIGCHLD, &sa, NULL) < 0) |
521 | + err("sigaction: %m"); |
522 | +#endif |
523 | + |
524 | if (!fork()) { |
525 | /* Due to a race, the kernel NBD driver cannot |
526 | * call for a reread of the partition table |
527 | @@ -603,10 +640,17 @@ |
528 | u64 new_size; |
529 | u32 new_flags; |
530 | |
531 | - fprintf(stderr, " Reconnecting\n"); |
532 | close(sock); close(nbd); |
533 | - sock = opennet(hostname, port, sdp); |
534 | + for (;;) { |
535 | + fprintf(stderr, " Reconnecting\n"); |
536 | + sock = opennet(hostname, port, sdp); |
537 | + if (sock >= 0) |
538 | + break; |
539 | + sleep (1); |
540 | + } |
541 | nbd = open(nbddev, O_RDWR); |
542 | + if (nbd < 0) |
543 | + err("Cannot open NBD: %m"); |
544 | negotiate(sock, &new_size, &new_flags, name, needed_flags, cflags, opts); |
545 | if (size64 != new_size) { |
546 | err("Size of the device changed. Bye"); |
547 | |
548 | === modified file 'nbd-server.c' |
549 | --- nbd-server.c 2012-06-17 07:29:43 +0000 |
550 | +++ nbd-server.c 2012-12-05 21:52:21 +0000 |
551 | @@ -185,7 +185,7 @@ |
552 | #define NEG_OLD (1 << 1) |
553 | #define NEG_MODERN (1 << 2) |
554 | |
555 | -int modernsock=0; /**< Socket for the modern handler. Not used |
556 | +int modernsock=-1; /**< Socket for the modern handler. Not used |
557 | if a client was only specified on the |
558 | command line; only port used if |
559 | oldstyle is set to false (and then the |
560 | @@ -803,7 +803,7 @@ |
561 | case DT_REG: |
562 | /* Skip unless the name ends with '.conf' */ |
563 | if(strcmp((de->d_name + strlen(de->d_name) - 5), ".conf")) { |
564 | - continue; |
565 | + goto next; |
566 | } |
567 | tmp = parse_cfile(fname, FALSE, e); |
568 | errno=saved_errno; |
569 | @@ -1087,10 +1087,8 @@ |
570 | **/ |
571 | void killchild(gpointer key, gpointer value, gpointer user_data) { |
572 | pid_t *pid=value; |
573 | - int *parent=user_data; |
574 | |
575 | kill(*pid, SIGTERM); |
576 | - *parent=1; |
577 | } |
578 | |
579 | /** |
580 | @@ -1099,13 +1097,8 @@ |
581 | * is severely wrong). |
582 | **/ |
583 | void sigterm_handler(int s) { |
584 | - int parent=0; |
585 | - |
586 | - g_hash_table_foreach(children, killchild, &parent); |
587 | - |
588 | - if(parent) { |
589 | - unlink(pidfname); |
590 | - } |
591 | + g_hash_table_foreach(children, killchild, NULL); |
592 | + unlink(pidfname); |
593 | |
594 | exit(EXIT_SUCCESS); |
595 | } |
596 | @@ -2062,8 +2055,9 @@ |
597 | * @param client information about the client. The IP address in human-readable |
598 | * format will be written to a new char* buffer, the address of which will be |
599 | * stored in client->clientname. |
600 | + * @return: 0 - OK, -1 - failed. |
601 | **/ |
602 | -void set_peername(int net, CLIENT *client) { |
603 | +int set_peername(int net, CLIENT *client) { |
604 | struct sockaddr_storage addrin; |
605 | struct sockaddr_storage netaddr; |
606 | struct sockaddr_in *netaddr4 = NULL; |
607 | @@ -2078,13 +2072,15 @@ |
608 | int e; |
609 | int shift; |
610 | |
611 | - if (getpeername(net, (struct sockaddr *) &addrin, &addrinlen) < 0) |
612 | - err("getpeername failed: %m"); |
613 | + if (getpeername(net, (struct sockaddr *) &addrin, &addrinlen) < 0) { |
614 | + msg2(LOG_INFO, "getpeername failed: %m"); |
615 | + return -1; |
616 | + } |
617 | |
618 | if((e = getnameinfo((struct sockaddr *)&addrin, addrinlen, |
619 | peername, sizeof (peername), NULL, 0, NI_NUMERICHOST))) { |
620 | msg3(LOG_INFO, "getnameinfo failed: %s", gai_strerror(e)); |
621 | - freeaddrinfo(ai); |
622 | + return -1; |
623 | } |
624 | |
625 | memset(&hints, '\0', sizeof (hints)); |
626 | @@ -2094,23 +2090,27 @@ |
627 | if(e != 0) { |
628 | msg3(LOG_INFO, "getaddrinfo failed: %s", gai_strerror(e)); |
629 | freeaddrinfo(ai); |
630 | - return; |
631 | + return -1; |
632 | } |
633 | |
634 | switch(client->server->virtstyle) { |
635 | case VIRT_NONE: |
636 | + msg2(LOG_DEBUG, "virtualization is off"); |
637 | client->exportname=g_strdup(client->server->exportname); |
638 | break; |
639 | case VIRT_IPHASH: |
640 | + msg2(LOG_DEBUG, "virtstyle iphash"); |
641 | for(i=0;i<strlen(peername);i++) { |
642 | if(peername[i]=='.') { |
643 | peername[i]='/'; |
644 | } |
645 | } |
646 | case VIRT_IPLIT: |
647 | + msg2(LOG_DEBUG, "virststyle ipliteral"); |
648 | client->exportname=g_strdup_printf(client->server->exportname, peername); |
649 | break; |
650 | case VIRT_CIDR: |
651 | + msg3(LOG_DEBUG, "virtstyle cidr %d", client->server->cidrlen); |
652 | memcpy(&netaddr, &addrin, addrinlen); |
653 | if(ai->ai_family == AF_INET) { |
654 | netaddr4 = (struct sockaddr_in *)&netaddr; |
655 | @@ -2148,6 +2148,7 @@ |
656 | msg4(LOG_INFO, "connect from %s, assigned file is %s", |
657 | peername, client->exportname); |
658 | client->clientname=g_strdup(peername); |
659 | + return 0; |
660 | } |
661 | |
662 | /** |
663 | @@ -2158,6 +2159,95 @@ |
664 | g_free(data); |
665 | } |
666 | |
667 | +static void |
668 | +handle_connection(GArray *servers, int net, SERVER *serve, CLIENT *client) |
669 | +{ |
670 | + int sock_flags_old; |
671 | + int sock_flags_new; |
672 | + |
673 | + if(serve->max_connections > 0 && |
674 | + g_hash_table_size(children) >= serve->max_connections) { |
675 | + msg2(LOG_INFO, "Max connections reached"); |
676 | + goto handle_connection_out; |
677 | + } |
678 | + if((sock_flags_old = fcntl(net, F_GETFL, 0)) == -1) { |
679 | + err("fcntl F_GETFL"); |
680 | + } |
681 | + sock_flags_new = sock_flags_old & ~O_NONBLOCK; |
682 | + if (sock_flags_new != sock_flags_old && |
683 | + fcntl(net, F_SETFL, sock_flags_new) == -1) { |
684 | + err("fcntl F_SETFL ~O_NONBLOCK"); |
685 | + } |
686 | + if(!client) { |
687 | + client = g_new0(CLIENT, 1); |
688 | + client->server=serve; |
689 | + client->exportsize=OFFT_MAX; |
690 | + client->net=net; |
691 | + client->transactionlogfd = -1; |
692 | + } |
693 | + if (set_peername(net, client)) { |
694 | + goto handle_connection_out; |
695 | + } |
696 | + if (!authorized_client(client)) { |
697 | + msg2(LOG_INFO,"Unauthorized client") ; |
698 | + goto handle_connection_out; |
699 | + } |
700 | + msg2(LOG_INFO,"Authorized client") ; |
701 | + |
702 | + if (!dontfork) { |
703 | + pid_t pid; |
704 | + int i; |
705 | + sigset_t newset; |
706 | + sigset_t oldset; |
707 | + |
708 | + sigemptyset(&newset); |
709 | + sigaddset(&newset, SIGCHLD); |
710 | + sigaddset(&newset, SIGTERM); |
711 | + sigprocmask(SIG_BLOCK, &newset, &oldset); |
712 | + if ((pid = fork()) < 0) { |
713 | + msg3(LOG_INFO,"Could not fork (%s)",strerror(errno)) ; |
714 | + sigprocmask(SIG_SETMASK, &oldset, NULL); |
715 | + goto handle_connection_out; |
716 | + } |
717 | + if (pid > 0) { /* parent */ |
718 | + pid_t *pidp; |
719 | + |
720 | + pidp = g_malloc(sizeof(pid_t)); |
721 | + *pidp = pid; |
722 | + g_hash_table_insert(children, pidp, pidp); |
723 | + sigprocmask(SIG_SETMASK, &oldset, NULL); |
724 | + goto handle_connection_out; |
725 | + } |
726 | + /* child */ |
727 | + signal(SIGCHLD, SIG_DFL); |
728 | + signal(SIGTERM, SIG_DFL); |
729 | + sigprocmask(SIG_SETMASK, &oldset, NULL); |
730 | + |
731 | + g_hash_table_destroy(children); |
732 | + children = NULL; |
733 | + for(i=0;i<servers->len;i++) { |
734 | + serve=&g_array_index(servers, SERVER, i); |
735 | + close(serve->socket); |
736 | + } |
737 | + /* FALSE does not free the |
738 | + actual data. This is required, |
739 | + because the client has a |
740 | + direct reference into that |
741 | + data, and otherwise we get a |
742 | + segfault... */ |
743 | + g_array_free(servers, FALSE); |
744 | + close(modernsock); |
745 | + } |
746 | + |
747 | + msg2(LOG_INFO,"Starting to serve"); |
748 | + serveconnection(client); |
749 | + exit(EXIT_SUCCESS); |
750 | + |
751 | +handle_connection_out: |
752 | + g_free(client); |
753 | + close(net); |
754 | +} |
755 | + |
756 | /** |
757 | * Loop through the available servers, and serve them. Never returns. |
758 | **/ |
759 | @@ -2185,99 +2275,42 @@ |
760 | max=sock>max?sock:max; |
761 | } |
762 | } |
763 | - if(modernsock) { |
764 | + if(modernsock >= 0) { |
765 | FD_SET(modernsock, &mset); |
766 | max=modernsock>max?modernsock:max; |
767 | } |
768 | for(;;) { |
769 | - CLIENT *client = NULL; |
770 | - pid_t *pid; |
771 | - |
772 | memcpy(&rset, &mset, sizeof(fd_set)); |
773 | if(select(max+1, &rset, NULL, NULL, NULL)>0) { |
774 | - int net = 0; |
775 | - SERVER* serve=NULL; |
776 | + int net; |
777 | |
778 | DEBUG("accept, "); |
779 | - if(FD_ISSET(modernsock, &rset)) { |
780 | - if((net=accept(modernsock, (struct sockaddr *) &addrin, &addrinlen)) < 0) |
781 | - err("accept: %m"); |
782 | + if(modernsock >= 0 && FD_ISSET(modernsock, &rset)) { |
783 | + CLIENT *client; |
784 | + |
785 | + if((net=accept(modernsock, (struct sockaddr *) &addrin, &addrinlen)) < 0) { |
786 | + err_nonfatal("accept: %m"); |
787 | + continue; |
788 | + } |
789 | client = negotiate(net, NULL, servers, NEG_INIT | NEG_MODERN); |
790 | if(!client) { |
791 | err_nonfatal("negotiation failed"); |
792 | close(net); |
793 | - net=0; |
794 | continue; |
795 | } |
796 | - serve = client->server; |
797 | + handle_connection(servers, net, client->server, client); |
798 | } |
799 | - for(i=0;i<servers->len && !net;i++) { |
800 | + for(i=0; i < servers->len; i++) { |
801 | + SERVER *serve; |
802 | + |
803 | serve=&(g_array_index(servers, SERVER, i)); |
804 | if(FD_ISSET(serve->socket, &rset)) { |
805 | - if ((net=accept(serve->socket, (struct sockaddr *) &addrin, &addrinlen)) < 0) |
806 | - err("accept: %m"); |
807 | - } |
808 | - } |
809 | - if(net) { |
810 | - int sock_flags; |
811 | - |
812 | - if(serve->max_connections > 0 && |
813 | - g_hash_table_size(children) >= serve->max_connections) { |
814 | - msg2(LOG_INFO, "Max connections reached"); |
815 | - close(net); |
816 | - continue; |
817 | - } |
818 | - if((sock_flags = fcntl(net, F_GETFL, 0))==-1) { |
819 | - err("fcntl F_GETFL"); |
820 | - } |
821 | - if(fcntl(net, F_SETFL, sock_flags &~O_NONBLOCK)==-1) { |
822 | - err("fcntl F_SETFL ~O_NONBLOCK"); |
823 | - } |
824 | - if(!client) { |
825 | - client = g_new0(CLIENT, 1); |
826 | - client->server=serve; |
827 | - client->exportsize=OFFT_MAX; |
828 | - client->net=net; |
829 | - client->transactionlogfd = -1; |
830 | - } |
831 | - set_peername(net, client); |
832 | - if (!authorized_client(client)) { |
833 | - msg2(LOG_INFO,"Unauthorized client") ; |
834 | - close(net); |
835 | - continue; |
836 | - } |
837 | - msg2(LOG_INFO,"Authorized client") ; |
838 | - pid=g_malloc(sizeof(pid_t)); |
839 | - |
840 | - if (!dontfork) { |
841 | - if ((*pid=fork())<0) { |
842 | - msg3(LOG_INFO,"Could not fork (%s)",strerror(errno)) ; |
843 | - close(net); |
844 | - continue; |
845 | - } |
846 | - if (*pid>0) { /* parent */ |
847 | - close(net); |
848 | - g_hash_table_insert(children, pid, pid); |
849 | - continue; |
850 | - } |
851 | - /* child */ |
852 | - g_hash_table_destroy(children); |
853 | - for(i=0;i<servers->len;i++) { |
854 | - serve=&g_array_index(servers, SERVER, i); |
855 | - close(serve->socket); |
856 | - } |
857 | - /* FALSE does not free the |
858 | - actual data. This is required, |
859 | - because the client has a |
860 | - direct reference into that |
861 | - data, and otherwise we get a |
862 | - segfault... */ |
863 | - g_array_free(servers, FALSE); |
864 | - } |
865 | - |
866 | - msg2(LOG_INFO,"Starting to serve"); |
867 | - serveconnection(client); |
868 | - exit(EXIT_SUCCESS); |
869 | + if ((net=accept(serve->socket, (struct sockaddr *) &addrin, &addrinlen)) < 0) { |
870 | + err_nonfatal("accept: %m"); |
871 | + continue; |
872 | + } |
873 | + handle_connection(servers, net, serve, NULL); |
874 | + } |
875 | } |
876 | } |
877 | } |
878 | @@ -2432,11 +2465,14 @@ |
879 | |
880 | sa.sa_handler = sigchld_handler; |
881 | sigemptyset(&sa.sa_mask); |
882 | + sigaddset(&sa.sa_mask, SIGTERM); |
883 | sa.sa_flags = SA_RESTART; |
884 | if(sigaction(SIGCHLD, &sa, NULL) == -1) |
885 | err("sigaction: %m"); |
886 | + |
887 | sa.sa_handler = sigterm_handler; |
888 | sigemptyset(&sa.sa_mask); |
889 | + sigaddset(&sa.sa_mask, SIGCHLD); |
890 | sa.sa_flags = SA_RESTART; |
891 | if(sigaction(SIGTERM, &sa, NULL) == -1) |
892 | err("sigaction: %m"); |
893 | @@ -2594,9 +2630,10 @@ |
894 | #endif |
895 | client=g_malloc(sizeof(CLIENT)); |
896 | client->server=serve; |
897 | - client->net=0; |
898 | + client->net=-1; |
899 | client->exportsize=OFFT_MAX; |
900 | - set_peername(0,client); |
901 | + if (set_peername(0, client)) |
902 | + exit(EXIT_FAILURE); |
903 | serveconnection(client); |
904 | return 0; |
905 | } |
906 | |
907 | === modified file 'simple_test' |
908 | --- simple_test 2011-10-20 10:27:44 +0000 |
909 | +++ simple_test 2012-12-05 21:52:21 +0000 |
910 | @@ -7,6 +7,8 @@ |
911 | tmpnam=${tmpdir}/nbd.dd |
912 | mydir=$(dirname "`readlink -f $0`") |
913 | |
914 | +set -e |
915 | + |
916 | ulimit -c unlimited |
917 | |
918 | # Create a one-meg device |
919 | @@ -184,6 +186,30 @@ |
920 | ./nbd-tester-client localhost -N export1 -i -t ${mydir}/integrityhuge-test.tr |
921 | retval=$? |
922 | ;; |
923 | + */list) |
924 | + # List exports |
925 | + # This only works if we built nbd-client, which only exists on |
926 | + # Linux. But hey, testing nbd-client itself isn't a bad idea, |
927 | + # so here goes. |
928 | + if [ `uname -s` != "Linux" ] |
929 | + then |
930 | + retval=77 |
931 | + else |
932 | + cat >${conffile} <<EOF |
933 | +[generic] |
934 | + listenaddr = 127.0.0.1 |
935 | + allowlist = true |
936 | +[export1] |
937 | + exportname = $tmpnam |
938 | + readonly = true |
939 | +EOF |
940 | + ./nbd-server -C ${conffile} -p ${pidfile} & |
941 | + PID=$! |
942 | + sleep 1 |
943 | + ./nbd-client -l localhost |
944 | + retval=$? |
945 | + fi |
946 | + ;; |
947 | *) |
948 | echo "E: unknown test $1" |
949 | exit 1 |
950 | @@ -193,7 +219,10 @@ |
951 | then |
952 | kill `cat ${pidfile}` |
953 | else |
954 | - kill $PID |
955 | + if [ ! -z "$PID" ] |
956 | + then |
957 | + kill $PID |
958 | + fi |
959 | fi |
960 | if [ -z "$2" ] |
961 | then |
Good work.