]> git.hungrycats.org Git - linux/commitdiff
zygo: btrfs: add some WARN_ONs to chase KASAN stack traces
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Tue, 3 Dec 2019 16:20:44 +0000 (11:20 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 14 Dec 2019 04:53:05 +0000 (23:53 -0500)
(cherry picked from commit 7bc46196ca4d31da287f151b905babbdb429c444)

fs/btrfs/ctree.c
fs/btrfs/relocation.c
fs/btrfs/transaction.c

index 24658b5a578708f8b649a634e0503545e3930881..2aef8f09bd0581dce36987d9f4c7f5562c57c0aa 100644 (file)
@@ -227,6 +227,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
        WARN_ON(test_bit(BTRFS_ROOT_REF_COWS, &root->state) &&
                trans->transid != root->last_trans);
 
+       WARN_ON(!buf);
        level = btrfs_header_level(buf);
        if (level == 0)
                btrfs_item_key(buf, &disk_key, 0);
index 2b6189e646b6df03c746c5007426df77ae910779..1ceb461c5834470ce186d0cfdfef3fee27c5379c 100644 (file)
@@ -1393,6 +1393,7 @@ static struct btrfs_root *create_reloc_root(struct btrfs_trans_handle *trans,
                 * set in their headers. so it's OK to not update
                 * the 'last_snapshot'.
                 */
+               WARN_ON(!root->node);
                ret = btrfs_copy_root(trans, root, root->node, &eb,
                                      BTRFS_TREE_RELOC_OBJECTID);
                BUG_ON(ret);
@@ -4772,6 +4773,7 @@ int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans,
        }
 
        new_root = pending->snap;
+       WARN_ON(!root->reloc_root->node);
        reloc_root = create_reloc_root(trans, root->reloc_root,
                                       new_root->root_key.objectid);
        if (IS_ERR(reloc_root))
index cfc08ef9b87648e4ec63156e32ef84e0424c76e3..1ed49b63d7d271b7f40e8e63f795a5c1e2f712a0 100644 (file)
@@ -1636,6 +1636,9 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
                goto fail;
        }
 
+       WARN_ON(!pending->root);
+       WARN_ON(!pending->root->reloc_root);
+       WARN_ON(!pending->root->reloc_root->node);
        ret = btrfs_reloc_post_snapshot(trans, pending);
        if (ret) {
                btrfs_abort_transaction(trans, ret);
@@ -1727,6 +1730,9 @@ static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans)
 
        list_for_each_entry_safe(pending, next, head, list) {
                list_del(&pending->list);
+               WARN_ON(!pending->root);
+               WARN_ON(!pending->root->reloc_root);
+               WARN_ON(!pending->root->reloc_root->node);
                ret = create_pending_snapshot(trans, pending);
                if (ret)
                        break;