From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: David Disseldorp <ddiss@suse.de>
Subject: Re: [PATCH] Btrfs: fix EIO on reading file after ioctl clone works on it
Date: Fri, 9 May 2014 10:02:34 +0800 [thread overview]
Message-ID: <20140509020234.GA4250@localhost.localdomain> (raw)
In-Reply-To: <1399600862-3141-1-git-send-email-bo.li.liu@oracle.com>
(cc David)
-liubo
On Fri, May 09, 2014 at 10:01:02AM +0800, Liu Bo wrote:
> For inline data extent, we need to make its length aligned, otherwise,
> we can get a phantom extent map which confuses readpages() to return -EIO.
>
> This can be detected by xfstests/btrfs/035.
>
> Reported-by: David Disseldorp <ddiss@suse.de>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/ioctl.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 2ad7de9..2f6d7b1 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -3120,6 +3120,8 @@ process_slot:
> } else if (type == BTRFS_FILE_EXTENT_INLINE) {
> u64 skip = 0;
> u64 trim = 0;
> + u64 aligned_end = 0;
> +
> if (off > key.offset) {
> skip = off - key.offset;
> new_key.offset += skip;
> @@ -3136,9 +3138,11 @@ process_slot:
> size -= skip + trim;
> datal -= skip + trim;
>
> + aligned_end = ALIGN(new_key.offset + datal,
> + root->sectorsize);
> ret = btrfs_drop_extents(trans, root, inode,
> new_key.offset,
> - new_key.offset + datal,
> + aligned_end,
> 1);
> if (ret) {
> if (ret != -EOPNOTSUPP)
> --
> 1.8.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-05-09 2:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 2:01 [PATCH] Btrfs: fix EIO on reading file after ioctl clone works on it Liu Bo
2014-05-09 2:02 ` Liu Bo [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=20140509020234.GA4250@localhost.localdomain \
--to=bo.li.liu@oracle.com \
--cc=ddiss@suse.de \
--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).