From 9d2dd81620e0109aca630e2f2975c1db3ac57a02 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 13 Jun 2022 13:34:02 +0100 Subject: [PATCH] Rebase to new stable branch version 1.30.6 resolves: rhbz#2059289 Backport new scan filter from 1.32. Add new rate filter burstiness setting from 1.32 --- ...-Allow-the-remote-file-to-be-created.patch | 2 +- ...e-this-filter-so-it-prefetches-using.patch | 2 +- 0003-readahead-Fix-test.patch | 2 +- 0004-New-filter-luks.patch | 8 +- ...-filter-with-old-GnuTLS-in-Debian-10.patch | 8 +- 0006-luks-Various-fixes-for-Clang.patch | 2 +- ...-luks-Link-with-libcompat-on-Windows.patch | 2 +- 0008-luks-Refactor-the-filter.patch | 2 +- ...Reduce-time-taken-to-run-these-tests.patch | 2 +- ...dd-nbdkit.parse_size-Python-function.patch | 2 +- ...ss-reference-nbdkit-readahead-filter.patch | 34 + ...ocument-curl-plugin-readahead-filter.patch | 48 + 0013-New-filter-scan.patch | 1021 +++++++++++++++++ 0014-scan-Remove-condition-variable.patch | 67 ++ ...an-Small-typographical-fix-in-manual.patch | 57 + ...nce-readahead-or-scan-filters-from-t.patch | 34 + ...o-we-don-t-try-to-prefetch-beyond-en.patch | 56 + ...gression-test-for-LUKS-zeroing-crash.patch | 110 ++ ...te-Allow-burstiness-to-be-controlled.patch | 121 ++ nbdkit.spec | 21 +- sources | 4 +- 21 files changed, 1584 insertions(+), 21 deletions(-) create mode 100644 0011-cache-Fix-cross-reference-nbdkit-readahead-filter.patch create mode 100644 0012-curl-Don-t-document-curl-plugin-readahead-filter.patch create mode 100644 0013-New-filter-scan.patch create mode 100644 0014-scan-Remove-condition-variable.patch create mode 100644 0015-scan-Small-typographical-fix-in-manual.patch create mode 100644 0016-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch create mode 100644 0017-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch create mode 100644 0018-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch create mode 100644 0019-rate-Allow-burstiness-to-be-controlled.patch diff --git a/0001-ssh-Allow-the-remote-file-to-be-created.patch b/0001-ssh-Allow-the-remote-file-to-be-created.patch index a549937..544f7f4 100644 --- a/0001-ssh-Allow-the-remote-file-to-be-created.patch +++ b/0001-ssh-Allow-the-remote-file-to-be-created.patch @@ -1,4 +1,4 @@ -From 90f0cb8f0495ccf71dd3bed89ccb95c0120b5ef7 Mon Sep 17 00:00:00 2001 +From 3fd637dc2d30cb3001a00ab0f3d5ac0a8875140e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 15 Apr 2022 12:08:37 +0100 Subject: [PATCH] ssh: Allow the remote file to be created diff --git a/0002-readahead-Rewrite-this-filter-so-it-prefetches-using.patch b/0002-readahead-Rewrite-this-filter-so-it-prefetches-using.patch index d050715..f8045f5 100644 --- a/0002-readahead-Rewrite-this-filter-so-it-prefetches-using.patch +++ b/0002-readahead-Rewrite-this-filter-so-it-prefetches-using.patch @@ -1,4 +1,4 @@ -From af145808cecd18f6f80b672b5988ec1064f9b4a7 Mon Sep 17 00:00:00 2001 +From 3e21d31621739533b3bdb77350b4107123b5b5ab Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 16 Apr 2022 18:39:13 +0100 Subject: [PATCH] readahead: Rewrite this filter so it prefetches using .cache diff --git a/0003-readahead-Fix-test.patch b/0003-readahead-Fix-test.patch index 6750e53..e723ea4 100644 --- a/0003-readahead-Fix-test.patch +++ b/0003-readahead-Fix-test.patch @@ -1,4 +1,4 @@ -From 5d679d01417a81a3a981520d2a0332e2370a2536 Mon Sep 17 00:00:00 2001 +From cbd0205229240f4a01e9ce7ef6ee4ba55d2b958c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 21 Apr 2022 16:14:46 +0100 Subject: [PATCH] readahead: Fix test diff --git a/0004-New-filter-luks.patch b/0004-New-filter-luks.patch index 6084b5c..dccca24 100644 --- a/0004-New-filter-luks.patch +++ b/0004-New-filter-luks.patch @@ -1,4 +1,4 @@ -From 71755e96c423874e39a2ed85eb5d2e1c12c643f2 Mon Sep 17 00:00:00 2001 +From 42213b71009e7e5f1f50df78c41ba49beebcf08b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 30 Apr 2022 12:35:07 +0100 Subject: [PATCH] New filter: luks @@ -55,7 +55,7 @@ index 4d2a9796..0f5dc41d 100644 * The filter should open a new connection to the plugin per background diff --git a/configure.ac b/configure.ac -index e391f110..2349b49e 100644 +index d958ff2c..45a7baf9 100644 --- a/configure.ac +++ b/configure.ac @@ -127,6 +127,7 @@ filters="\ @@ -1597,10 +1597,10 @@ index f8f0e198..b95e7349 100644 =head1 AUTHORS diff --git a/tests/Makefile.am b/tests/Makefile.am -index 0e7ce711..fa66a112 100644 +index b9c1137c..b041b186 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am -@@ -1590,6 +1590,18 @@ EXTRA_DIST += \ +@@ -1594,6 +1594,18 @@ EXTRA_DIST += \ test-log-script-info.sh \ $(NULL) diff --git a/0005-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch b/0005-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch index 25eccbc..246cc8f 100644 --- a/0005-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch +++ b/0005-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch @@ -1,4 +1,4 @@ -From ddda62b9faef8cb2cdf4bc4b60bead34f0f143d5 Mon Sep 17 00:00:00 2001 +From fd5de2f6b2bc4e95e98ca44624d04809d989d1a0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 8 May 2022 12:13:39 +0100 Subject: [PATCH] luks: Disable filter with old GnuTLS in Debian 10 @@ -36,7 +36,7 @@ Fixes: commit 468919dce6c5eb57503eacac0f67e5dd87c58e6c 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac -index 2349b49e..05db668e 100644 +index 45a7baf9..4c997b5b 100644 --- a/configure.ac +++ b/configure.ac @@ -636,11 +636,14 @@ AS_IF([test "x$GNUTLS_LIBS" != "x"],[ @@ -79,10 +79,10 @@ index 30089621..622e5c3d 100644 filter_LTLIBRARIES = nbdkit-luks-filter.la diff --git a/tests/Makefile.am b/tests/Makefile.am -index fa66a112..ffeef097 100644 +index b041b186..937d2919 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am -@@ -1591,7 +1591,7 @@ EXTRA_DIST += \ +@@ -1595,7 +1595,7 @@ EXTRA_DIST += \ $(NULL) # luks filter test. diff --git a/0006-luks-Various-fixes-for-Clang.patch b/0006-luks-Various-fixes-for-Clang.patch index d1c9cf4..29cf734 100644 --- a/0006-luks-Various-fixes-for-Clang.patch +++ b/0006-luks-Various-fixes-for-Clang.patch @@ -1,4 +1,4 @@ -From 95f27197a7ea2d0fb0f19162152d0d72eeead752 Mon Sep 17 00:00:00 2001 +From f83c628b420fa38d9a224d2a7296f7386bf1bb70 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 8 May 2022 12:30:09 +0100 Subject: [PATCH] luks: Various fixes for Clang diff --git a/0007-luks-Link-with-libcompat-on-Windows.patch b/0007-luks-Link-with-libcompat-on-Windows.patch index 9ef0bd2..123f2e3 100644 --- a/0007-luks-Link-with-libcompat-on-Windows.patch +++ b/0007-luks-Link-with-libcompat-on-Windows.patch @@ -1,4 +1,4 @@ -From 6c052a340d7452feae84845965fdc99542da2404 Mon Sep 17 00:00:00 2001 +From dbf2d150c19b2fdad0ee786ace3ef9d3849069dd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 8 May 2022 12:38:00 +0100 Subject: [PATCH] luks: Link with libcompat on Windows diff --git a/0008-luks-Refactor-the-filter.patch b/0008-luks-Refactor-the-filter.patch index 40e3c78..c2ed2b6 100644 --- a/0008-luks-Refactor-the-filter.patch +++ b/0008-luks-Refactor-the-filter.patch @@ -1,4 +1,4 @@ -From c34ec6b17c25f94020c83a18482e8eac8e5fa8c8 Mon Sep 17 00:00:00 2001 +From 792c7e83ea2e440cd4c3433c2ad01cc509502100 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 8 May 2022 16:13:13 +0100 Subject: [PATCH] luks: Refactor the filter diff --git a/0009-tests-luks-Reduce-time-taken-to-run-these-tests.patch b/0009-tests-luks-Reduce-time-taken-to-run-these-tests.patch index f30b011..f035c0d 100644 --- a/0009-tests-luks-Reduce-time-taken-to-run-these-tests.patch +++ b/0009-tests-luks-Reduce-time-taken-to-run-these-tests.patch @@ -1,4 +1,4 @@ -From 64ce47cc59c062cf64cb7bf7a9861f4c5d767514 Mon Sep 17 00:00:00 2001 +From 8b1ce219c6fc62c848412f6ca1c1b2b94550cc7a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 8 May 2022 18:05:45 +0100 Subject: [PATCH] tests: luks: Reduce time taken to run these tests diff --git a/0010-Add-nbdkit.parse_size-Python-function.patch b/0010-Add-nbdkit.parse_size-Python-function.patch index 48e4561..99a4bae 100644 --- a/0010-Add-nbdkit.parse_size-Python-function.patch +++ b/0010-Add-nbdkit.parse_size-Python-function.patch @@ -1,4 +1,4 @@ -From e19ef7726379acf90dcff248e90813898266d2b4 Mon Sep 17 00:00:00 2001 +From 633cc64db2654a8f64b0a699fb2135130da0b51d Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Mon, 9 May 2022 10:04:30 +0100 Subject: [PATCH] Add nbdkit.parse_size() Python function. diff --git a/0011-cache-Fix-cross-reference-nbdkit-readahead-filter.patch b/0011-cache-Fix-cross-reference-nbdkit-readahead-filter.patch new file mode 100644 index 0000000..eca19f4 --- /dev/null +++ b/0011-cache-Fix-cross-reference-nbdkit-readahead-filter.patch @@ -0,0 +1,34 @@ +From 7150142f1aa19d8ae3ba412583dc2452cb3ab865 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 14 May 2022 13:47:19 +0100 +Subject: [PATCH] cache: Fix cross-reference nbdkit-readahead-filter + +After the readahead filter was reimplemented so that it only issues +cache requests, the two filters should be used together, not as +alternatives. Update the documentation of the cache filter to make +this clear. + +Fixes: commit 2ff548d66ad3eae87868402ec5b3319edd12090f +(cherry picked from commit 894771f39a8fd2632caad00e497146d69cac4bac) +--- + filters/cache/nbdkit-cache-filter.pod | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/filters/cache/nbdkit-cache-filter.pod b/filters/cache/nbdkit-cache-filter.pod +index d85fef09..f4234e1a 100644 +--- a/filters/cache/nbdkit-cache-filter.pod ++++ b/filters/cache/nbdkit-cache-filter.pod +@@ -28,8 +28,8 @@ loss, as the name suggests). + + This filter only caches image contents. To cache image metadata, use + L between this filter and the plugin. +-To accelerate sequential reads, use L +-instead. ++To accelerate sequential reads, use L on ++top of this filter. + + =head1 PARAMETERS + +-- +2.31.1 + diff --git a/0012-curl-Don-t-document-curl-plugin-readahead-filter.patch b/0012-curl-Don-t-document-curl-plugin-readahead-filter.patch new file mode 100644 index 0000000..175f8f3 --- /dev/null +++ b/0012-curl-Don-t-document-curl-plugin-readahead-filter.patch @@ -0,0 +1,48 @@ +From 236b50f2c89237de0dc27df7babc0c12cc124cba Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 14 May 2022 14:00:16 +0100 +Subject: [PATCH] curl: Don't document curl plugin + readahead filter + +nbdkit readahead filter does not support plugins which do not use the +parallel thread model. + +Fixes: commit 2ff548d66ad3eae87868402ec5b3319edd12090f +(cherry picked from commit 92fbb76d11b9f17c527debd803aa2505f3642783) +--- + docs/nbdkit-captive.pod | 7 ------- + plugins/curl/nbdkit-curl-plugin.pod | 1 - + 2 files changed, 8 deletions(-) + +diff --git a/docs/nbdkit-captive.pod b/docs/nbdkit-captive.pod +index eafe36d8..d41a824d 100644 +--- a/docs/nbdkit-captive.pod ++++ b/docs/nbdkit-captive.pod +@@ -110,13 +110,6 @@ an embedded disk image. To copy it out: + + nbdkit -U - example1 --run 'qemu-img convert $nbd disk.img' + +-If plugin requests have a high overhead (for example making HTTP +-requests to a remote server), adding L may +-help performance: +- +- nbdkit -U - --filter=readahead curl https://example.com/disk.img \ +- --run 'qemu-img convert $nbd disk.img' +- + If the source suffers from temporary network failures + L or L may + help. +diff --git a/plugins/curl/nbdkit-curl-plugin.pod b/plugins/curl/nbdkit-curl-plugin.pod +index 54fce66c..fc422ca2 100644 +--- a/plugins/curl/nbdkit-curl-plugin.pod ++++ b/plugins/curl/nbdkit-curl-plugin.pod +@@ -509,7 +509,6 @@ L, + L, + L, + L, +-L, + L, + L, + L, +-- +2.31.1 + diff --git a/0013-New-filter-scan.patch b/0013-New-filter-scan.patch new file mode 100644 index 0000000..bd1c7e4 --- /dev/null +++ b/0013-New-filter-scan.patch @@ -0,0 +1,1021 @@ +From 89a6bbfee6034fdd649668e820b91133b029291d Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 14 May 2022 13:46:56 +0100 +Subject: [PATCH] New filter: scan + +This filter will simply scan across the disk issuing a series of cache +requests to the underlying plugin. It is similar in scope and usage +to the new nbdkit-readahead-filter. + +(cherry picked from commit 65c20a09ceacb4431986a2982f2c2e746df63fcb) +--- + TODO | 8 - + configure.ac | 2 + + filters/cache/nbdkit-cache-filter.pod | 4 +- + .../nbdkit-cacheextents-filter.pod | 1 + + filters/readahead/nbdkit-readahead-filter.pod | 5 + + filters/scan/Makefile.am | 72 +++++ + filters/scan/bgthread.c | 131 ++++++++ + filters/scan/nbdkit-scan-filter.pod | 159 ++++++++++ + filters/scan/scan.c | 280 ++++++++++++++++++ + filters/scan/scan.h | 64 ++++ + plugins/ssh/nbdkit-ssh-plugin.pod | 1 + + plugins/torrent/nbdkit-torrent-plugin.pod | 1 + + plugins/vddk/nbdkit-vddk-plugin.pod | 1 + + tests/Makefile.am | 10 + + tests/test-scan-copy.sh | 42 +++ + tests/test-scan-info.sh | 46 +++ + 16 files changed, 817 insertions(+), 10 deletions(-) + create mode 100644 filters/scan/Makefile.am + create mode 100644 filters/scan/bgthread.c + create mode 100644 filters/scan/nbdkit-scan-filter.pod + create mode 100644 filters/scan/scan.c + create mode 100644 filters/scan/scan.h + create mode 100755 tests/test-scan-copy.sh + create mode 100755 tests/test-scan-info.sh + +diff --git a/TODO b/TODO +index 0f5dc41d..8600d9e4 100644 +--- a/TODO ++++ b/TODO +@@ -182,14 +182,6 @@ Python: + Suggestions for filters + ----------------------- + +-* Add scan filter. This would be placed on top of cache filters and +- would scan (read) the whole disk in the background, ensuring it is +- copied into the cache. Useful if you have a slow plugin, limited +- size device, and lots of local disk space, especially if you know +- that the NBD clients will eventually read all of the device. RWMJ +- wrote an implementation of this but it doesn't work well without a +- background thread. +- + * Add shared filter. Take advantage of filter context APIs to open a + single context into the backend shared among multiple client + connections. This may even allow a filter to offer a more parallel +diff --git a/configure.ac b/configure.ac +index 4c997b5b..38f1f00e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -142,6 +142,7 @@ filters="\ + readahead \ + retry \ + retry-request \ ++ scan \ + stats \ + swab \ + tar \ +@@ -1399,6 +1400,7 @@ AC_CONFIG_FILES([Makefile + filters/readahead/Makefile + filters/retry/Makefile + filters/retry-request/Makefile ++ filters/scan/Makefile + filters/stats/Makefile + filters/swab/Makefile + filters/tar/Makefile +diff --git a/filters/cache/nbdkit-cache-filter.pod b/filters/cache/nbdkit-cache-filter.pod +index f4234e1a..935804b5 100644 +--- a/filters/cache/nbdkit-cache-filter.pod ++++ b/filters/cache/nbdkit-cache-filter.pod +@@ -28,8 +28,8 @@ loss, as the name suggests). + + This filter only caches image contents. To cache image metadata, use + L between this filter and the plugin. +-To accelerate sequential reads, use L on +-top of this filter. ++To accelerate sequential reads, use L or ++L on top of this filter. + + =head1 PARAMETERS + +diff --git a/filters/cacheextents/nbdkit-cacheextents-filter.pod b/filters/cacheextents/nbdkit-cacheextents-filter.pod +index bb2514a4..6464eac2 100644 +--- a/filters/cacheextents/nbdkit-cacheextents-filter.pod ++++ b/filters/cacheextents/nbdkit-cacheextents-filter.pod +@@ -54,6 +54,7 @@ L, + L, + L, + L, ++L, + L, + L, + L. +diff --git a/filters/readahead/nbdkit-readahead-filter.pod b/filters/readahead/nbdkit-readahead-filter.pod +index 630e5924..99d64dfb 100644 +--- a/filters/readahead/nbdkit-readahead-filter.pod ++++ b/filters/readahead/nbdkit-readahead-filter.pod +@@ -27,6 +27,10 @@ option. + The filter uses a simple adaptive algorithm which accelerates + sequential reads and requires no further configuration. + ++A similar filter is L which reads ahead over ++the whole disk, useful if you know that the client will be reading ++sequentially across most or all of the disk. ++ + =head2 Limitations + + In a number of significant cases this filter will do nothing. The +@@ -91,6 +95,7 @@ L, + L, + L, + L, ++L, + L, + L, + L, +diff --git a/filters/scan/Makefile.am b/filters/scan/Makefile.am +new file mode 100644 +index 00000000..d4aabfc6 +--- /dev/null ++++ b/filters/scan/Makefile.am +@@ -0,0 +1,72 @@ ++# nbdkit ++# Copyright (C) 2019-2021 Red Hat Inc. ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions are ++# met: ++# ++# * Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# ++# * Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# ++# * Neither the name of Red Hat nor the names of its contributors may be ++# used to endorse or promote products derived from this software without ++# specific prior written permission. ++# ++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++# SUCH DAMAGE. ++ ++include $(top_srcdir)/common-rules.mk ++ ++EXTRA_DIST = nbdkit-scan-filter.pod ++ ++filter_LTLIBRARIES = nbdkit-scan-filter.la ++ ++nbdkit_scan_filter_la_SOURCES = \ ++ scan.c \ ++ scan.h \ ++ bgthread.c \ ++ $(top_srcdir)/include/nbdkit-filter.h \ ++ $(NULL) ++ ++nbdkit_scan_filter_la_CPPFLAGS = \ ++ -I$(top_srcdir)/include \ ++ -I$(top_srcdir)/common/include \ ++ -I$(top_srcdir)/common/utils \ ++ $(NULL) ++nbdkit_scan_filter_la_CFLAGS = $(WARNINGS_CFLAGS) ++nbdkit_scan_filter_la_LDFLAGS = \ ++ -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ ++ -Wl,--version-script=$(top_srcdir)/filters/filters.syms \ ++ $(NULL) ++nbdkit_scan_filter_la_LIBADD = \ ++ $(top_builddir)/common/utils/libutils.la \ ++ $(top_builddir)/common/replacements/libcompat.la \ ++ $(IMPORT_LIBRARY_ON_WINDOWS) \ ++ $(NULL) ++ ++if HAVE_POD ++ ++man_MANS = nbdkit-scan-filter.1 ++CLEANFILES += $(man_MANS) ++ ++nbdkit-scan-filter.1: nbdkit-scan-filter.pod \ ++ $(top_builddir)/podwrapper.pl ++ $(PODWRAPPER) --section=1 --man $@ \ ++ --html $(top_builddir)/html/$@.html \ ++ $< ++ ++endif HAVE_POD +diff --git a/filters/scan/bgthread.c b/filters/scan/bgthread.c +new file mode 100644 +index 00000000..384e79b6 +--- /dev/null ++++ b/filters/scan/bgthread.c +@@ -0,0 +1,131 @@ ++/* nbdkit ++ * Copyright (C) 2019-2022 Red Hat Inc. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are ++ * met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Red Hat nor the names of its contributors may be ++ * used to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "scan.h" ++ ++#include "cleanup.h" ++#include "minmax.h" ++ ++static pthread_mutex_t clock_lock; ++static uint64_t clock_ = 0; ++ ++static void ++adjust_clock (uint64_t offset) ++{ ++ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&clock_lock); ++ if (clock_ < offset) ++ clock_ = offset; ++} ++ ++static void ++reset_clock (uint64_t offset) ++{ ++ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&clock_lock); ++ clock_ = 0; ++} ++ ++static uint64_t ++get_starting_offset (void) ++{ ++ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&clock_lock); ++ return scan_clock ? clock_ : 0; ++} ++ ++void * ++scan_thread (void *vp) ++{ ++ struct bgthread_ctrl *ctrl = vp; ++ uint64_t offset, size; ++ int64_t r; ++ ++ assert (ctrl->next != NULL); ++ ++ /* Get the size of the underlying plugin. Exit the thread on error ++ * because there's not much we can do without knowing the size. ++ */ ++ r = ctrl->next->get_size (ctrl->next); ++ if (r == -1) ++ return NULL; ++ size = r; ++ ++ /* Start scanning. */ ++ start: ++ for (offset = get_starting_offset (); offset < size; offset += scan_size) { ++ uint64_t n; ++ ++ /* Execute any commands in the queue. */ ++ { ++ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&ctrl->lock); ++ struct command cmd; ++ ++ while (ctrl->cmds.len) { ++ cmd = ctrl->cmds.ptr[0]; ++ command_queue_remove (&ctrl->cmds, 0); ++ ++ switch (cmd.type) { ++ case CMD_QUIT: ++ nbdkit_debug ("scan: exiting background thread on connection close"); ++ return NULL; ++ ++ case CMD_NOTIFY_PREAD: ++ if (offset < cmd.offset) ++ offset = cmd.offset; ++ } ++ } ++ } ++ ++ adjust_clock (offset); ++ if (offset > size) ++ continue; ++ ++ /* Issue the next prefetch. */ ++ n = MIN (scan_size, size - offset); ++ ctrl->next->cache (ctrl->next, n, offset, 0, NULL); ++ } ++ ++ if (scan_forever) { ++ reset_clock (offset); ++ goto start; ++ } ++ ++ nbdkit_debug ("scan: finished scanning the plugin"); ++ return NULL; ++} +diff --git a/filters/scan/nbdkit-scan-filter.pod b/filters/scan/nbdkit-scan-filter.pod +new file mode 100644 +index 00000000..4a8d0ef9 +--- /dev/null ++++ b/filters/scan/nbdkit-scan-filter.pod +@@ -0,0 +1,159 @@ ++=head1 NAME ++ ++nbdkit-scan-filter - scan disk prefetching data ahead of sequential reads ++ ++=head1 SYNOPSIS ++ ++ nbdkit --filter=scan PLUGIN [scan-ahead=false] [scan-clock=false] ++ [scan-forever=true] [scan-size=]NN ++ ++ nbdkit --filter=scan --filter=cache PLUGIN ++ ++ nbdkit --filter=scan --filter=cow PLUGIN cow-on-cache=true ++ ++=head1 DESCRIPTION ++ ++C is a filter that scans the disk prefetching ++data. It is sometimes useful if you expect that the client will read ++the disk sequentially. ++ ++The basic operation of the filter is that when a client connects, the ++filter will start issuing C<.cache> (prefetch) requests to the plugin ++across the whole disk. Plugins which support this command will ++prefetch the data, making subsequent reads faster. For plugins which ++do not support this command, you can inject L ++below (after) this filter, giving approximately the same effect. ++L can be used instead of nbdkit-cache-filter, if ++you add the C option. ++ ++Various C parameters can be used to tune scanning, although ++the defaults should be suitable in most cases. ++ ++A similar filter is L. ++ ++=head2 Limitations ++ ++In a number of significant cases this filter will do nothing. The ++filter will print a warning message if this happens. ++ ++=over 4 ++ ++=item Thread model must be parallel * ++ ++For example L only supports ++C, and so this filter cannot perform prefetches in ++parallel with the read requests. ++ ++=item Only scans while clients are connected * ++ ++The current filter only scans while there is at least one client ++connected. ++ ++=item Only scans the default export * ++ ++The current filter only scans the default export and ignores all ++clients connecting to the non-default export name. ++ ++* We may be able to lift these restrictions in future. ++ ++=item Underlying filters or plugin must support C<.cache> (prefetch) ++ ++Very many plugins do not have the concept of prefetching and/or ++do not implement the C<.cache> callback, and so there is no ++way for this filter to issue prefetches. ++ ++You can usually get around this by adding I<--filter=cache> after this ++filter as explained above. ++ ++=item Prefetching the whole disk may load it all into cache ++ ++In particular if you use this filter together with ++L or L, they will cache ++the whole content of the plugin into a temporary file. This may be ++many gigabytes of data, consuming all space in F. Of course ++this is the whole point of using this filter, but you should be aware ++of it. ++ ++If using the cache filter, the total size of the cache can be limited ++(see L). ++ ++=back ++ ++=head1 PARAMETERS ++ ++=over 4 ++ ++=item B ++ ++By default the filter tries to stay ahead of incoming read requests. ++That is to say, it starts prefetching at the beginning of the disk and ++continues incrementally, but if the client issues a read beyond the ++current prefetch point then the filter skips forward and begins ++prefetching after the read. ++ ++However if you set this parameter to false, then this behaviour is ++disabled. The filter simply prefetches sequentially regardless of ++client requests. ++ ++=item B ++ ++By default, if all clients disconnect and then another client ++connects, prefetching resumes at the same place in the disk. (Like ++stopping and starting a clock.) ++ ++If you set this parameter to false, then the filter starts prefetching ++from the beginning of the disk again. ++ ++=item B ++ ++By default the filter scans over the disk once and then stops. ++ ++If you set this parameter to true, then after the disk has been ++prefetched completely, the filter goes back to the beginning and ++starts over, repeating this for as long as nbdkit is running and there ++are clients connected. ++ ++=item BNN ++ ++This parameter controls the prefetch block size. The default is ++C<2M>. This must be a power of 2 and most plugins will have their own ++limits on the amount of data they can prefetch in a single request. ++ ++=back ++ ++=head1 FILES ++ ++=over 4 ++ ++=item F<$filterdir/nbdkit-scan-filter.so> ++ ++The filter. ++ ++Use C to find the location of C<$filterdir>. ++ ++=back ++ ++=head1 VERSION ++ ++C first appeared in nbdkit 1.32. ++ ++=head1 SEE ALSO ++ ++L, ++L, ++L, ++L, ++L, ++L, ++L, ++L, ++L, ++L. ++ ++=head1 AUTHORS ++ ++Richard W.M. Jones ++ ++=head1 COPYRIGHT ++ ++Copyright (C) 2019-2022 Red Hat Inc. +diff --git a/filters/scan/scan.c b/filters/scan/scan.c +new file mode 100644 +index 00000000..ac5b18d2 +--- /dev/null ++++ b/filters/scan/scan.c +@@ -0,0 +1,280 @@ ++/* nbdkit ++ * Copyright (C) 2019-2022 Red Hat Inc. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are ++ * met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Red Hat nor the names of its contributors may be ++ * used to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "scan.h" ++ ++#include "cleanup.h" ++#include "ispowerof2.h" ++#include "vector.h" ++ ++static bool scan_ahead = true; ++bool scan_clock = true; ++bool scan_forever = false; ++unsigned scan_size = 2*1024*1024; ++ ++static int thread_model = -1; /* Thread model of the underlying plugin. */ ++ ++/* Per-connection data. */ ++struct scan_handle { ++ bool is_default_export; /* If exportname == "". */ ++ bool running; /* True if background thread is running. */ ++ pthread_t thread; /* The background thread, one per connection. */ ++ struct bgthread_ctrl ctrl; ++}; ++ ++static int ++scan_config (nbdkit_next_config *next, nbdkit_backend *nxdata, ++ const char *key, const char *value) ++{ ++ int r; ++ ++ if (strcmp (key, "scan-ahead") == 0) { ++ r = nbdkit_parse_bool (value); ++ if (r == -1) ++ return -1; ++ scan_ahead = r; ++ return 0; ++ } ++ else if (strcmp (key, "scan-clock") == 0) { ++ r = nbdkit_parse_bool (value); ++ if (r == -1) ++ return -1; ++ scan_clock = r; ++ return 0; ++ } ++ else if (strcmp (key, "scan-forever") == 0) { ++ r = nbdkit_parse_bool (value); ++ if (r == -1) ++ return -1; ++ scan_forever = r; ++ return 0; ++ } ++ else if (strcmp (key, "scan-size") == 0) { ++ scan_size = nbdkit_parse_size (value); ++ if (scan_size == -1) ++ return -1; ++ return 0; ++ } ++ ++ return next (nxdata, key, value); ++} ++ ++static int ++scan_config_complete (nbdkit_next_config_complete *next, nbdkit_backend *nxdata) ++{ ++ if (scan_size < 512 || scan_size > 32*1024*1024 || ++ !is_power_of_2 (scan_size)) { ++ nbdkit_error ("scan-size parameter should be [512..32M] " ++ "and a power of two"); ++ return -1; ++ } ++ ++ return next (nxdata); ++} ++ ++#define scan_config_help \ ++ "scan-ahead=false Skip ahead when client reads faster.\n" \ ++ "scan-clock=false Always start prefetching from beginning.\n" \ ++ "scan-forever=true Scan in a loop while clients connected.\n" \ ++ "scan-size=NN Set scan block size." ++ ++/* We need to hook into .get_ready() so we can read the final thread ++ * model (of the whole server). ++ */ ++static int ++scan_get_ready (int final_thread_model) ++{ ++ thread_model = final_thread_model; ++ return 0; ++} ++ ++static int ++send_command_to_background_thread (struct bgthread_ctrl *ctrl, ++ const struct command cmd) ++{ ++ ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&ctrl->lock); ++ if (command_queue_append (&ctrl->cmds, cmd) == -1) ++ return -1; ++ /* Signal the thread if it could be sleeping on an empty queue. */ ++ if (ctrl->cmds.len == 1) ++ pthread_cond_signal (&ctrl->cond); ++ return 0; ++} ++ ++static void * ++scan_open (nbdkit_next_open *next, nbdkit_context *nxdata, ++ int readonly, const char *exportname, int is_tls) ++{ ++ struct scan_handle *h; ++ ++ if (next (nxdata, readonly, exportname) == -1) ++ return NULL; ++ ++ h = calloc (1, sizeof *h); ++ if (h == NULL) { ++ nbdkit_error ("malloc: %m"); ++ return NULL; ++ } ++ ++ h->is_default_export = strcmp (exportname, "") == 0; ++ return h; ++} ++ ++/* In prepare we check if it's possible to support the scan filter on ++ * this connection (or print a warning), and start the background ++ * thread. ++ */ ++static int ++scan_prepare (nbdkit_next *next, void *handle, int readonly) ++{ ++ struct scan_handle *h = handle; ++ int r, err; ++ ++ if (!h->is_default_export) { ++ nbdkit_error ("scan: warning: not the default export, not scanning"); ++ return 0; ++ } ++ ++ if (thread_model != NBDKIT_THREAD_MODEL_PARALLEL) { ++ nbdkit_error ("scan: warning: underlying plugin does not support " ++ "the PARALLEL thread model, not scanning"); ++ return 0; ++ } ++ ++ /* Call next->can_cache to read the underlying 'can_cache'. */ ++ r = next->can_cache (next); ++ if (r == -1) ++ return -1; ++ if (r != NBDKIT_CACHE_NATIVE) { ++ nbdkit_error ("scan: warning: underlying plugin does not support " ++ "NBD_CMD_CACHE, not scanning; try adding --filter=cache " ++ "after this filter"); ++ return 0; ++ } ++ ++ /* Save the connection in the handle, for the background thread to use. */ ++ h->ctrl.next = next; ++ ++ /* Create the background thread. */ ++ h->ctrl.cmds = (command_queue) empty_vector; ++ pthread_mutex_init (&h->ctrl.lock, NULL); ++ pthread_cond_init (&h->ctrl.cond, NULL); ++ ++ err = pthread_create (&h->thread, NULL, scan_thread, &h->ctrl); ++ if (err != 0) { ++ errno = err; ++ nbdkit_error ("pthread_create: %m"); ++ pthread_cond_destroy (&h->ctrl.cond); ++ pthread_mutex_destroy (&h->ctrl.lock); ++ return -1; ++ } ++ ++ h->running = true; ++ ++ return 0; ++} ++ ++/* Finalize cleans up the thread if it is running. */ ++static int ++scan_finalize (nbdkit_next *next, void *handle) ++{ ++ struct scan_handle *h = handle; ++ const struct command quit_cmd = { .type = CMD_QUIT }; ++ ++ if (!h->running) ++ return 0; ++ ++ send_command_to_background_thread (&h->ctrl, quit_cmd); ++ pthread_join (h->thread, NULL); ++ pthread_cond_destroy (&h->ctrl.cond); ++ pthread_mutex_destroy (&h->ctrl.lock); ++ command_queue_reset (&h->ctrl.cmds); ++ h->running = false; ++ ++ return 0; ++} ++ ++static void ++scan_close (void *handle) ++{ ++ struct scan_handle *h = handle; ++ ++ free (h); ++} ++ ++/* Read data. */ ++static int ++scan_pread (nbdkit_next *next, ++ void *handle, void *buf, uint32_t count, uint64_t offset, ++ uint32_t flags, int *err) ++{ ++ struct scan_handle *h = handle; ++ ++ if (scan_ahead && h->running) { ++ const struct command cmd = ++ { .type = CMD_NOTIFY_PREAD, .offset = offset + count }; ++ ++ if (send_command_to_background_thread (&h->ctrl, cmd) == -1) ++ return -1; ++ } ++ ++ /* Issue the normal read. */ ++ return next->pread (next, buf, count, offset, flags, err); ++} ++ ++static struct nbdkit_filter filter = { ++ .name = "scan", ++ .longname = "nbdkit scan filter", ++ .get_ready = scan_get_ready, ++ .config = scan_config, ++ .config_complete = scan_config_complete, ++ .config_help = scan_config_help, ++ .open = scan_open, ++ .prepare = scan_prepare, ++ .finalize = scan_finalize, ++ .close = scan_close, ++ .pread = scan_pread, ++}; ++ ++NBDKIT_REGISTER_FILTER(filter) +diff --git a/filters/scan/scan.h b/filters/scan/scan.h +new file mode 100644 +index 00000000..7ff39310 +--- /dev/null ++++ b/filters/scan/scan.h +@@ -0,0 +1,64 @@ ++/* nbdkit ++ * Copyright (C) 2019-2022 Red Hat Inc. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are ++ * met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Red Hat nor the names of its contributors may be ++ * used to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#ifndef NBDKIT_SCAN_H ++#define NBDKIT_SCAN_H ++ ++#include ++#include ++ ++#include ++ ++#include "vector.h" ++ ++extern bool scan_clock; ++extern bool scan_forever; ++extern unsigned scan_size; ++ ++/* List of commands issued to the background thread. */ ++struct command { ++ enum { CMD_QUIT, CMD_NOTIFY_PREAD } type; ++ uint64_t offset; ++}; ++DEFINE_VECTOR_TYPE(command_queue, struct command); ++ ++struct bgthread_ctrl { ++ command_queue cmds; /* Command queue. */ ++ pthread_mutex_t lock; /* Lock for queue. */ ++ pthread_cond_t cond; /* Condition queue size 0 -> 1. */ ++ nbdkit_next *next; /* For sending cache operations. */ ++}; ++ ++/* Start background thread (one per connection). */ ++extern void *scan_thread (void *vp); ++ ++#endif /* NBDKIT_SCAN_H */ +diff --git a/plugins/ssh/nbdkit-ssh-plugin.pod b/plugins/ssh/nbdkit-ssh-plugin.pod +index 2bc2c4a7..214957d6 100644 +--- a/plugins/ssh/nbdkit-ssh-plugin.pod ++++ b/plugins/ssh/nbdkit-ssh-plugin.pod +@@ -349,6 +349,7 @@ L, + L, + L, + L, ++L, + L, + L, + L, +diff --git a/plugins/torrent/nbdkit-torrent-plugin.pod b/plugins/torrent/nbdkit-torrent-plugin.pod +index 196ce4e9..f09ac3d2 100644 +--- a/plugins/torrent/nbdkit-torrent-plugin.pod ++++ b/plugins/torrent/nbdkit-torrent-plugin.pod +@@ -175,6 +175,7 @@ L, + L, + L, + L, ++L, + L, + L, + L. +diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod +index ea5899dc..3991e86b 100644 +--- a/plugins/vddk/nbdkit-vddk-plugin.pod ++++ b/plugins/vddk/nbdkit-vddk-plugin.pod +@@ -733,6 +733,7 @@ L, + L, + L, + L, ++L, + L, + L, + L, +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 937d2919..6a63e4e8 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -1752,6 +1752,16 @@ test_retry_request_mirror_LDADD = \ + $(LIBNBD_LIBS) \ + $(NULL) + ++# scan filter test. ++TESTS += \ ++ test-scan-copy.sh \ ++ test-scan-info.sh \ ++ $(NULL) ++EXTRA_DIST += \ ++ test-scan-copy.sh \ ++ test-scan-info.sh \ ++ $(NULL) ++ + # swab filter test. + TESTS += \ + test-swab-8.sh \ +diff --git a/tests/test-scan-copy.sh b/tests/test-scan-copy.sh +new file mode 100755 +index 00000000..227ad7b2 +--- /dev/null ++++ b/tests/test-scan-copy.sh +@@ -0,0 +1,42 @@ ++#!/usr/bin/env bash ++# nbdkit ++# Copyright (C) 2018-2022 Red Hat Inc. ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions are ++# met: ++# ++# * Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# ++# * Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# ++# * Neither the name of Red Hat nor the names of its contributors may be ++# used to endorse or promote products derived from this software without ++# specific prior written permission. ++# ++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++# SUCH DAMAGE. ++ ++source ./functions.sh ++set -e ++set -x ++ ++requires nbdcopy --version ++requires_plugin sparse-random ++requires_filter scan ++ ++nbdkit -fv -U - sparse-random 1M --filter=scan --run 'nbdcopy "$uri" "$uri"' ++nbdkit -fv -U - sparse-random 1G --filter=scan --run 'nbdcopy "$uri" "$uri"' +diff --git a/tests/test-scan-info.sh b/tests/test-scan-info.sh +new file mode 100755 +index 00000000..6b109ca8 +--- /dev/null ++++ b/tests/test-scan-info.sh +@@ -0,0 +1,46 @@ ++#!/usr/bin/env bash ++# nbdkit ++# Copyright (C) 2018-2022 Red Hat Inc. ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions are ++# met: ++# ++# * Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# ++# * Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# ++# * Neither the name of Red Hat nor the names of its contributors may be ++# used to endorse or promote products derived from this software without ++# specific prior written permission. ++# ++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++# SUCH DAMAGE. ++ ++source ./functions.sh ++set -e ++set -x ++ ++requires nbdinfo --version ++requires_filter scan ++ ++# We're just testing that there are no problematic races with the ++# background thread. ++ ++nbdkit -fv -U - memory 1 --filter=scan --run 'nbdinfo $uri' ++nbdkit -fv -U - memory 1M --filter=scan --run 'nbdinfo $uri' ++nbdkit -fv -U - memory 1G --filter=scan --run 'nbdinfo $uri' ++nbdkit -fv -U - memory 1G --filter=scan -e test --run 'nbdinfo $uri' +-- +2.31.1 + diff --git a/0014-scan-Remove-condition-variable.patch b/0014-scan-Remove-condition-variable.patch new file mode 100644 index 0000000..dea3b68 --- /dev/null +++ b/0014-scan-Remove-condition-variable.patch @@ -0,0 +1,67 @@ +From 6087920696f9f8e727a126093ec85219a9786522 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 14 May 2022 18:54:32 +0100 +Subject: [PATCH] scan: Remove condition variable + +This was copied in from the readahead filter code, but is not actually +needed in this filter because it never has to sleep waiting for a +command. + +Fixes: commit 65c20a09ceacb4431986a2982f2c2e746df63fcb +(cherry picked from commit 43ad586698347997cdfa1bd56bfed0292f89f134) +--- + filters/scan/scan.c | 6 ------ + filters/scan/scan.h | 1 - + 2 files changed, 7 deletions(-) + +diff --git a/filters/scan/scan.c b/filters/scan/scan.c +index ac5b18d2..8a966577 100644 +--- a/filters/scan/scan.c ++++ b/filters/scan/scan.c +@@ -136,9 +136,6 @@ send_command_to_background_thread (struct bgthread_ctrl *ctrl, + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&ctrl->lock); + if (command_queue_append (&ctrl->cmds, cmd) == -1) + return -1; +- /* Signal the thread if it could be sleeping on an empty queue. */ +- if (ctrl->cmds.len == 1) +- pthread_cond_signal (&ctrl->cond); + return 0; + } + +@@ -199,13 +196,11 @@ scan_prepare (nbdkit_next *next, void *handle, int readonly) + /* Create the background thread. */ + h->ctrl.cmds = (command_queue) empty_vector; + pthread_mutex_init (&h->ctrl.lock, NULL); +- pthread_cond_init (&h->ctrl.cond, NULL); + + err = pthread_create (&h->thread, NULL, scan_thread, &h->ctrl); + if (err != 0) { + errno = err; + nbdkit_error ("pthread_create: %m"); +- pthread_cond_destroy (&h->ctrl.cond); + pthread_mutex_destroy (&h->ctrl.lock); + return -1; + } +@@ -227,7 +222,6 @@ scan_finalize (nbdkit_next *next, void *handle) + + send_command_to_background_thread (&h->ctrl, quit_cmd); + pthread_join (h->thread, NULL); +- pthread_cond_destroy (&h->ctrl.cond); + pthread_mutex_destroy (&h->ctrl.lock); + command_queue_reset (&h->ctrl.cmds); + h->running = false; +diff --git a/filters/scan/scan.h b/filters/scan/scan.h +index 7ff39310..98c0228b 100644 +--- a/filters/scan/scan.h ++++ b/filters/scan/scan.h +@@ -54,7 +54,6 @@ DEFINE_VECTOR_TYPE(command_queue, struct command); + struct bgthread_ctrl { + command_queue cmds; /* Command queue. */ + pthread_mutex_t lock; /* Lock for queue. */ +- pthread_cond_t cond; /* Condition queue size 0 -> 1. */ + nbdkit_next *next; /* For sending cache operations. */ + }; + +-- +2.31.1 + diff --git a/0015-scan-Small-typographical-fix-in-manual.patch b/0015-scan-Small-typographical-fix-in-manual.patch new file mode 100644 index 0000000..fdfe7a5 --- /dev/null +++ b/0015-scan-Small-typographical-fix-in-manual.patch @@ -0,0 +1,57 @@ +From b827d9b373e53468e7c94b4dfee27f0e12310a35 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 14 May 2022 19:02:48 +0100 +Subject: [PATCH] scan: Small typographical fix in manual + +Fixes: commit 65c20a09ceacb4431986a2982f2c2e746df63fcb +(cherry picked from commit 67d4e3437d2e28fa3ce1c4b3818d2b1e7939c5ec) +--- + filters/scan/nbdkit-scan-filter.pod | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/filters/scan/nbdkit-scan-filter.pod b/filters/scan/nbdkit-scan-filter.pod +index 4a8d0ef9..2fe9bb80 100644 +--- a/filters/scan/nbdkit-scan-filter.pod ++++ b/filters/scan/nbdkit-scan-filter.pod +@@ -26,8 +26,8 @@ below (after) this filter, giving approximately the same effect. + L can be used instead of nbdkit-cache-filter, if + you add the C option. + +-Various C parameters can be used to tune scanning, although +-the defaults should be suitable in most cases. ++Various parameters can be used to tune scanning, although the defaults ++should be suitable in most cases. + + A similar filter is L. + +@@ -38,23 +38,23 @@ filter will print a warning message if this happens. + + =over 4 + +-=item Thread model must be parallel * ++=item Thread model must be parallel* + + For example L only supports + C, and so this filter cannot perform prefetches in + parallel with the read requests. + +-=item Only scans while clients are connected * ++=item Only scans while clients are connected* + + The current filter only scans while there is at least one client + connected. + +-=item Only scans the default export * ++=item Only scans the default export* + + The current filter only scans the default export and ignores all + clients connecting to the non-default export name. + +-* We may be able to lift these restrictions in future. ++*We may be able to lift these restrictions in future. + + =item Underlying filters or plugin must support C<.cache> (prefetch) + +-- +2.31.1 + diff --git a/0016-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch b/0016-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch new file mode 100644 index 0000000..f1d7781 --- /dev/null +++ b/0016-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch @@ -0,0 +1,34 @@ +From 5d74215f62f62dedcbf5750f111cc1af440bbb36 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 14 May 2022 20:57:38 +0100 +Subject: [PATCH] ssh: Don't reference readahead or scan filters from this + plugin + +These filters do not support plugins which do not use the parallel +thread model. + +Fixes: commit 2ff548d66ad3eae87868402ec5b3319edd12090f +Fixes: commit 65c20a09ceacb4431986a2982f2c2e746df63fcb +See-also: commit 92fbb76d11b9f17c527debd803aa2505f3642783 +(cherry picked from commit 7eb356719376c4d0b2379cea5d39c81602d2d304) +--- + plugins/ssh/nbdkit-ssh-plugin.pod | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/plugins/ssh/nbdkit-ssh-plugin.pod b/plugins/ssh/nbdkit-ssh-plugin.pod +index 214957d6..bb922d37 100644 +--- a/plugins/ssh/nbdkit-ssh-plugin.pod ++++ b/plugins/ssh/nbdkit-ssh-plugin.pod +@@ -347,9 +347,7 @@ C first appeared in nbdkit 1.12. + L, + L, + L, +-L, + L, +-L, + L, + L, + L, +-- +2.31.1 + diff --git a/0017-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch b/0017-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch new file mode 100644 index 0000000..8167a81 --- /dev/null +++ b/0017-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch @@ -0,0 +1,56 @@ +From 010c19b3b77b12d5070ae380e4293ba8f2b39a4a Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 17 May 2022 13:20:17 +0100 +Subject: [PATCH] scan: Fix bound so we don't try to prefetch beyond end of + disk + +An off-by-one error in the bound could cause the filter to try to +prefetch beyond the end of the underlying plugin. This would cause +nbdkit to crash with this assertion failure: + +nbdkit: backend.c:782: backend_cache: Assertion `backend_valid_range (c, offset, count)' failed. + +The sequence of events was: + + - scan filter background thread started + + - client reads to the end of the disk + + - background thread skips ahead to end of disk (offset == size) + + - background thread tries to prefetch from this point + +In the final step the calculations caused to the background thread to +prefetch a scan-size block beyond the end of the plugin. + +Fixes: commit 65c20a09ceacb4431986a2982f2c2e746df63fcb +(cherry picked from commit 953643429b8c57b4dd20a6c0e5b83704ae9a0e88) +--- + filters/scan/bgthread.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/filters/scan/bgthread.c b/filters/scan/bgthread.c +index 384e79b6..5fa5f27f 100644 +--- a/filters/scan/bgthread.c ++++ b/filters/scan/bgthread.c +@@ -113,12 +113,12 @@ scan_thread (void *vp) + } + + adjust_clock (offset); +- if (offset > size) +- continue; + +- /* Issue the next prefetch. */ +- n = MIN (scan_size, size - offset); +- ctrl->next->cache (ctrl->next, n, offset, 0, NULL); ++ if (offset < size) { ++ /* Issue the next prefetch. */ ++ n = MIN (scan_size, size - offset); ++ ctrl->next->cache (ctrl->next, n, offset, 0, NULL); ++ } + } + + if (scan_forever) { +-- +2.31.1 + diff --git a/0018-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch b/0018-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch new file mode 100644 index 0000000..2773a03 --- /dev/null +++ b/0018-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch @@ -0,0 +1,110 @@ +From f335c297cf4f8c3e2a92c626151c514f816816a8 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 10 Jun 2022 22:11:44 +0100 +Subject: [PATCH] tests: Add a regression test for LUKS zeroing crash + +https://listman.redhat.com/archives/libguestfs/2022-June/029188.html +(cherry picked from commit 7ab2ef96803bfc385f786be82ebfdd4cc977d504) +--- + tests/Makefile.am | 2 ++ + tests/test-luks-copy-zero.sh | 70 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 72 insertions(+) + create mode 100755 tests/test-luks-copy-zero.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 6a63e4e8..824232d1 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -1599,11 +1599,13 @@ if HAVE_GNUTLS_PBKDF2 + TESTS += \ + test-luks-info.sh \ + test-luks-copy.sh \ ++ test-luks-copy-zero.sh \ + $(NULL) + endif + EXTRA_DIST += \ + test-luks-info.sh \ + test-luks-copy.sh \ ++ test-luks-copy-zero.sh \ + $(NULL) + + # multi-conn filter test. +diff --git a/tests/test-luks-copy-zero.sh b/tests/test-luks-copy-zero.sh +new file mode 100755 +index 00000000..6ff560e3 +--- /dev/null ++++ b/tests/test-luks-copy-zero.sh +@@ -0,0 +1,70 @@ ++#!/usr/bin/env bash ++# nbdkit ++# Copyright (C) 2018-2022 Red Hat Inc. ++# ++# Redistribution and use in source and binary forms, with or without ++# modification, are permitted provided that the following conditions are ++# met: ++# ++# * Redistributions of source code must retain the above copyright ++# notice, this list of conditions and the following disclaimer. ++# ++# * Redistributions in binary form must reproduce the above copyright ++# notice, this list of conditions and the following disclaimer in the ++# documentation and/or other materials provided with the distribution. ++# ++# * Neither the name of Red Hat nor the names of its contributors may be ++# used to endorse or promote products derived from this software without ++# specific prior written permission. ++# ++# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++# SUCH DAMAGE. ++ ++# Regression test for: ++# https://listman.redhat.com/archives/libguestfs/2022-June/029188.html ++ ++source ./functions.sh ++set -e ++set -x ++ ++requires qemu-img --version ++requires nbdcopy --version ++requires truncate --version ++requires file --version ++requires_filter luks ++ ++encrypt_disk=luks-copy-zero1.img ++zero_disk=luks-copy-zero2.img ++cleanup_fn rm -f $encrypt_disk $zero_disk ++rm -f $encrypt_disk $zero_disk ++ ++# Create an empty encrypted disk container. ++qemu-img create -f luks \ ++ --object secret,data=123456,id=sec0 \ ++ -o key-secret=sec0 \ ++ $encrypt_disk 100M ++ ++# Create an all zeroes disk of the same size. ++truncate -s 100M $zero_disk ++ ++# Using nbdkit-luks-filter, write the zero disk into the encrypted ++# disk. nbdcopy will do this using NBD_CMD_ZERO operations. ++nbdkit -U - -fv \ ++ file $encrypt_disk --filter=luks passphrase=123456 \ ++ --run "nbdcopy -C 1 $zero_disk \$nbd" ++ ++# Check that the encrypted disk is still a LUKS disk. If zeroing is ++# wrong in the filter it's possible that it writes through to the ++# underlying disk, erasing the container. ++file $encrypt_disk ++file $encrypt_disk | grep "LUKS encrypted file" +-- +2.31.1 + diff --git a/0019-rate-Allow-burstiness-to-be-controlled.patch b/0019-rate-Allow-burstiness-to-be-controlled.patch new file mode 100644 index 0000000..971def1 --- /dev/null +++ b/0019-rate-Allow-burstiness-to-be-controlled.patch @@ -0,0 +1,121 @@ +From d21cdcc2913994bcc6871f235cfe00f73273ba7a Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sat, 11 Jun 2022 12:34:02 +0100 +Subject: [PATCH] rate: Allow burstiness to be controlled + +Previously it was fixed at 2.0 seconds. Allowing it to be adjusted +upwards could help with large, lumpy requests. + +(cherry picked from commit f79e951c20510381d5cd83c203c670874a4978f4) +--- + filters/rate/nbdkit-rate-filter.pod | 12 ++++++++++-- + filters/rate/rate.c | 20 +++++++++++++------- + tests/test-rate.sh | 2 +- + 3 files changed, 24 insertions(+), 10 deletions(-) + +diff --git a/filters/rate/nbdkit-rate-filter.pod b/filters/rate/nbdkit-rate-filter.pod +index 8956e641..09ce7dbc 100644 +--- a/filters/rate/nbdkit-rate-filter.pod ++++ b/filters/rate/nbdkit-rate-filter.pod +@@ -9,6 +9,7 @@ nbdkit-rate-filter - limit bandwidth by connection or server + [connection-rate=BITSPERSEC] + [rate-file=FILENAME] + [connection-rate-file=FILENAME] ++ [burstiness=SECS] + + =head1 DESCRIPTION + +@@ -63,6 +64,13 @@ Limit total bandwidth across all connections to C. + Adjust the per-connection or total bandwidth dynamically by writing + C into C. See L below. + ++=item BSECS ++ ++Control the bucket capacity, expressed as a length of time in ++"rate-equivalent seconds" that the client is allowed to burst for ++after a period of inactivity. The default is 2.0 seconds. It's not ++recommended to set this smaller than the default. ++ + =back + + C can be specified as a simple number, or you can use a +@@ -105,8 +113,8 @@ If the size of requests made by your client is much larger than the + rate limit then you can see long, lumpy sleeps in this filter. In the + future we may modify the filter to break up large requests + automatically in order to limit the length of sleeps. Placing the +-L in front of this filter may help in the +-meantime. ++L in front of this filter, or adjusting ++C upwards may help. + + =head1 FILES + +diff --git a/filters/rate/rate.c b/filters/rate/rate.c +index 1a70d212..26082f8c 100644 +--- a/filters/rate/rate.c ++++ b/filters/rate/rate.c +@@ -68,10 +68,9 @@ static char *rate_file = NULL; + + /* Bucket capacity controls the burst rate. It is expressed as the + * length of time in "rate-equivalent seconds" that the client can +- * burst for after a period of inactivity. This could be adjustable +- * in future. ++ * burst for after a period of inactivity. + */ +-#define BUCKET_CAPACITY 2.0 ++static double bucket_capacity = 2.0 /* seconds */; + + /* Global read and write buckets. */ + static struct bucket read_bucket; +@@ -142,6 +141,13 @@ rate_config (nbdkit_next_config *next, nbdkit_backend *nxdata, + return -1; + return 0; + } ++ else if (strcmp (key, "burstiness") == 0) { ++ if (sscanf (value, "%lg", &bucket_capacity) != 1) { ++ nbdkit_error ("burstiness must be a floating point number (seconds)"); ++ return -1; ++ } ++ return 0; ++ } + else + return next (nxdata, key, value); + } +@@ -150,8 +156,8 @@ static int + rate_get_ready (int thread_model) + { + /* Initialize the global buckets. */ +- bucket_init (&read_bucket, rate, BUCKET_CAPACITY); +- bucket_init (&write_bucket, rate, BUCKET_CAPACITY); ++ bucket_init (&read_bucket, rate, bucket_capacity); ++ bucket_init (&write_bucket, rate, bucket_capacity); + + return 0; + } +@@ -178,8 +184,8 @@ rate_open (nbdkit_next_open *next, nbdkit_context *nxdata, + return NULL; + } + +- bucket_init (&h->read_bucket, connection_rate, BUCKET_CAPACITY); +- bucket_init (&h->write_bucket, connection_rate, BUCKET_CAPACITY); ++ bucket_init (&h->read_bucket, connection_rate, bucket_capacity); ++ bucket_init (&h->write_bucket, connection_rate, bucket_capacity); + pthread_mutex_init (&h->read_bucket_lock, NULL); + pthread_mutex_init (&h->write_bucket_lock, NULL); + +diff --git a/tests/test-rate.sh b/tests/test-rate.sh +index 7305c928..ff781c21 100755 +--- a/tests/test-rate.sh ++++ b/tests/test-rate.sh +@@ -56,7 +56,7 @@ nbdkit -U - \ + --filter=blocksize --filter=rate \ + pattern 25M \ + maxdata=65536 \ +- rate=10M \ ++ rate=10M burstiness=2.0 \ + --run 'nbdcopy "$uri" rate.img' + end_t=$SECONDS + +-- +2.31.1 + diff --git a/nbdkit.spec b/nbdkit.spec index 1199e9e..7db77aa 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -52,7 +52,7 @@ ExclusiveArch: x86_64 %global source_directory 1.30-stable Name: nbdkit -Version: 1.30.5 +Version: 1.30.6 Release: 1%{?dist} Summary: NBD server @@ -88,6 +88,15 @@ Patch0007: 0007-luks-Link-with-libcompat-on-Windows.patch Patch0008: 0008-luks-Refactor-the-filter.patch Patch0009: 0009-tests-luks-Reduce-time-taken-to-run-these-tests.patch Patch0010: 0010-Add-nbdkit.parse_size-Python-function.patch +Patch0011: 0011-cache-Fix-cross-reference-nbdkit-readahead-filter.patch +Patch0012: 0012-curl-Don-t-document-curl-plugin-readahead-filter.patch +Patch0013: 0013-New-filter-scan.patch +Patch0014: 0014-scan-Remove-condition-variable.patch +Patch0015: 0015-scan-Small-typographical-fix-in-manual.patch +Patch0016: 0016-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch +Patch0017: 0017-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch +Patch0018: 0018-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch +Patch0019: 0019-rate-Allow-burstiness-to-be-controlled.patch # For automatic RPM Provides generation. # See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html @@ -587,6 +596,8 @@ nbdkit-retry-filter Reopen connection on error. nbdkit-retry-request-filter Retry single requests on error. +nbdkit-scan-filter Prefetch data ahead of sequential reads. + nbdkit-stats-filter Display statistics about operations. nbdkit-swab-filter Filter for swapping byte order. @@ -1072,6 +1083,7 @@ export LIBGUESTFS_TRACE=1 %{_libdir}/%{name}/filters/nbdkit-readahead-filter.so %{_libdir}/%{name}/filters/nbdkit-retry-filter.so %{_libdir}/%{name}/filters/nbdkit-retry-request-filter.so +%{_libdir}/%{name}/filters/nbdkit-scan-filter.so %{_libdir}/%{name}/filters/nbdkit-stats-filter.so %{_libdir}/%{name}/filters/nbdkit-swab-filter.so %{_libdir}/%{name}/filters/nbdkit-tls-fallback-filter.so @@ -1108,6 +1120,7 @@ export LIBGUESTFS_TRACE=1 %{_mandir}/man1/nbdkit-readahead-filter.1* %{_mandir}/man1/nbdkit-retry-filter.1* %{_mandir}/man1/nbdkit-retry-request-filter.1* +%{_mandir}/man1/nbdkit-scan-filter.1* %{_mandir}/man1/nbdkit-stats-filter.1* %{_mandir}/man1/nbdkit-swab-filter.1* %{_mandir}/man1/nbdkit-tls-fallback-filter.1* @@ -1191,8 +1204,8 @@ export LIBGUESTFS_TRACE=1 %changelog -* Tue Apr 26 2022 Richard W.M. Jones - 1.30.5-1 -- Rebase to new stable branch version 1.30.5 +* Mon Jun 13 2022 Richard W.M. Jones - 1.30.6-1 +- Rebase to new stable branch version 1.30.6 resolves: rhbz#2059289 - Add automatic provides generator and subpackage nbdkit-srpm-macros resolves: rhbz#2059291 @@ -1209,7 +1222,9 @@ export LIBGUESTFS_TRACE=1 resolves: rhbz#2083617 - Backport new readahead filter from 1.32. - Backport new LUKS filter from 1.32. +- Backport new scan filter from 1.32. - Add new Python binding for nbdkit_parse_size from 1.32 +- Add new rate filter burstiness setting from 1.32 * Mon Jan 24 2022 Richard W.M. Jones - 1.28.5-1 - Rebase to new stable branch version 1.28.5 diff --git a/sources b/sources index ceac80d..0f3ee8e 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (nbdkit-1.30.5.tar.gz) = 033f06a23f7f227acb8516994582c94033a35d11ff8d7db8ca310b73cf591ea1a4833dbfbaf58e653556a1bcf30cbca21494b7f9e61a1a8cafd566993b24a799 -SHA512 (nbdkit-1.30.5.tar.gz.sig) = c8e342ff168b3308b888658f2958a2ccfd2e2b37664f65d3a71feb495085bd60834b4142103c6cf51e83b5d08f2815ab392b5afe5077b9a8fbfee9218db9bdf1 +SHA512 (nbdkit-1.30.6.tar.gz) = c12b4931411894d59bed32551d1a89326f88e19569ce278531df5de9a2fb32118a6092af83596d99f5a50f792e3cfa676809abb533e75263a3100a0772c008c4 +SHA512 (nbdkit-1.30.6.tar.gz.sig) = 21a7e3f2747f5b9ef7f7c1acfaa21024e1d6dcdc2f541ec8c4146ccffb9c7d8d3b6fb57fe8c9968d5db8454b616dd8e221a2a766baef4528629f0b9f3dd5b835