From a85c67bc9628df0a2a36bca530d35a5694b17ae6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 25 May 2016 11:24:16 +0100 Subject: [PATCH] Add another upstream patch since 1.1.11. --- 0001-Add-mandir-to-dump-config-output.patch | 2 +- 0002-Update-TODO.patch | 2 +- ...r-newstyle-NBD-protocol-RHBZ-1297100.patch | 2 +- ...ix-various-printf-warnings-on-32-bit.patch | 2 +- ...-Avoid-race-when-building-NBDKit.cmi.patch | 2 +- ...t-the-o-oldstyle-command-line-option.patch | 2 +- ...mited-range-of-errno-values-to-the-c.patch | 2 +- ...l-Pack-fixed_new_option_reply-struct.patch | 2 +- ...me-NEW_OPTION_REPLY-as-NBD_REP_MAGIC.patch | 2 +- 0010-Implement-newstyle-export-names.patch | 2 +- ...rest-of-option-when-replying-with-er.patch | 46 +++++++++++++++++++ nbdkit.spec | 6 ++- 12 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 0011-protocol-Ignore-rest-of-option-when-replying-with-er.patch diff --git a/0001-Add-mandir-to-dump-config-output.patch b/0001-Add-mandir-to-dump-config-output.patch index 0152b67..2822690 100644 --- a/0001-Add-mandir-to-dump-config-output.patch +++ b/0001-Add-mandir-to-dump-config-output.patch @@ -1,7 +1,7 @@ From 5294b7d8cc011f8b5e068aad744f612df7414a82 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 31 Oct 2015 13:24:52 +0000 -Subject: [PATCH 01/10] Add mandir to --dump-config output. +Subject: [PATCH 01/11] Add mandir to --dump-config output. This is useful for external plugins that want to install a man page. diff --git a/0002-Update-TODO.patch b/0002-Update-TODO.patch index 7f2c244..cc44a04 100644 --- a/0002-Update-TODO.patch +++ b/0002-Update-TODO.patch @@ -1,7 +1,7 @@ From 4b562134c3dad1a84aa92c1658e72046569e1570 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Jan 2016 15:34:57 +0000 -Subject: [PATCH 02/10] Update TODO. +Subject: [PATCH 02/11] Update TODO. --- TODO | 5 +++++ diff --git a/0003-Add-support-for-newstyle-NBD-protocol-RHBZ-1297100.patch b/0003-Add-support-for-newstyle-NBD-protocol-RHBZ-1297100.patch index 05f2930..3d57823 100644 --- a/0003-Add-support-for-newstyle-NBD-protocol-RHBZ-1297100.patch +++ b/0003-Add-support-for-newstyle-NBD-protocol-RHBZ-1297100.patch @@ -1,7 +1,7 @@ From f93807114634d58ca2ef0d64f7637ebd87e48a50 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Jan 2016 17:08:51 +0000 -Subject: [PATCH 03/10] Add support for newstyle NBD protocol (RHBZ#1297100). +Subject: [PATCH 03/11] Add support for newstyle NBD protocol (RHBZ#1297100). --- .gitignore | 1 + diff --git a/0004-xz-Fix-various-printf-warnings-on-32-bit.patch b/0004-xz-Fix-various-printf-warnings-on-32-bit.patch index 2718a4d..f5c597b 100644 --- a/0004-xz-Fix-various-printf-warnings-on-32-bit.patch +++ b/0004-xz-Fix-various-printf-warnings-on-32-bit.patch @@ -1,7 +1,7 @@ From 0759d15aa3649d088eeae91fcd174d0b37e1ccde Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Jan 2016 19:02:53 +0000 -Subject: [PATCH 04/10] xz: Fix various printf warnings on 32 bit. +Subject: [PATCH 04/11] xz: Fix various printf warnings on 32 bit. xzfile.c: In function 'xzfile_read_block': xzfile.c:456:19: warning: format '%zu' expects argument of type 'size_t', but argument 2 has type 'uint64_t {aka long long unsigned int}' [-Wformat=] diff --git a/0005-ocaml-Avoid-race-when-building-NBDKit.cmi.patch b/0005-ocaml-Avoid-race-when-building-NBDKit.cmi.patch index 9ffed79..2096716 100644 --- a/0005-ocaml-Avoid-race-when-building-NBDKit.cmi.patch +++ b/0005-ocaml-Avoid-race-when-building-NBDKit.cmi.patch @@ -1,7 +1,7 @@ From b6db2f65596470492f0ad76d1ed63ddb98b17167 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Jan 2016 19:46:37 +0000 -Subject: [PATCH 05/10] ocaml: Avoid race when building NBDKit.cmi. +Subject: [PATCH 05/11] ocaml: Avoid race when building NBDKit.cmi. If both the NBDKit.cmi and NBDKit.cmx builds run in parallel, both will try to build NBDKit.cmi, resulting in a corrupt NBDKit.cmi file. diff --git a/0006-Test-the-o-oldstyle-command-line-option.patch b/0006-Test-the-o-oldstyle-command-line-option.patch index 010f817..c565b47 100644 --- a/0006-Test-the-o-oldstyle-command-line-option.patch +++ b/0006-Test-the-o-oldstyle-command-line-option.patch @@ -1,7 +1,7 @@ From 1c359d1140fee575cf478e2b4bf0c5ca0af9d05e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Jan 2016 20:34:28 +0000 -Subject: [PATCH 06/10] Test the -o (oldstyle) command line option. +Subject: [PATCH 06/11] Test the -o (oldstyle) command line option. --- .gitignore | 1 + diff --git a/0007-protocol-Send-limited-range-of-errno-values-to-the-c.patch b/0007-protocol-Send-limited-range-of-errno-values-to-the-c.patch index e978393..cfb11f4 100644 --- a/0007-protocol-Send-limited-range-of-errno-values-to-the-c.patch +++ b/0007-protocol-Send-limited-range-of-errno-values-to-the-c.patch @@ -1,7 +1,7 @@ From f141228d1b6baddadcd516137d76b3d852af8cde Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 12 Jan 2016 12:16:48 +0000 -Subject: [PATCH 07/10] protocol: Send limited range of errno values to the +Subject: [PATCH 07/11] protocol: Send limited range of errno values to the client. See the proposal here: diff --git a/0008-protocol-Pack-fixed_new_option_reply-struct.patch b/0008-protocol-Pack-fixed_new_option_reply-struct.patch index f46740d..230f688 100644 --- a/0008-protocol-Pack-fixed_new_option_reply-struct.patch +++ b/0008-protocol-Pack-fixed_new_option_reply-struct.patch @@ -1,7 +1,7 @@ From e5a945ea1e759e6441773c1e7663a1ac2492c8e4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 17 May 2016 19:40:29 +0100 -Subject: [PATCH 08/10] protocol: Pack fixed_new_option_reply struct. +Subject: [PATCH 08/11] protocol: Pack fixed_new_option_reply struct. This struct was not packed, but we were sending a reply by sending the struct directly onto the wire. I think we got away with it, but not good. diff --git a/0009-protocol-Rename-NEW_OPTION_REPLY-as-NBD_REP_MAGIC.patch b/0009-protocol-Rename-NEW_OPTION_REPLY-as-NBD_REP_MAGIC.patch index fbd639c..d931f77 100644 --- a/0009-protocol-Rename-NEW_OPTION_REPLY-as-NBD_REP_MAGIC.patch +++ b/0009-protocol-Rename-NEW_OPTION_REPLY-as-NBD_REP_MAGIC.patch @@ -1,7 +1,7 @@ From f989fbad9b0527925c38f4350190cb1536a4d8c2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 17 May 2016 19:42:35 +0100 -Subject: [PATCH 09/10] protocol: Rename NEW_OPTION_REPLY as NBD_REP_MAGIC. +Subject: [PATCH 09/11] protocol: Rename NEW_OPTION_REPLY as NBD_REP_MAGIC. To be consistent with qemu's implementation. --- diff --git a/0010-Implement-newstyle-export-names.patch b/0010-Implement-newstyle-export-names.patch index e767bc1..cf5a007 100644 --- a/0010-Implement-newstyle-export-names.patch +++ b/0010-Implement-newstyle-export-names.patch @@ -1,7 +1,7 @@ From 0095b003b56894baad8e6789d523cf3c51905c05 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 17 May 2016 19:43:16 +0100 -Subject: [PATCH 10/10] Implement newstyle export names. +Subject: [PATCH 10/11] Implement newstyle export names. This is now required by qemu >= 2.6. See this lengthy qemu-devel thread for details: diff --git a/0011-protocol-Ignore-rest-of-option-when-replying-with-er.patch b/0011-protocol-Ignore-rest-of-option-when-replying-with-er.patch new file mode 100644 index 0000000..3e9e7f8 --- /dev/null +++ b/0011-protocol-Ignore-rest-of-option-when-replying-with-er.patch @@ -0,0 +1,46 @@ +From 7938bbc463a694aeda888d51f1de446f23402d8f Mon Sep 17 00:00:00 2001 +From: Eric Blake +Date: Fri, 20 May 2016 08:04:05 -0600 +Subject: [PATCH 11/11] protocol: Ignore rest of option when replying with + error + +We must consume the payload of any option received, whether or +not we can answer the option successfully, in order to be in +sync for reading the next option. This is particularly true +once clients start using NBD_OPT_GO, as long as we don't happen +to service that option. + +Signed-off-by: Eric Blake +--- + src/connections.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/connections.c b/src/connections.c +index 0c93f35..840e315 100644 +--- a/src/connections.c ++++ b/src/connections.c +@@ -334,6 +334,10 @@ _negotiate_handshake_newstyle_options (struct connection *conn) + if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_INVALID) + == -1) + return -1; ++ if (xread (conn->sockin, data, optlen) == -1) { ++ nbdkit_error ("read: %m"); ++ return -1; ++ } + continue; + } + +@@ -351,6 +355,10 @@ _negotiate_handshake_newstyle_options (struct connection *conn) + /* Unknown option. */ + if (send_newstyle_option_reply (conn, option, NBD_REP_ERR_UNSUP) == -1) + return -1; ++ if (xread (conn->sockin, data, optlen) == -1) { ++ nbdkit_error ("read: %m"); ++ return -1; ++ } + } + + /* Note, since it's not very clear from the protocol doc, that the +-- +2.7.4 + diff --git a/nbdkit.spec b/nbdkit.spec index 5fe999c..10fadd7 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -6,7 +6,7 @@ Name: nbdkit Version: 1.1.11 -Release: 9%{?dist} +Release: 10%{?dist} Summary: NBD server License: BSD @@ -25,6 +25,7 @@ Patch0007: 0007-protocol-Send-limited-range-of-errno-values-to-the-c.patch Patch0008: 0008-protocol-Pack-fixed_new_option_reply-struct.patch Patch0009: 0009-protocol-Rename-NEW_OPTION_REPLY-as-NBD_REP_MAGIC.patch Patch0010: 0010-Implement-newstyle-export-names.patch +Patch0011: 0011-protocol-Ignore-rest-of-option-when-replying-with-er.patch # Because patch3 & patch5 patches Makefile.am, we need: BuildRequires: automake, autoconf, libtool @@ -372,6 +373,9 @@ make check || { %changelog +* Wed May 25 2016 Richard W.M. Jones - 1.1.11-10 +- Add another upstream patch since 1.1.11. + * Mon May 23 2016 Richard W.M. Jones - 1.1.11-9 - Add all patches upstream since 1.1.11 (fixes RHBZ#1336758).