From: Chris Mason <clm@fb.com>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>, <linux-btrfs@vger.kernel.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH v2] btrfs: Change the expanding write sequence to fix snapshot related bug.
Date: Mon, 14 Apr 2014 08:46:48 -0400 [thread overview]
Message-ID: <534BD8B8.9000108@fb.com> (raw)
In-Reply-To: <1397443448-20367-1-git-send-email-quwenruo@cn.fujitsu.com>
On 04/13/2014 10:44 PM, Qu Wenruo wrote:
> When testing fsstress with snapshot making background, some snapshot
> following problem.
>
> Snapshot 270:
> inode 323: size 0
>
> Snapshot 271:
> inode 323: size 349145
> |-------Hole---|---------Empty gap-------|-------Hole-----|
> 0 122880 172032 349145
>
> Snapshot 272:
> inode 323: size 349145
> |-------Hole---|------------Data---------|-------Hole-----|
> 0 122880 172032 349145
>
> The fsstress operation on inode 323 is the following:
> write: offset 126832 len 43124
> truncate: size 349145
>
> Since the write with offset is consist of 2 operations:
> 1. punch hole
> 2. write data
> Hole punching is faster than data write, so hole punching in write
> and truncate is done first and then buffered write, so the snapshot 271 got
> empty gap, which will not pass btrfsck.
>
> To fix the bug, this patch will change the write sequence which will
> first punch a hole covering the write end if a hole is needed.
>
> Reported-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> Cc: Al Viro <viro@ZenIV.linux.org.uk>
> Signed-off-by: Chris Mason <clm@fb.com>
> ---
> changelog:
> v2:
> Use 'pos + count' instead of 'pos + iov->iov_len' to deal with
> multi-seg iov.
Thanks for the review Al. Qu, could you please send an incremental?
-chris
prev parent reply other threads:[~2014-04-14 12:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 2:44 [PATCH v2] btrfs: Change the expanding write sequence to fix snapshot related bug Qu Wenruo
2014-04-14 12:46 ` Chris Mason [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=534BD8B8.9000108@fb.com \
--to=clm@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.com \
--cc=viro@ZenIV.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.