From: Jan Kara <jack@suse.cz>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com, sandeen@sandeen.net
Subject: Re: [PATCH 1/2] dio: track and serialise unaligned direct IO
Date: Mon, 2 Aug 2010 20:50:53 +0200 [thread overview]
Message-ID: <20100802185052.GK3278@quack.suse.cz> (raw)
In-Reply-To: <1280733945-16231-2-git-send-email-david@fromorbit.com>
On Mon 02-08-10 17:25:44, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> If we get two unaligned direct IO's to the same filesystem block
> that is marked as a new allocation (i.e. buffer_new), then both IOs
> will zero the portion of the block they are not writing data to. As
> a result, when the IOs complete there will be a portion of the block
> that contains zeros from the last IO to complete rather than the
> data that should be there.
>
> This is easily manifested by qemu using aio+dio with an unaligned
> guest filesystem - every IO is unaligned and fileystem corruption is
> encountered in the guest filesystem. xfstest 240 (from Eric Sandeen)
> is also a simple reproducer.
>
> To avoid this problem, track unaligned IO that triggers sub-block
> zeroing and check new incoming unaligned IO that require sub-block
> zeroing against that list. If we get an overlap where the start and
> end of unaligned IOs hit the same filesystem block, then we need to
> block the incoming IOs until the IO that is zeroing the block
> completes. The blocked IO can then continue without needing to do
> any zeroing and hence won't overwrite valid data with zeros.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
...
> +/*
> + * Add a filesystem block to the list of blocks we are tracking.
> + */
> +static void
> +dio_start_zero_block(struct dio *dio, sector_t zero_block)
> +{
> + struct dio_zero_block *zb;
> +
> + zb = kmalloc(sizeof(*zb), GFP_NOIO);
> + if (!zb)
> + return;
Ho hum, so if the allocation fails, we will just silently corrupt the
data anyway? Not good I think.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-08-02 18:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 7:25 [PATCH 0/2] dio: serialise unaligned direct IO V2 Dave Chinner
2010-08-02 7:25 ` [PATCH 1/2] dio: track and serialise unaligned direct IO Dave Chinner
2010-08-02 9:30 ` Christoph Hellwig
2010-08-02 18:50 ` Jan Kara [this message]
2010-08-02 7:25 ` [PATCH 2/2] dio: scale unaligned IO tracking via multiple lists Dave Chinner
2010-08-02 9:32 ` Christoph Hellwig
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=20100802185052.GK3278@quack.suse.cz \
--to=jack@suse.cz \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sandeen@sandeen.net \
--cc=xfs@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).