svn commit: r421966 - in head/sysutils/e2fsprogs: . files
Matthias Andree
mandree at FreeBSD.org
Mon Sep 12 23:05:24 UTC 2016
Author: mandree
Date: Mon Sep 12 23:05:22 2016
New Revision: 421966
URL: https://svnweb.freebsd.org/changeset/ports/421966
Log:
Fix bounced I/O on unaligned buffers (FreeBSD 11+)
The bounce-buffer I/O driver fix in patch-lib_ext2fs_unix__io.c is a
prototypical fix, and has been forwarded upstream, but it permits us to
pass all self-tests (mostly undo-related) that were still failing on
11.0-RC2 amd64. There is some potential for optimization,
posix_memalign() might save us quite a few memcpy() calls and replace
the now-repaired code paths by a simple pread[64]() or pwrite[64]().
Remove BROKEN, but insist (by setting BROKEN conditionally) on anything
that is FreeBSD 11 or newer, or non-i386/non-amd64, that the user runs
at least the small self-tests.
Revise option descriptions a bit.
Bump PORTREVISION.
Modified:
head/sysutils/e2fsprogs/Makefile
head/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c
Modified: head/sysutils/e2fsprogs/Makefile
==============================================================================
--- head/sysutils/e2fsprogs/Makefile Mon Sep 12 22:52:05 2016 (r421965)
+++ head/sysutils/e2fsprogs/Makefile Mon Sep 12 23:05:22 2016 (r421966)
@@ -3,7 +3,7 @@
PORTNAME= e2fsprogs
PORTVERSION= 1.43.3
-PORTREVISION?= 2
+PORTREVISION?= 3
CATEGORIES?= sysutils
MASTER_SITES= KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION}
@@ -38,9 +38,9 @@ OPTIONS_SINGLE= SELFTEST
OPTIONS_SINGLE_SELFTEST= NOTESTS SMALLTESTS ALLTESTS
OPTIONS_DEFAULT= SMALLTESTS
SELFTEST_DESC= Choose which set of self-tests to run
-NOTESTS_DESC= Do not run any self-tests (DISCOURAGED)
-SMALLTESTS_DESC=Run sets that fit into 500 MB disk space (DEFAULT)
-ALLTESTS_DESC= Run all self-tests
+NOTESTS_DESC= Do not run any self-tests (only Tier-1 & DISCOURAGED)
+SMALLTESTS_DESC=Run tests that fit into 500 MB disk space (DEFAULT)
+ALLTESTS_DESC= Run most self-tests (requires more RAM & disk space)
PARALLELTESTS_DESC= Run self-tests in parallel (requires more disk space)
post-extract:
@@ -136,19 +136,13 @@ post-patch::
.endfor
.endif
.endif
-# XXX remove these on the next revision
-.if ${MASTERDIR} == ${.CURDIR} && ${OPSYS} == FreeBSD && ${OSVERSION} >= 1100000 && ${PORTVERSION} == 1.43.3 && ${PORTREVISION} == 2
-.for i in u_mke2fs_opt_oddsize u_mke2fs_opt_offset
- @${MV} ${WRKSRC}/tests/${i} ${WRKSRC}/tests/disabled_test-${i}
-.endfor
-.endif
# Master port stuff that is not to be seen by the slave ports.
.if ${MASTERDIR} == ${.CURDIR}
# NOTE: The previous .if block goes all the way to the end of the file.
-.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1100000
-BROKEN=Not ready for production on FreeBSD 11+, some e2undo cases are still failing.
+.if !empty(PORT_OPTIONS:MNOTESTS) && (${OPSYS} == FreeBSD) && (${OSVERSION} >= 1100000 || ((${ARCH} != i386) && (${ARCH} != amd64)))
+BROKEN=e2fsprogs has not been tested on your system by the maintainer. You must run self-tests.
.endif
pre-build:
Modified: head/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c
==============================================================================
--- head/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c Mon Sep 12 22:52:05 2016 (r421965)
+++ head/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c Mon Sep 12 23:05:22 2016 (r421966)
@@ -1,19 +1,56 @@
-commit d6cad379eb6c86ca58bf5b83a586577de412a2e6
-Author: Theodore Ts'o <tytso at mit.edu>
-Date: Sun Sep 11 00:25:48 2016 -0400
-
- libext2fs: fix unaligned, multiblock writes in the unix_io handler
-
- The read-modify-write code for the unaligned fallback code wasn't
- working for multi-block writes. This was unmasked by FreeBSD 11-rc2,
- since its malloc() is returning unaligned memory regions for large
- memory regions.
-
- Signed-off-by: Theodore Ts'o <tytso at mit.edu>
-
--- lib/ext2fs/unix_io.c.orig 2016-09-02 04:17:32 UTC
+++ lib/ext2fs/unix_io.c
-@@ -300,6 +300,7 @@ static errcode_t raw_write_blk(io_channe
+@@ -188,16 +188,24 @@ static errcode_t raw_read_blk(io_channel
+ * The buffer or size which we're trying to read isn't aligned
+ * to the O_DIRECT rules, so we need to do this the hard way...
+ */
+- while (size > 0) {
+- actual = read(data->dev, data->bounce, channel->block_size);
+- if (actual != channel->block_size)
+- goto short_read;
+- actual = size;
+- if (size > channel->block_size)
+- actual = channel->block_size;
+- memcpy(buf, data->bounce, actual);
+- size -= actual;
+- buf += actual;
++ {
++ ssize_t really_read = 0;
++ while (size > 0) {
++ actual = read(data->dev, data->bounce, channel->block_size);
++ if (actual != channel->block_size) {
++ actual = really_read;
++ buf -= really_read;
++ size += really_read;
++ goto short_read;
++ }
++ actual = size;
++ if (size > channel->block_size)
++ actual = channel->block_size;
++ memcpy(buf, data->bounce, actual);
++ really_read += actual;
++ size -= actual;
++ buf += actual;
++ }
+ }
+ return 0;
+
+@@ -283,8 +291,12 @@ static errcode_t raw_write_blk(io_channe
+ actual = read(data->dev, data->bounce,
+ channel->block_size);
+ if (actual != channel->block_size) {
+- retval = EXT2_ET_SHORT_READ;
+- goto error_out;
++ if (actual >= 0) {
++ memset(data->bounce + actual, 0, channel->block_size - actual);
++ } else {
++ retval = EXT2_ET_SHORT_READ;
++ goto error_out;
++ }
+ }
+ }
+ actual = size;
+@@ -300,6 +312,7 @@ static errcode_t raw_write_blk(io_channe
goto short_write;
size -= actual;
buf += actual;
More information about the svn-ports-all
mailing list