Hello again,
(this is a status update)
from what I begin to understand, the real problem is not the transid,
which is a kind of warning, but the failed assertion on "tree_root",
meaning that the read_tree_block call at disk-io.nc:736 fails.
The GDB backtrace is the following :
Reading symbols from /root/btrfs-progs-unstable/btrfsck...done.
(gdb) Starting program: /root/btrfs-progs-unstable/btrfsck /dev/dm-0
parent transid verify failed on 657818017792 wanted 85879 found 85878
parent transid verify failed on 657818017792 wanted 85879 found 85878
parent transid verify failed on 657818017792 wanted 85879 found 85878
btrfsck: disk-io.c:739: open_ctree_fd: Assertion `!(!tree_root->node)' failed.
Program received signal SIGABRT, Aborted.
0x77885ee5 in raise () from /lib/libc.so.6
(gdb) #0 0x77885ee5 in raise () from /lib/libc.so.6
#1 0x77887896 in abort () from /lib/libc.so.6
#2 0x7787e7a5 in __assert_fail () from /lib/libc.so.6
#3 0x0040a96a in open_ctree_fd (fp=5, path=0x14f77 , sb_bytenr=, writes=)
at disk-io.c:663
#4 0x0040adca in open_ctree (filename=0x7fffde9e "/dev/dm-0",
sb_bytenr=0, writes=0) at disk-io.c:587
#5 0x004052ec in main (ac=, av=0x7fffdb68) at
btrfsck.c:2859
Then I did some changes in disk-io.c#read_tree_block to tell him that
its parent_transid is 85878 when it is called with 85879 (a completely
blind change on consistency issues but my only guess for now). I also
added some printk's to see what is going on. For details, see the
disk-io.[ch].patch files attached. Now btrfsck fails on this:
-- entering read_tree_block...
called with parent_transid=85879, setting it to 85878
btrfs_buffer_uptodate: extent_buffer_uptodate FAIL
btrfs_buffer_uptodate @657818017792 / transid wanted 85878
-- search loop [transid=85878] --
`-> extend buffer informations follow
|-> start: 657818017792
|-> dev_bytenr: 659437019136
|-> len:4096
|-> refs: 2
`-> flags: 0
`-> eb found and set uptodate!
btrfsck: root-tree.c:46: btrfs_find_last_root: Assertion `!(path->slots[0] ==
0)' failed.
I dd'ed the block to have a backup, I attached it here, if it can useful
for anything. Here's the dd command, if I'm wrong somewhere, please tell
me:
dd bs=1 count=4096 skip=659437019136 if=/dev/dm-0 of=block
My next move will be to analyse the BTRFS's structure more deeply to
understand how I can try to figure out what exactly is impacted and how
to get access to a least what is not impacted (corruption on impacted
data is something I can live with much better than losing access to
these 3TB of data "just" because of this ;)).
Any link/help welcome, of course. And also tell me if you consider my
status updates as useless for this list, so I don't spam you guys. My
first goal is to get the data back, of course, but a good secondary goal
is to help have btrfsck handle these cases (but my C is pretty old now).
Regards,
Mikaƫl.
diff --git a/disk-io.c b/disk-io.c
index a6e1000..17808fd 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -185,16 +185,29 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
int mirror_num = 0;
int num_copies;
+ printk("-- entering read_tree_block...\n");
+
+ if (parent_transid == 85879) {
+ printk("called with parent_transid=85879,"
+ " setting it to 85878\n");
+ parent_transid = 85878;
+ }
+
eb = btrfs_find_create_tree_block(root, bytenr, blocksize);
if (!eb)
return NULL;
if (btrfs_buffer_uptodate(eb, parent_transid))
return eb;
+
+ printk("btrfs_buffer_uptodate @%llu / transid wanted %llu\n",
+ (unsigned long long) eb->start,
+ (unsigned long long) parent_transid);
dev_nr = 0;
length = blocksize;
while (1) {
+ printk("-- search loop [transid=%llu] --\n", parent_transid);
ret = btrfs_map_block(&root->fs_info->mapping_tree, READ,
eb->start, &length, &multi, mirror_num);
BUG_ON(ret);
@@ -204,10 +217,14 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
eb->dev_bytenr = multi->stripes[0].physical;
kfree(multi);
ret = read_extent_from_disk(eb);
+ if (parent_transid == 85878) {
+ print_extent_buffer_info(eb);
+ }
if (ret == 0 && check_tree_block(root, eb) == 0 &&
csum_tree_block(root, eb, 1) == 0 &&
verify_parent_transid(eb->tree, eb, parent_transid) == 0) {
btrfs_set_buffer_uptodate(eb);
+ printk("`-> eb found and set uptodate!\n");
return eb;
}
num_copies = btrfs_num_copies(&root->fs_info->mapping_tree,
@@ -221,6 +238,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
}
}
free_extent_buffer(eb);
+ printk("-- not found --\n");
return NULL;
}
@@ -1016,10 +1034,14 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
int ret;
ret = extent_buffer_uptodate(buf);
- if (!ret)
+ if (!ret) {
+ printk("btrfs_buffer_uptodate: extent_buffer_uptodate FAIL\n");
return ret;
+ }
ret =