Message ID | 20130713121404.65fc89ea@Bidule (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Jérôme Carretero posted on Sat, 13 Jul 2013 12:14:04 -0400 as excerpted: > - `btrfsck` was crashing because the code would progress even if fs_root > was null... fixed with this patch: AFAIK (based on what I've seen go by on the list, tho I'm not technical enough to actually make sense of the patches themselves) there's a still new patch floating around that deals with that one already. It's too new to be in 3.10.0 (tho it might possibly make a 3.10 stable if it hits 3.11), but will hopefully be in 3.11. The rest I'll leave to the experts.
On Sat, 13 Jul 2013 12:14:04 -0400 Jérôme Carretero <cJ-ko@zougloub.eu> wrote: > Within the UML instance with python, I cannot do `ls` (`os.listdir()`) > on my home folder (`/home/cJ`), and btrfs-restore only restores > a few dot files in there. > But I can get inode numbers and read files or subdirectories beyond > this folder. I was able to recover the "critical" data this way (mounted a second image and ran python,busybox and rsync to salvage the data at known locations under the problematic directory). Right now, I think that 2-3 sections of medatata had been overridden by data very recently. These sections are very small, so I don't think it was a discard issue. And I think this must have been provoked somehow by older crashes a few weeks ago. My disk image is still there in case someone wants to play with it. Regards,
diff --git a/cmds-check.c b/cmds-check.c index 8015288..be3e329 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -5777,6 +5777,11 @@ int cmd_check(int argc, char **argv) root = info->fs_root; + if (root == NULL) { + fprintf(stderr, "Error finding FS root\n"); + return -EIO; + } + if (init_extent_tree) { printf("Creating a new extent tree\n"); ret = reinit_extent_tree(info); - The linux kernel code patched with the following ugly hack would (somehow) boot: diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b8b60b6..0807f4d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2627,6 +2627,14 @@ retry_root_backup: tree_root->node = read_tree_block(tree_root, btrfs_super_root(disk_super), blocksize, generation); + + if (1) { // ugly hack to force using the second superblock + static int i = 0; + if (i++ == 0) { + goto recovery_tree_root; + } + } + if (!tree_root->node || !test_bit(EXTENT_BUFFER_UPTODATE, &tree_root->node->bflags)) { printk(KERN_WARNING "btrfs: failed to read tree root on %s\n",