From: Miao Xie <miaox@cn.fujitsu.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs: fix wrong csum clone when doing relocation
Date: Tue, 18 Jun 2013 11:13:37 +0800 [thread overview]
Message-ID: <51BFD061.4070404@cn.fujitsu.com> (raw)
In-Reply-To: <20130614152712.GA28783@localhost.localdomain>
From: Josef Bacik <jbacik@fusionio.com>
Patch "Btrfs: remove btrfs_sector_sum structure" introduced a problem
that we copied the checksum value to the wrong address when doing
relocation.
The reason is:
It is very likely that one ordered extent has two or more checksum
structures to keep the relative checksum value, and ->bytenr in each
checksum structure should point to the start of its extent, not the
start of the ordered extent. Fix it.
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/btrfs/relocation.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 35c0cf7..e3108e5 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4410,11 +4410,13 @@ int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len)
if (ret)
goto out;
+ disk_bytenr = ordered->start;
while (!list_empty(&list)) {
sums = list_entry(list.next, struct btrfs_ordered_sum, list);
list_del_init(&sums->list);
- sums->bytenr = ordered->start;
+ sums->bytenr = disk_bytenr;
+ disk_bytenr += sums->len;
btrfs_add_ordered_sum(inode, ordered, sums);
}
--
1.8.1.4
next prev parent reply other threads:[~2013-06-18 3:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 10:17 [PATCH V3] Btrfs: remove btrfs_sector_sum structure Miao Xie
2013-06-14 15:27 ` Josef Bacik
2013-06-18 3:13 ` Miao Xie [this message]
2013-06-18 12:23 ` [PATCH] Btrfs: fix wrong csum clone when doing relocation Josef Bacik
2013-06-19 2:36 ` [PATCH V4] Btrfs: remove btrfs_sector_sum structure Miao Xie
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=51BFD061.4070404@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=jbacik@fusionio.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).