[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150112101437.GD4468@quack.suse.cz>
Date: Mon, 12 Jan 2015 11:14:37 +0100
From: Jan Kara <jack@...e.cz>
To: Fabian Frederick <fabf@...net.be>
Cc: linux-kernel@...r.kernel.org, Jan Kara <jack@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/1 linux-next] fs/affs/file.c: fix direct IO writes
beyond EOF
On Fri 09-01-15 22:19:43, Fabian Frederick wrote:
> 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.
>
> Cc: Jan Kara <jack@...e.cz>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@...net.be>
Yes, this looks fine to me. You can add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> Ideal solution suggested by Jan Kara would be to use cont_write_begin but
> affs direct_IO shouldn't be used a lot anyway...
>
> fs/affs/file.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/fs/affs/file.c b/fs/affs/file.c
> index 7e83ba2..d2468bf 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,
> size_t count = iov_iter_count(iter);
> ssize_t ret;
>
> + if (rw == WRITE) {
> + loff_t size = offset + count;
> +
> + if (AFFS_I(inode)->mmu_private < size)
> + return 0;
> + }
> +
> ret = blockdev_direct_IO(rw, iocb, inode, iter, offset, affs_get_block);
> if (ret < 0 && (rw & WRITE))
> affs_write_failed(mapping, offset + count);
> --
> 2.1.0
>
--
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists