]> git.hungrycats.org Git - linux/commitdiff
zygo: btrfs: more debugging from Qu
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 6 Dec 2019 16:46:26 +0000 (11:46 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 8 Dec 2019 03:18:37 +0000 (22:18 -0500)
Mind to apply this snippet?

It's not a poking around fixes, but a debug output for:
- Which block group is being balanced, and when it finishes
- Which subvolume (including reloc tree) is being dropped and when it
finishes

It's going to hit all those bugs again, but with the debug patch, I can
see how impossible things happens.

After some discussion in SUSE internal IRC, it proves one nightmare:
- root->reloc_root assignment is not atomic
- fs_info->reloc_cntl assigment is not atomic

So despite that, would you like to test it on a single core VM or
disabling all other cores of a baremetal to see if it can be reproduced?

Thanks,
Qu

(cherry picked from commit 77fc783e4d70918b453c7f2ba03f5d18d3a31ba3)

fs/btrfs/extent-tree.c
fs/btrfs/relocation.c

index b55ae18aacd199735712412766e05b3da321bde9..c35bd887d9e1e5c11b95bca75159735aac3cb172 100644 (file)
@@ -9273,8 +9273,11 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
        int ret;
        int level;
        bool root_dropped = false;
+       u64 root_objectid = root->root_key.objectid;
+       u64 root_offset = root->root_key.offset;
 
-       btrfs_debug(fs_info, "Drop subvolume %llu", root->root_key.objectid);
+       btrfs_info(fs_info, "%s: rootid=%lld,%lld, for_reloc=%d start",
+               __func__, root_objectid, root_offset, for_reloc);
 
        path = btrfs_alloc_path();
        if (!path) {
@@ -9486,6 +9489,8 @@ out:
                btrfs_add_dead_root(root);
        if (err && err != -EAGAIN)
                btrfs_handle_fs_error(fs_info, err, NULL);
+       btrfs_info(fs_info, "%s: rootid=%lld,%lld, for_reloc=%d ret=%d finished",
+                       __func__, root_objectid, root_offset, for_reloc, err);
        return err;
 }
 
index f857a8b0fcedd45659b3604c07adbdab8c8e3129..72f998d32fd4d31e5d5f4a31a8d82ae0b2aaa501 100644 (file)
@@ -4347,6 +4347,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
        WARN_ON(rc->block_group->reserved > 0);
        WARN_ON(btrfs_block_group_used(&rc->block_group->item) > 0);
 out:
+       btrfs_info(fs_info, "%s: finished %llu", __func__, group_start);
        if (err && rw)
                btrfs_dec_block_group_ro(rc->block_group);
        iput(rc->data_inode);