From: Jan Kara <jack@suse.cz>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1 linux-next] fs/affs/file.c: fix direct IO writes beyond EOF
Date: Mon, 12 Jan 2015 11:14:37 +0100 [thread overview]
Message-ID: <20150112101437.GD4468@quack.suse.cz> (raw)
In-Reply-To: <1420838383-6638-1-git-send-email-fabf@skynet.be>
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@suse.cz>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
Yes, this looks fine to me. You can add:
Reviewed-by: Jan Kara <jack@suse.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@suse.cz>
SUSE Labs, CR
prev parent reply other threads:[~2015-01-12 10:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-09 21:19 Fabian Frederick
2015-01-12 10:14 ` Jan Kara [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150112101437.GD4468@quack.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=fabf@skynet.be \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome