From: Martin Steigerwald <Martin@lichtvoll.de>
To: Liu Bo <bo.li.liu@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix compressed write corruption on enospc
Date: Fri, 25 Jul 2014 11:54:37 +0200 [thread overview]
Message-ID: <1537782.AGn1dfcASJ@merkaba> (raw)
In-Reply-To: <1406213285-19607-1-git-send-email-bo.li.liu@oracle.com>
Am Donnerstag, 24. Juli 2014, 22:48:05 schrieben Sie:
> When failing to allocate space for the whole compressed extent, we'll
> fallback to uncompressed IO, but we've forgotten to redirty the pages
> which belong to this compressed extent, and these 'clean' pages will
> simply skip 'submit' part and go to endio directly, at last we got data
> corruption as we write nothing.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/inode.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 3668048..8ea7610 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -709,6 +709,18 @@ retry:
> unlock_extent(io_tree, async_extent->start,
> async_extent->start +
> async_extent->ram_size - 1);
> +
> + /*
> + * we need to redirty the pages if we decide to
> + * fallback to uncompressed IO, otherwise we
> + * will not submit these pages down to lower
> + * layers.
> + */
> + extent_range_redirty_for_io(inode,
> + async_extent->start,
> + async_extent->start +
> + async_extent->ram_size - 1);
> +
> goto retry;
> }
> goto out_free;
I am testing this currently. So far no lockup. Lets see. Still has not filled
the the block device with trees completely after I balanced them:
Label: 'home' uuid: […]
Total devices 2 FS bytes used 125.57GiB
devid 1 size 160.00GiB used 153.00GiB path /dev/dm-0
devid 2 size 160.00GiB used 153.00GiB path /dev/mapper/sata-home
I believe the lockups happen more easily if the trees occupy all of disk
space. Well I will do some compiling of some KDE components which may let
BTRFS fill all space again.
This patch will mean it when it can´t make enough free space in the
(fragmented) tree it will write uncompressed?
This would mean that one would have a defragment trees regularily to allow for
writes to happen compressed at all times.
Well… of course still better than lockup or corruption.
Ciao,
--
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7
next prev parent reply other threads:[~2014-07-25 9:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 14:48 [PATCH] Btrfs: fix compressed write corruption on enospc Liu Bo
2014-07-24 14:55 ` Chris Mason
2014-07-25 1:00 ` Liu Bo
2014-07-25 9:58 ` Martin Steigerwald
2014-07-25 1:53 ` Wang Shilong
2014-07-25 2:08 ` Liu Bo
2014-07-25 2:11 ` Wang Shilong
2014-07-25 9:54 ` Martin Steigerwald [this message]
2014-08-04 12:50 ` Martin Steigerwald
2014-08-04 12:52 ` Martin Steigerwald
2014-08-06 10:21 ` Martin Steigerwald
2014-08-06 10:29 ` Hugo Mills
2014-08-06 12:28 ` Martin Steigerwald
2014-08-06 13:35 ` Chris Mason
2014-08-06 14:43 ` Martin Steigerwald
2014-08-06 15:18 ` Chris Mason
2014-08-07 0:52 ` Chris Mason
2014-08-07 7:50 ` Liu Bo
2014-08-07 8:20 ` Miao Xie
2014-08-07 14:02 ` Chris Mason
2014-08-10 14:55 ` Liu Bo
2014-08-11 20:35 ` Chris Mason
2014-08-12 2:55 ` Miao Xie
2014-08-12 7:51 ` Liu Bo
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=1537782.AGn1dfcASJ@merkaba \
--to=martin@lichtvoll.de \
--cc=bo.li.liu@oracle.com \
--cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).