diff options
author | Fabian Frederick <fabf@skynet.be> | 2015-02-17 16:46:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 17:34:52 -0500 |
commit | 92b20708f9f0c6429b3b6865de567e721f509c75 (patch) | |
tree | 384d16158bc762c47ff9ff0c2c3c2205b28acc28 /fs/affs | |
parent | afe305dcc96edc06aec923a0f5fa07ff654b2489 (diff) |
fs/affs/file.c: fix direct IO writes beyond EOF
Use the same fallback to normal IO in case of write
operations beyond EOF as fat direct IO. This patch fixes
fsx file -d -Z -r 4096 -w 4096
Report:
129(129 mod 256): TRUNCATE DOWN from 0x3ff01 to 0xb3f6
130(130 mod 256): WRITE 0x22000 thru 0x2dfff (0xc000 bytes) HOLE
Thanks to Jan for helping me on this problem.
The ideal solution suggested by Jan Kara would be to use
cont_write_begin() but affs direct_IO shouldn't be used a lot anyway...
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/affs')
-rw-r--r-- | fs/affs/file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c index 7e83ba22bed4..d2468bf95669 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -398,6 +398,13 @@ affs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, | |||
398 | size_t count = iov_iter_count(iter); | 398 | size_t count = iov_iter_count(iter); |
399 | ssize_t ret; | 399 | ssize_t ret; |
400 | 400 | ||
401 | if (rw == WRITE) { | ||
402 | loff_t size = offset + count; | ||
403 | |||
404 | if (AFFS_I(inode)->mmu_private < size) | ||
405 | return 0; | ||
406 | } | ||
407 | |||
401 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block); | 408 | ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block); |
402 | if (ret < 0 && (rw & WRITE)) | 409 | if (ret < 0 && (rw & WRITE)) |
403 | affs_write_failed(mapping, offset + count); | 410 | affs_write_failed(mapping, offset + count); |