aboutsummaryrefslogtreecommitdiff
path: root/sysutils/e2fsprogs/files
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2016-09-12 23:05:22 +0000
committerMatthias Andree <mandree@FreeBSD.org>2016-09-12 23:05:22 +0000
commit25ddbb284b954969e2d6e829851c90d25fe1b352 (patch)
tree5a469f4ad29ec211c99acc8344cce853908c8d81 /sysutils/e2fsprogs/files
parent1563c9ac553e3e6876273555a15ce5dcbc839743 (diff)
downloadports-25ddbb284b954969e2d6e829851c90d25fe1b352.tar.gz
ports-25ddbb284b954969e2d6e829851c90d25fe1b352.zip
Notes
Diffstat (limited to 'sysutils/e2fsprogs/files')
-rw-r--r--sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c65
1 files changed, 51 insertions, 14 deletions
diff --git a/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c b/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c
index fc03ebcd531f..4e7ae25ab81d 100644
--- a/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c
+++ b/sysutils/e2fsprogs/files/patch-lib_ext2fs_unix__io.c
@@ -1,19 +1,56 @@
-commit d6cad379eb6c86ca58bf5b83a586577de412a2e6
-Author: Theodore Ts'o <tytso@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@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;