Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/, sys-fs/zfs-kmod/files/
Date: Wed, 29 May 2019 22:15:09
Message-Id: 1559168069.abf3bbd8488b7eb5177cac9898ccc8ea6d963429.gyakovlev@gentoo
1 commit: abf3bbd8488b7eb5177cac9898ccc8ea6d963429
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 29 22:12:55 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Wed May 29 22:14:29 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abf3bbd8
7
8 sys-fs/zfs-kmod: revbump 0.8.0 with critical patches
9
10 Issue: https://github.com/zfsonlinux/zfs/issues/8816
11 Issue: https://github.com/zfsonlinux/zfs/issues/8778
12 Bug: https://bugs.gentoo.org/635002
13 Package-Manager: Portage-2.3.67, Repoman-2.3.12
14 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
15
16 ....0_Fix_integer_overflow_in_get_next_chunk.patch | 32 ++++
17 .../zfs-kmod/files/0.8.0_revert_Report_holes.patch | 53 ++++++
18 sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild | 178 +++++++++++++++++++++
19 3 files changed, 263 insertions(+)
20
21 diff --git a/sys-fs/zfs-kmod/files/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch b/sys-fs/zfs-kmod/files/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch
22 new file mode 100644
23 index 00000000000..0042bfdc99c
24 --- /dev/null
25 +++ b/sys-fs/zfs-kmod/files/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch
26 @@ -0,0 +1,32 @@
27 +From ec4afd27f198d93a7bd32a05cb288708ba754ada Mon Sep 17 00:00:00 2001
28 +From: madz <olivier.mazouffre@××××××××××××.fr>
29 +Date: Wed, 29 May 2019 19:17:25 +0200
30 +Subject: [PATCH] Fix integer overflow in get_next_chunk()
31 +
32 +dn->dn_datablksz type is uint32_t and need to be casted to uint64_t
33 +to avoid an overflow when the record size is greater than 4 MiB.
34 +
35 +Reviewed-by: Tom Caputi <tcaputi@×××××.com>
36 +Reviewed-by: Brian Behlendorf <behlendorf1@××××.gov>
37 +Signed-off-by: Olivier Mazouffre <olivier.mazouffre@××××××××××××.fr>
38 +Closes #8778
39 +Closes #8797
40 +---
41 + module/zfs/dmu.c | 4 ++--
42 + 1 file changed, 2 insertions(+), 2 deletions(-)
43 +
44 +diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c
45 +index 1697a632078..a283b062238 100644
46 +--- a/module/zfs/dmu.c
47 ++++ b/module/zfs/dmu.c
48 +@@ -719,8 +719,8 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum, uint64_t *l1blks)
49 + uint64_t blks;
50 + uint64_t maxblks = DMU_MAX_ACCESS >> (dn->dn_indblkshift + 1);
51 + /* bytes of data covered by a level-1 indirect block */
52 +- uint64_t iblkrange =
53 +- dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT);
54 ++ uint64_t iblkrange = (uint64_t)dn->dn_datablksz *
55 ++ EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT);
56 +
57 + ASSERT3U(minimum, <=, *start);
58 +
59
60 diff --git a/sys-fs/zfs-kmod/files/0.8.0_revert_Report_holes.patch b/sys-fs/zfs-kmod/files/0.8.0_revert_Report_holes.patch
61 new file mode 100644
62 index 00000000000..f8d67ccc7ce
63 --- /dev/null
64 +++ b/sys-fs/zfs-kmod/files/0.8.0_revert_Report_holes.patch
65 @@ -0,0 +1,53 @@
66 +From: Georgy Yakovlev <gyakovlev@g.o>
67 +Date: Wed, 29 May 2019 14:38:15 -0700
68 +Subject: Revert [PATCH] Report holes when there are only metadata changes
69 +
70 +This reverts ec4f9b8f30391a3fb46c8d4a31c2dc9250dca1bb
71 +Issue: https://github.com/zfsonlinux/zfs/issues/8816
72 +Bug: https://bugs.gentoo.org/635002
73 +---
74 +--- b/module/zfs/dmu.c
75 ++++ a/module/zfs/dmu.c
76 +@@ -2366,39 +2366,14 @@
77 + return (err);
78 +
79 + /*
80 ++ * Check if dnode is dirty
81 +- * Check if there are dirty data blocks or frees which have not been
82 +- * synced. Dirty spill and bonus blocks which are external to the
83 +- * object can ignored when reporting holes.
84 + */
85 +- mutex_enter(&dn->dn_mtx);
86 + for (i = 0; i < TXG_SIZE; i++) {
87 + if (multilist_link_active(&dn->dn_dirty_link[i])) {
88 ++ clean = B_FALSE;
89 ++ break;
90 +-
91 +- if (dn->dn_free_ranges[i] != NULL) {
92 +- clean = B_FALSE;
93 +- break;
94 +- }
95 +-
96 +- list_t *list = &dn->dn_dirty_records[i];
97 +- dbuf_dirty_record_t *dr;
98 +-
99 +- for (dr = list_head(list); dr != NULL;
100 +- dr = list_next(list, dr)) {
101 +- dmu_buf_impl_t *db = dr->dr_dbuf;
102 +-
103 +- if (db->db_blkid == DMU_SPILL_BLKID ||
104 +- db->db_blkid == DMU_BONUS_BLKID)
105 +- continue;
106 +-
107 +- clean = B_FALSE;
108 +- break;
109 +- }
110 + }
111 +-
112 +- if (clean == B_FALSE)
113 +- break;
114 + }
115 +- mutex_exit(&dn->dn_mtx);
116 +
117 + /*
118 + * If compatibility option is on, sync any current changes before
119
120 diff --git a/sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild
121 new file mode 100644
122 index 00000000000..0108a7a9b3b
123 --- /dev/null
124 +++ b/sys-fs/zfs-kmod/zfs-kmod-0.8.0-r1.ebuild
125 @@ -0,0 +1,178 @@
126 +# Copyright 1999-2019 Gentoo Authors
127 +# Distributed under the terms of the GNU General Public License v2
128 +
129 +EAPI=7
130 +
131 +inherit flag-o-matic linux-info linux-mod toolchain-funcs
132 +
133 +DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
134 +HOMEPAGE="https://zfsonlinux.org/"
135 +
136 +if [[ ${PV} == "9999" ]]; then
137 + inherit autotools git-r3
138 + EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
139 +else
140 + SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz"
141 + KEYWORDS="~amd64"
142 + S="${WORKDIR}/zfs-${PV}"
143 + ZFS_KERNEL_COMPAT="5.1"
144 +fi
145 +
146 +LICENSE="CDDL debug? ( GPL-2+ )"
147 +SLOT="0"
148 +IUSE="custom-cflags debug +rootfs"
149 +
150 +DEPEND=""
151 +
152 +RDEPEND="${DEPEND}
153 + !sys-fs/zfs-fuse
154 + !sys-kernel/spl
155 +"
156 +
157 +BDEPEND="
158 + dev-lang/perl
159 + virtual/awk
160 +"
161 +
162 +RESTRICT="debug? ( strip ) test"
163 +
164 +DOCS=( AUTHORS COPYRIGHT META README.md )
165 +
166 +PATCHES=(
167 + "${FILESDIR}"/0.8.0_revert_Report_holes.patch
168 + "${FILESDIR}"/0.8.0_Fix_integer_overflow_in_get_next_chunk.patch
169 +)
170 +
171 +pkg_setup() {
172 + linux-info_pkg_setup
173 +
174 + CONFIG_CHECK="
175 + !DEBUG_LOCK_ALLOC
176 + EFI_PARTITION
177 + MODULES
178 + !PAX_KERNEXEC_PLUGIN_METHOD_OR
179 + !TRIM_UNUSED_KSYMS
180 + ZLIB_DEFLATE
181 + ZLIB_INFLATE
182 + "
183 +
184 + use debug && CONFIG_CHECK="${CONFIG_CHECK}
185 + FRAME_POINTER
186 + DEBUG_INFO
187 + !DEBUG_INFO_REDUCED
188 + "
189 +
190 + use rootfs && \
191 + CONFIG_CHECK="${CONFIG_CHECK}
192 + BLK_DEV_INITRD
193 + DEVTMPFS
194 + "
195 +
196 + kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
197 +
198 + kernel_is -ge 2 6 32 || die "Linux 2.6.32 or newer required"
199 +
200 + if [[ ${PV} != "9999" ]]; then
201 + local kv_major_max kv_minor_max zcompat
202 + zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
203 + kv_major_max="${zcompat%%.*}"
204 + zcompat="${zcompat#*.}"
205 + kv_minor_max="${zcompat%%.*}"
206 + kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
207 + "Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
208 + fi
209 +
210 + check_extra_config
211 +}
212 +
213 +src_prepare() {
214 + default
215 +
216 + if [[ ${PV} == "9999" ]]; then
217 + eautoreconf
218 + else
219 + # Set module revision number
220 + sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
221 + fi
222 +
223 + # Remove GPLv2-licensed ZPIOS unless we are debugging
224 + use debug || sed -e 's/^subdir-m += zpios$//' -i module/Makefile.in
225 +}
226 +
227 +src_configure() {
228 + set_arch_to_kernel
229 +
230 + use custom-cflags || strip-flags
231 +
232 + filter-ldflags -Wl,*
233 +
234 + local myconf=(
235 + --bindir="${EPREFIX}/bin"
236 + --sbindir="${EPREFIX}/sbin"
237 + --with-config=kernel
238 + --with-linux="${KV_DIR}"
239 + --with-linux-obj="${KV_OUT_DIR}"
240 + $(use_enable debug)
241 + )
242 +
243 + econf "${myconf[@]}"
244 +}
245 +
246 +src_compile() {
247 + set_arch_to_kernel
248 +
249 + myemakeargs=( V=1 )
250 +
251 + emake "${myemakeargs[@]}"
252 +}
253 +
254 +src_install() {
255 + set_arch_to_kernel
256 +
257 + myemakeargs+=(
258 + DEPMOD="/bin/true"
259 + DESTDIR="${D}"
260 + INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
261 + )
262 +
263 + emake "${myemakeargs[@]}" install
264 +
265 + einstalldocs
266 +}
267 +
268 +pkg_postinst() {
269 + linux-mod_pkg_postinst
270 +
271 + # Remove old modules
272 + if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
273 + ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
274 + ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
275 + ewarn "Automatically removing old modules to avoid problems."
276 + rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
277 + rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
278 + fi
279 +
280 + if use x86 || use arm; then
281 + ewarn "32-bit kernels will likely require increasing vmalloc to"
282 + ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
283 + fi
284 +
285 + ewarn "This version of ZFSOnLinux includes support for new feature flags"
286 + ewarn "that are incompatible with previous versions. GRUB2 support for"
287 + ewarn "/boot with the new feature flags is not yet available."
288 + ewarn "Do *NOT* upgrade root pools to use the new feature flags."
289 + ewarn "Any new pools will be created with the new feature flags by default"
290 + ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
291 + ewarn "create a newpool that is backward compatible wih GRUB2, use "
292 + ewarn
293 + ewarn "zpool create -d -o feature@async_destroy=enabled "
294 + ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
295 + ewarn " -o feature@spacemap_histogram=enabled"
296 + ewarn " -o feature@enabled_txg=enabled "
297 + ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
298 + ewarn " ..."
299 + ewarn
300 + ewarn "GRUB2 support will be updated as soon as either the GRUB2"
301 + ewarn "developers do a tag or the Gentoo developers find time to backport"
302 + ewarn "support from GRUB2 HEAD."
303 +}