summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2018-11-30 17:52:13 +0100
committerDavid Sterba <dsterba@suse.com>2018-12-17 14:51:48 +0100
commit83354f0772cd07828b0fcdf1ef2872fd2032acb8 (patch)
treed552f12d1a5870ce7be0c6fceff361f558b96265 /fs/btrfs/ctree.c
parentbtrfs: extent-tree: cleanup one-shot usage of @blocksize in do_walk_down (diff)
downloadlinux-83354f0772cd07828b0fcdf1ef2872fd2032acb8.tar.xz
linux-83354f0772cd07828b0fcdf1ef2872fd2032acb8.zip
btrfs: catch cow on deleting snapshots
When debugging some weird extent reference bug I suspected that we were changing a snapshot while we were deleting it, which could explain my bug. This was indeed what was happening, and this patch helped me verify my theory. It is never correct to modify the snapshot once it's being deleted, so mark the root when we are deleting it and make sure we complain about it when it happens. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 5912a97b07a6..72745235896f 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1440,6 +1440,10 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,
u64 search_start;
int ret;
+ if (test_bit(BTRFS_ROOT_DELETING, &root->state))
+ btrfs_err(fs_info,
+ "COW'ing blocks on a fs root that's being dropped");
+
if (trans->transaction != fs_info->running_transaction)
WARN(1, KERN_CRIT "trans %llu running %llu\n",
trans->transid,