diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-01-24 18:02:07 +0100 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-01-24 18:49:48 +0100 |
commit | 201a90389424d6771d24fc5d72f7e34cb4a8f967 (patch) | |
tree | 2e184b0b5a702855163d7da2fa5bee2a6fb8ef98 /fs/btrfs/tree-log.c | |
parent | Btrfs: fix a regression in balance usage filter (diff) | |
download | linux-201a90389424d6771d24fc5d72f7e34cb4a8f967.tar.xz linux-201a90389424d6771d24fc5d72f7e34cb4a8f967.zip |
Btrfs: do not allow logged extents to be merged or removed
We drop the extent map tree lock while we're logging extents, so somebody
could come in and merge another extent into this one and screw up our
logging, or they could even remove us from the list which would keep us from
logging the extent or freeing our ref on it, so we need to make sure to not
clear LOGGING until after the extent is logged, and then we can merge it to
adjacent extents. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to '')
-rw-r--r-- | fs/btrfs/tree-log.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 83186c7e45d4..de8899b04d69 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3410,13 +3410,13 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, em = list_entry(extents.next, struct extent_map, list); list_del_init(&em->list); - clear_bit(EXTENT_FLAG_LOGGING, &em->flags); /* * If we had an error we just need to delete everybody from our * private list. */ if (ret) { + clear_em_logging(tree, em); free_extent_map(em); continue; } @@ -3424,8 +3424,9 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, write_unlock(&tree->lock); ret = log_one_extent(trans, inode, root, em, path); - free_extent_map(em); write_lock(&tree->lock); + clear_em_logging(tree, em); + free_extent_map(em); } WARN_ON(!list_empty(&extents)); write_unlock(&tree->lock); |